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
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
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..
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
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...
Got it working...... Excellent work!!
QuoteOriginally posted by XPMAN
Got it working...... Excellent work!!
Then you could help me........?
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
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.
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....
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
Thanks buddy for the info and the re-mod. Can't wait to see it and use.
Thnx again for going "above and beyond" ;)
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
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!!
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
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
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
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
well close tabs or not i like this really much.
(http://www.thegoldenangel.org/images/lua/titmouse.jpg)
shows it tidy enough for me.lol
the lines help a lot on this small tabbing.
plop
yep looks ok but still doesnt win me over to large tabs :p
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
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
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
Thnx guys......very nicely done! ! Works great!
QuoteOriginally posted by XPMAN
Thnx guys......very nicely done! ! Works great!
yw
plop
QuoteOriginally posted by 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
where can i get this program you speak of please /:)
pHaTz,
QuoteOriginally posted by (uk-kingdom)pH?tt?
QuoteOriginally posted by 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
where can i get this program you speak of please /:)
pHaTz,
omg did i convice you. ???? lol
here (http://www.xtgsystems.com/linux/lua/titmouse.php) you can get it.
but it needs some dll, saintsinner or nighlitch know where 2 get it.
on me it never asked for this as i started with an earlyer version.
but if you want it i can email that 1 2 you.
plop
thx bro ill get right to it, see what its like, i think the save cpu sounds good to me :p
thx ;)
:rolleyes: ooh almost lol. starts ok, but i cant start a new script or open without bill telling me windows has perfomred a sh**y mistake *lol*
QuoteOriginally posted by (uk-kingdom)pH?tt?
:rolleyes: ooh almost lol. starts ok, but i cant start a new script or open without bill telling me windows has perfomred a sh**y mistake *lol*
thats the missing dll.
send me an email and i'll respond with what you need. lol
plop
QuoteOriginally posted by plop
QuoteOriginally posted by (uk-kingdom)pH?tt?
:rolleyes: ooh almost lol. starts ok, but i cant start a new script or open without bill telling me windows has perfomred a sh**y mistake *lol*
thats the missing dll.
send me an email and i'll respond with what you need. lol
plop
send about 20mins ago bah :(( lol i pm you addy
here ya go
http://mitglied.lycos.de/dirtyfinger01/files/TitMouse.zip
has the prog and the dll file
QuoteOriginally posted by SaintSinner
here ya go
http://mitglied.lycos.de/dirtyfinger01/files/TitMouse.zip
has the prog and the dll file
doesnt work
QuoteOriginally posted by (uk-kingdom)pH?tt?
doesnt work
the link?
right click and save as
if its the prog
then unzip it and then run it.
QuoteOriginally posted by SaintSinner
QuoteOriginally posted by (uk-kingdom)pH?tt?
doesnt work
the link?
right click and save as
if its the prog
then unzip it and then run it.
ok done thx
no prob
Was wondering - How many adds can it store within the guestbook ??
Also how to you delete an entry??
Any way of confermation of entry complete? ??
Woodster
QuoteOriginally posted by Woodster
Was wondering - How many adds can it store within the guestbook ??
Also how to you delete an entry??
Any way of confermation of entry complete? ??
Woodster
the limit of it is your drive space avail. lol
there isn't a delete command in it but you can delete things manualy from the data file.
plop
ello phatty,plop,saintsinner
right been trying to add a delete comand to this script eg:
#deleteGBook
but i can make it delete All the messages with
GBook = "guestbook.dat"
function DelGBook(user,data)
writeto(GBook)
write("")
writeto()
user:SendPM(Bot,"GBook
is Deleted..!")
end
but cant work out how to make delte the a message when using this command :-
#deleteGBook
any help would be most welcome since u lot are the best of the best :) (that should get me some brownie points LOL)
-- GuestBook by kepp
-- add,read,delete
-- Have fun
sBot = "GuestBook"
function Main()
frmHub:RegBot(sBot)
end
function DataArrival(user, data)
if (strsub(data,1,1) == "<") then
data = strsub(data,1,strlen(data)-1)
s,e,cmd = strfind(data,"%b<>%s+(%S+)")
if (cmd=="+addgb") then
AddIt(user, data) return 1
elseif (cmd=="+readgb") then
ReadIt(user, data) return 1
elseif (cmd=="+delete") then
Delfile(user, data)
end
end
end
function AddIt(user, data)
s,e,cmd,arg = strfind(data,"%b<>%s+(%S+)%s+(.+)")
if arg == nil then
user:SendData(sBot,"Please enter a message!! (I don't think people like reading empty posts!)")
else
local file = openfile("guestbook.lst","a+")
write(file," Author : "..user.sName.." & Date : "..date().." & Subject : & "..arg.." &&")
user:SendData(sBot,"Your entry has been saved..")
closefile(file)
end
end
function ReadIt(user, data)
brd = "@==== G U E S T B O O K ====@"
ebrd = "@========== E N D ==========@"
local file = openfile("guestbook.lst","r")
if file == nil then
user:SendData(sBot,"There are no entries yet! You want the first place? ;)?")
else
line = read(file,"*a")
line = gsub(line,"&","\r\n")
user:SendData(sBot,"\r\n"..brd.."\r\n\r\n"..line.."\r\n"..ebrd)
closefile(file)
end
end
function Delfile(user, data)
local file = remove("guestbook.lst")
user:SendData(sBot,"File is removed.")
if file == nil then
user:SendData(sBot,"ERROR*** File dosen't exist") return 1
end
end
nice 1 keep :)
thats better than my GBook commands in my New Bot , now how do i delete a enter out of the book ????
hope this is right , cant test aint got my over comp running as yet [HD crashed on it :( ]
heres the code
function DeleteMessage(user, data)
s,e,cmd,arg = strfind(data,"%b<>%s+(%S+)%s+(.+)")
if arg == nil then
user:SendData(sBot," ERROR*** Type +DelMessage ...Try again***") else
local file = openfile("guestbook.lst","a+")
remove(file,"..arg..")
user:SendData(sBot,"Message Deleted..")
closefile(file)
end
u would have to copy the message stright from guestbook.lst after u done +readgb if u follow as it would have to be exctly the same as it was writein to the guestbook.lst :)
not sure if this remove(file,"..arg..") will work
How does the output look like?
is it in a table? :S
like i said kepp i aint shaw cos i cant test on this comp , use other comp for codeing (down due to JD crash) , but u might be right on the table , but i aint that good , going to to install Backup HD in 2nd comp and test , cos i got the bug now and i wont sleep :) :)
hello kepp
dident take that long to install backup HD
heres what i get when i run the +Delmessage command
Syntax Error: bad argument #1 to 'remove, {string expected, got userdata)
no this is were my lack of luna comes in to play cos i aint a clue as yet what to do
?(