PtokaX forum

Archive => Archived 4.0 boards => Finished Lua 4 scripts => Topic started by: BlazeXxX on 31 October, 2003, 03:21:48

Title: Hub Guestbook
Post by: BlazeXxX on 31 October, 2003, 03:21:48
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
Title:
Post by: kb2000 on 22 January, 2004, 12:24:02
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
Title: Problems
Post by: XPMAN on 22 January, 2004, 18:55:54
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..
Title:
Post by: plop on 22 January, 2004, 23:53:29
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
Title:
Post by: kb2000 on 23 January, 2004, 07:17:41
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...
Title: Working.
Post by: XPMAN on 23 January, 2004, 07:37:56
Got it working...... Excellent work!!
Title:
Post by: kb2000 on 23 January, 2004, 07:40:45
QuoteOriginally posted by XPMAN
Got it working...... Excellent work!!

Then you could help me........?
Title:
Post by: plop on 24 January, 2004, 04:47:52
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
Title: I'm stupid...........
Post by: XPMAN on 24 January, 2004, 06:13:33
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.
Title:
Post by: kb2000 on 24 January, 2004, 11:41:21
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....
Title:
Post by: plop on 24 January, 2004, 19:48:30
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
Title: Thanks
Post by: XPMAN on 25 January, 2004, 09:54:16
Thanks buddy for the info and the re-mod. Can't wait to see it and use.

Thnx again for going "above and beyond"  ;)
Title:
Post by: plop on 25 January, 2004, 23:46:50
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
Title: no work.
Post by: XPMAN on 26 January, 2004, 00:15:30
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!!
Title:
Post by: plop on 26 January, 2004, 00:58:37
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
Title:
Post by: pHaTTy on 26 January, 2004, 01:16:52
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

Title:
Post by: plop on 26 January, 2004, 01:29:51
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
Title:
Post by: pHaTTy on 26 January, 2004, 01:31:01
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
Title:
Post by: plop on 26 January, 2004, 01:43:11
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
Title:
Post by: pHaTTy on 26 January, 2004, 01:45:36
yep looks ok but still doesnt win me over to large tabs :p
Title:
Post by: plop on 26 January, 2004, 01:56:04
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
Title:
Post by: pHaTTy on 26 January, 2004, 01:59:20
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
Title:
Post by: plop on 26 January, 2004, 02:05:53
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
Title: Thnx
Post by: XPMAN on 26 January, 2004, 04:52:35
Thnx guys......very nicely done! ! Works great!
Title:
Post by: plop on 26 January, 2004, 12:08:02
QuoteOriginally posted by XPMAN
Thnx guys......very nicely done! ! Works great!
yw

plop
Title:
Post by: pHaTTy on 26 January, 2004, 13:09:07
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,
Title:
Post by: plop on 26 January, 2004, 13:36:23
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
Title:
Post by: pHaTTy on 26 January, 2004, 13:47:34
thx bro ill get right to it, see what its like, i think the save cpu sounds good to me :p

thx ;)
Title:
Post by: pHaTTy on 26 January, 2004, 13:56:31
: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*
Title:
Post by: plop on 26 January, 2004, 14:28:20
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
Title:
Post by: pHaTTy on 26 January, 2004, 14:50:00
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
Title:
Post by: SaintSinner on 26 January, 2004, 14:57:36
here ya go

http://mitglied.lycos.de/dirtyfinger01/files/TitMouse.zip

has the prog and the dll file
Title:
Post by: pHaTTy on 26 January, 2004, 15:36:25
QuoteOriginally posted by SaintSinner
here ya go

http://mitglied.lycos.de/dirtyfinger01/files/TitMouse.zip

has the prog and the dll file

doesnt work
Title:
Post by: SaintSinner on 26 January, 2004, 15:54:02
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.
Title:
Post by: pHaTTy on 26 January, 2004, 15:56:09
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
Title:
Post by: SaintSinner on 26 January, 2004, 16:09:54
no prob
Title:
Post by: Woodster on 09 February, 2004, 22:27:52
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
Title:
Post by: plop on 10 February, 2004, 19:13:57
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
Title:
Post by: ((UKSN))shad_dow on 21 February, 2004, 12:22:23
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)
Title:
Post by: kepp on 21 February, 2004, 18:15:58
-- 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
Title:
Post by: ((UKSN))shad_dow on 21 February, 2004, 22:07:32
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 :)

 
Title:
Post by: kepp on 21 February, 2004, 22:59:20
not sure if this remove(file,"..arg..") will work

How does the output look like?

is it in a table? :S
Title:
Post by: ((UKSN))shad_dow on 21 February, 2004, 23:23:01
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 :) :)
Title:
Post by: ((UKSN))shad_dow on 21 February, 2004, 23:39:45
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
 ?(