Hub Guestbook
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

Hub Guestbook

Started by BlazeXxX, 31 October, 2003, 03:21:48

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

BlazeXxX

A Hub guestbook script by aMutex :)


-- Start Copying from this line
-- guestbook.lua, created by amutex 12.01.2003
--thx to nathanos for the fine pm-pasing and Dirtyfinger for tokenizing
botname = "GuestBook"
function tokenize (inString,token)  
     _WORDS = {}  
     local matcher = "([^?"..token.."]+)"  
     gsub(inString, matcher, function (w) tinsert(_WORDS,w) end)  
     return _WORDS  
end  
function GetArgs(data)
   s,e,whoTo,from,cmd,arg,arg2 = strfind(data,"$To:%s+(%S+)%s+From:%s+(%S+)%s+$%b<>%s+(%S+)%s+(.*)")
   return arg,arg2
end
function Main()
   frmHub:RegBot(botname)
end
function DataArrival(user, data)
if(strsub(data, 1, 4) == "$To:") then
data=strsub(data,1,strlen(data)-1)
s,e,whoTo = strfind(data,"$To:%s+(%S+)")
if (whoTo == botname) then
s,e,whoTo,from,cmd = strfind(data,"$To:%s+(%S+)%s+From:%s+(%S+)%s+$%b<>%s+(%S+)")
if (cmd=="#addGBookentry") then
arg= GetArgs(data)
local handle=openfile("guestbook.dat","a")
write(handle,"("..user.sName..") wrote :"..arg.."?")
user:SendPM(botname,"Guestbook entry saved ....")
closefile(handle)
end
if (cmd=="#help") then
user:SendPM(botname,"This is our Guestbook! Feel free to ....")
end

if (cmd=="#readGBook") then
handle2=openfile("guestbook.dat","r")
if (handle2==nil) then
else
line = read(handle2,"*a")
line=strsub(line,1,strlen(line)-1)
linearray=tokenize(line,"?")
for i=1,linearray.n do
user:SendPM(botname,linearray)
end
closefile(handle2)
end
end
end
end
end

-- Finish Copying

kb2000

I'm not able to add entries to the guestbook with this command line

#addGBookentry

please help

Btw, i would also like to have some good arts for the artbot.

Thanks in advance

XPMAN

I was unable to get it to work at all. I am a beta tester of the PtokaX hub software. I would think it would work though. Anyone have any ideas as to why this is not working??  Been looking for a nice guestbook to add to my hub....

Hope someone can figure it out..

plop

haven't tryed it yet but all commands go in pm 2 the bot.
from a quick look i can't see anything wrong with it.

plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

kb2000

QuoteOriginally posted by plop
haven't tryed it yet but all commands go in pm 2 the bot.
from a quick look i can't see anything wrong with it.

plop

plop, Could you help me with a good guestbook that works.

Please...

XPMAN

Got it working...... Excellent work!!

kb2000

QuoteOriginally posted by XPMAN
Got it working...... Excellent work!!

Then you could help me........?

plop

QuoteOriginally posted by kb2000
QuoteOriginally posted by plop
haven't tryed it yet but all commands go in pm 2 the bot.
from a quick look i can't see anything wrong with it.

plop

plop, Could you help me with a good guestbook that works.

Please...
i can't fix things if i can't see any errors in it.
but i'll check it out a bit better 2morrow.
maby xpman can tell how he got it working.?
(or wait for a.i. 2 be released, there is 1 in it)

plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

XPMAN

I ASSuMEd that to get it to work just type the commands in the main chat....wrong..like plop said, right click and send pm to the guestbook bot.

Once in the pm then in the chat bar at the bottom of the pm enter the commands . Everything worked great.

The only thing i wish could be changed to make it really great is to let the commands be made from the main chat instead of having to pm the bot, and having it invisible from the user list. I have way to many visible bots.......some will work if i  !unreg them with a script i have, but others just won't work unless they are visible for some reason.

Anyways if you pm the bot and stuff like i did it should work fine.

Once in the pm just type    #help   to get the rest of the commands.

kb2000

Thankyou all, i got it working too.....

Actual syntax for adding is

#addGBookentry

i was trying #addGBookentry and waiting for some line asking for the comments.....

Thanks anyway....

plop

QuoteOriginally posted by XPMAN
I ASSuMEd that to get it to work just type the commands in the main chat....wrong..like plop said, right click and send pm to the guestbook bot.

Once in the pm then in the chat bar at the bottom of the pm enter the commands . Everything worked great.

The only thing i wish could be changed to make it really great is to let the commands be made from the main chat instead of having to pm the bot, and having it invisible from the user list. I have way to many visible bots.......some will work if i  !unreg them with a script i have, but others just won't work unless they are visible for some reason.

Anyways if you pm the bot and stuff like i did it should work fine.

Once in the pm just type    #help   to get the rest of the commands.
gotta go out 2 friend in a couple mins but i'll mod it 2night so commands can also be send from mainchat.
and 1 nice trick you must like, if bot's don't have the same commands you can give them all the same name.
so you can have 10+ scripts under 1 name and they still work correct.

plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

XPMAN

Thanks buddy for the info and the re-mod. Can't wait to see it and use.

Thnx again for going "above and beyond"  ;)

plop

QuoteOriginally posted by XPMAN
Thanks buddy for the info and the re-mod. Can't wait to see it and use.

Thnx again for going "above and beyond"  ;)
yw.

this should do it, but i didn't test it so prepare for bugs.
-- guestbook.lua, created by amutex 12.01.2003
-- thx to nathanos for the fine pm-pasing and Dirtyfinger for tokenizing
-- added mainchat commands by plop

botname = "GuestBook"

function tokenize (inString,token)
   _WORDS = {}
   local matcher = "([^?"..token.."]+)"
   gsub(inString, matcher, function (w) tinsert(_WORDS,w) end)
   return _WORDS
end

function GetArgs(data)
   s,e,whoTo,from,cmd,arg,arg2 = strfind(data,"$To:%s+(%S+)%s+From:%s+(%S+)%s+$%b<>%s+(%S+)%s+(.*)")
   return arg,arg2
end

function Main()
   frmHub:RegBot(botname)
end

function DataArrival(user, data)
   if(strsub(data, 1, 4) == "$To:") then
      data=strsub(data,1,strlen(data)-1)
      s,e,whoTo = strfind(data,"$To:%s+(%S+)")
      if (whoTo == botname) then
         s,e,whoTo,from,cmd = strfind(data,"$To:%s+(%S+)%s+From:%s+(%S+)%s+$%b<>%s+(%S+)")
         if (cmd=="#addGBookentry") then
            arg= GetArgs(data)
            local handle=openfile("guestbook.dat","a")
            write(handle,"("..user.sName..") wrote :"..arg.."?")
            user:SendPM(botname,"Guestbook entry saved ....")
            closefile(handle)
         elseif (cmd=="#help") then
            user:SendPM(botname,"This is our Guestbook! Feel free to ....")
         elseif (cmd=="#readGBook") then
            handle2=openfile("guestbook.dat","r")
            if (handle2~=nil) then
               line = read(handle2,"*a")
               line=strsub(line,1,strlen(line)-1)
               linearray=tokenize(line,"?")
               for i=1,linearray.n do
                  user:SendPM(botname,linearray[i])
               end
               closefile(handle2)
            end
         end
      end
   elseif( strsub(data, 1, 1) == "<" ) then 
      data=strsub(data,1,strlen(data)-1)
      s,e,cmd = strfind(data,"%b<>%s+(%S+)") 
      if (cmd=="#addGBookentry") then
         s,e,arg = strfind(data,"%b<>%s+%S+%s+(.*)") 
         if arg ~= "" then
            local handle=openfile("guestbook.dat","a")
            write(handle,"("..user.sName..") wrote :"..arg.."?")
            user:SendData(botname,"Guestbook entry saved ....")
            closefile(handle)
         else
            user:SendData(botname,"At least write what you wanne say, i still haven't learned mind reading! :)")
         end
      elseif (cmd=="#help") then
         user:SendPM(botname,"This is our Guestbook! Feel free to ....")
      elseif (cmd=="#readGBook") then
         handle2=openfile("guestbook.dat","r")
         if (handle2~=nil) then
            line = read(handle2,"*a")
            line=strsub(line,1,strlen(line)-1)
            linearray=tokenize(line,"?")
            for i=1,linearray.n do
               user:SendPM(botname,linearray[i])
            end
            closefile(handle2)
         end
      end
   end
end
plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

XPMAN

#13
Commands worked in main chat. but the #help command did not show the commands in pm or main.

Maybe its something simple you can figure out when u get time.

Nice work!!

plop

changed some minor things and tryed it, and it's working here.
-- guestbook.lua, created by amutex 12.01.2003
-- thx to nathanos for the fine pm-pasing and Dirtyfinger for tokenizing
-- added mainchat commands by plop

botname = "GuestBook"

function tokenize (inString,token)
   _WORDS = {}
   local matcher = "([^?"..token.."]+)"
   gsub(inString, matcher, function (w) tinsert(_WORDS,w) end)
   return _WORDS
end

function GetArgs(data)
   s,e,whoTo,from,cmd,arg,arg2 = strfind(data,"$To:%s+(%S+)%s+From:%s+(%S+)%s+$%b<>%s+(%S+)%s+(.*)")
   return arg,arg2
end

function Main()
   frmHub:RegBot(botname)
end

function DataArrival(user, data)
   if(strsub(data, 1, 4) == "$To:") then
      data=strsub(data,1,strlen(data)-1)
      s,e,whoTo = strfind(data,"$To:%s+(%S+)")
      if (whoTo == botname) then
         s,e,whoTo,from,cmd = strfind(data,"$To:%s+(%S+)%s+From:%s+(%S+)%s+$%b<>%s+(%S+)")
         if (cmd=="#addGBookentry") then
            arg= GetArgs(data)
            local handle=openfile("guestbook.dat","a")
            write(handle,"("..user.sName..") wrote :"..arg.."?")
            user:SendPM(botname,"Guestbook entry saved ....")
            closefile(handle)
            return 1
         elseif (cmd=="#help") then
            user:SendPM(botname,"This is our Guestbook! Feel free to ....")
            return 1
         elseif (cmd=="#readGBook") then
            handle2=openfile("guestbook.dat","r")
            if (handle2~=nil) then
               line = read(handle2,"*a")
               line=strsub(line,1,strlen(line)-1)
               linearray=tokenize(line,"?")
               for i=1,linearray.n do
                  user:SendPM(botname,linearray[i])
               end
               closefile(handle2)
            end
            return 1
         end
      end
   elseif( strsub(data, 1, 1) == "<" ) then 
      data=strsub(data,1,strlen(data)-1)
      s,e,cmd = strfind(data,"%b<>%s+(%S+)") 
      if (cmd=="#addGBookentry") then
         local s,e,arg = strfind(data,"%b<>%s+%S+%s+(.*)") 
         if arg ~= nil and arg ~= "" then
            local handle=openfile("guestbook.dat","a")
            write(handle,"("..user.sName..") wrote :"..arg.."?")
            user:SendData(botname,"Guestbook entry saved ....")
            closefile(handle)
         else
            user:SendData(botname,"At least write what you wanne say, i still haven't learned mind reading! :)")
         end
         return 1
      elseif (cmd=="#help") then
         user:SendPM(botname,"This is our Guestbook! Feel free to ....")
         return 1
      elseif (cmd=="#readGBook") then
         handle2=openfile("guestbook.dat","r")
         if (handle2~=nil) then
            line = read(handle2,"*a")
            line=strsub(line,1,strlen(line)-1)
            linearray=tokenize(line,"?")
            for i=1,linearray.n do
               user:SendPM(botname,linearray[i])
            end
            closefile(handle2)
         end
         return 1
      end
   end
end
plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

pHaTTy

unnessesary junk, but worth it

tidy tabs, botname now bot, command are by variable, just useless stuff mainly lol

-- guestbook.lua, created by amutex 12.01.2003
-- thx to nathanos for the fine pm-pasing and Dirtyfinger for tokenizing
-- added mainchat commands by plop
-- Tidy by Phatty

bot = "GuestBook"

AddEntry = "#addGBookentry"
Help = "#help"
ReadGB = "#readGBook"

function Main()
	frmHub:RegBot(bot)
end

function tokenize (inString,token)
	_WORDS = {}
	local matcher = "([^?"..token.."]+)"
	gsub(inString, matcher, function (w) tinsert(_WORDS,w) end)
	return _WORDS
end

function GetArgs(data)
	s,e,whoTo,from,cmd,arg,arg2 = strfind(data,"$To:%s+(%S+)%s+From:%s+(%S+)%s+$%b<>%s+(%S+)%s+(.*)")
	return arg,arg2
end

function DataArrival(user, data)
	if strsub(data, 1, 4) == "$To:" then
		data=strsub(data,1,strlen(data)-1)
		s,e,whoTo = strfind(data,"$To:%s+(%S+)")

		if whoTo == bot then
			s,e,whoTo,from,cmd = strfind(data,"$To:%s+(%S+)%s+From:%s+(%S+)%s+$%b<>%s+(%S+)")
			if cmd==AddEntry then
				arg= GetArgs(data)
				local handle=openfile("guestbook.dat","a")
				write(handle,"("..user.sName..") wrote :"..arg.."?")
				user:SendPM(botname,"Guestbook entry saved ....")
				closefile(handle)
			return 1
			elseif cmd==Help then
				user:SendPM(bot,"This is our Guestbook! Feel free to ....")
			return 1
			elseif cmd==ReadGB then
				handle2=openfile("guestbook.dat","r")
				if (handle2~=nil) then
					line = read(handle2,"*a")
					line=strsub(line,1,strlen(line)-1)
					linearray=tokenize(line,"?")
					for i=1,linearray.n do
						user:SendPM(bot,linearray[i])
					end
				closefile(handle2)
				end
			return 1
			end
		end
	elseif strsub(data, 1, 1) == "<"  then 
		data=strsub(data,1,strlen(data)-1)
		s,e,cmd = strfind(data,"%b<>%s+(%S+)") 

		if cmd==AddEntry then
			local s,e,arg = strfind(data,"%b<>%s+%S+%s+(.*)") 
			if arg ~= nil and arg ~= "" then
				local handle=openfile("guestbook.dat","a")
				write(handle,"("..user.sName..") wrote :"..arg.."?")
				user:SendData(bot,"Guestbook entry saved ....")
				closefile(handle)
			else
				user:SendData(bot,"At least write what you wanne say, i still haven't learned mind reading! :)")
			end
			return 1
		elseif cmd==Help then
			user:SendPM(bot,"This is our Guestbook! Feel free to ....")
		return 1
		elseif cmd==ReadGB then
			handle2=openfile("guestbook.dat","r")
			if (handle2~=nil) then
				line = read(handle2,"*a")
				line=strsub(line,1,strlen(line)-1)
				linearray=tokenize(line,"?")
				for i=1,linearray.n do
					user:SendPM(bot,linearray[i])
				end
			closefile(handle2)
			end
		return 1
		end
	end
end
Resistance is futile!

plop

QuoteOriginally posted by (uk-kingdom)pH?tt?
unnessesary junk, but worth it

tidy tabs, botname now bot, command are by variable, just useless stuff mainly lol
you should see how tidy it looks in titmouse. lol
nice colors and so. lol

plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

pHaTTy

QuoteOriginally posted by plop
QuoteOriginally posted by (uk-kingdom)pH?tt?
unnessesary junk, but worth it

tidy tabs, botname now bot, command are by variable, just useless stuff mainly lol
you should see how tidy it looks in titmouse. lol
nice colors and so. lol

plop

lol for some reason i cant get used to close tabs :S
Resistance is futile!

plop

well close tabs or not i like this really much.

shows it tidy enough for me.lol
the lines help a lot on this small tabbing.

plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

pHaTTy

yep looks ok but still doesnt win me over to large tabs :p
Resistance is futile!

plop

QuoteOriginally posted by (uk-kingdom)pH?tt?
yep looks ok but still doesnt win me over to large tabs :p
eeehm lets see then.
lua is a character interprative language, your way takes 3 extra characters per tab.
so on 10 lines this means 30 extra characters, which means my small tabs are slightly faster. lol

did i convice ya now ???  lol
i bet not.

plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

pHaTTy

QuoteOriginally posted by plop
QuoteOriginally posted by (uk-kingdom)pH?tt?
yep looks ok but still doesnt win me over to large tabs :p
eeehm lets see then.
lua is a character interprative language, your way takes 3 extra characters per tab.
so on 10 lines this means 30 extra characters, which means my small tabs are slightly faster. lol

did i convice ya now ???  lol
i bet not.

plop

lol hahahaha almost :p
Resistance is futile!

plop

QuoteOriginally posted by (uk-kingdom)pH?tt?
QuoteOriginally posted by plop
QuoteOriginally posted by (uk-kingdom)pH?tt?
yep looks ok but still doesnt win me over to large tabs :p
eeehm lets see then.
lua is a character interprative language, your way takes 3 extra characters per tab.
so on 10 lines this means 30 extra characters, which means my small tabs are slightly faster. lol

did i convice ya now ???  lol
i bet not.

plop

lol hahahaha almost :p
oki maby i should sleep over some more things 2 fully convice ya.
but it's a bit useless so i won't.
every1 has it's own style in how they write/tab or do things.
and this makes it only more fun.
i just love titmouse as the build-in debbugger is really handy.

plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

XPMAN

Thnx guys......very nicely done! ! Works great!

plop

QuoteOriginally posted by XPMAN
Thnx guys......very nicely done! ! Works great!
yw

plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

SMF spam blocked by CleanTalk