A better 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

A better guestbook

Started by Pit, 08 November, 2004, 18:00:15

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Pit

Greetings scripters

I have this script:

bot = "GuestBook"

AddEntry = "!assinar"
Help = "!guestbook"
ReadGB = "!ler"

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..") Assinou :"..arg.."?")
            SendPmToNick(botname,"Entrada gravada no GuestBook ....")            
            closefile(handle)
            SendToAll("Nova entrada no nosso GuestBook pelo User "..user.sName.."!!")
         return 1
         elseif cmd==Help then
            user:SendPM(bot,"Benvindo ao GuestBook do Friends!")
            user:SendPM(bot,"Assina como quiseres!")
            user:SendPM(bot,"      ")
            user:SendPM(bot,"Para assinar o Livro basta escrever   !assinar  < msg >  ")
            user:SendPM(bot,"Para ler todas as mensagens escrever  !ler   ")
         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)
               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..") assinou :"..arg.."?")
            user:SendData(bot,"Entrada gravada no GuestBook ....")
            closefile(handle)
         else
            user:SendData(bot,"Escreve qualquer coisa, n?o estou programado para ler pensamentos! :)")
         end
         return 1
      elseif cmd==Help then
         user:SendPM(bot,"Este ? o nosso GuestBook! Assina como quiseres!     '  !assinar  < msg >  ;     !ler ' ")
      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)
            end
         closefile(handle2)
         end
      return 1
      end
   end
end

-------------------------------------------------------------

Now what i wanted if it's possible, is can the bot send a msg when we enter on it??
I mean,
when we send private msg to it, then it opens but stays blanc, is it possible that the bot script after we enter on it give us a welcome msg, like:

Welcome 'nick'
Type !assinar to write the guestbook
Type !ler to read all msgs

..instead of the actual procedure, witch is , we have to type !guestbook to see this comands...

And one other thing scripters,
On the guestbook.dat that is created only appears teh msgs and who wrote them, is it possible to have a few more points, like date and time??
Thanks

and please cheak it out how the help functions appears:
is like this:

Benvindo ao GuestBook do Friends!
Assina como quiseres!
     
Para assinar o Livro basta escrever   !assinar  < msg >  
Para ler todas as mensagens escrever  !ler  

Can you make it like this:

Benvindo ao GuestBook do Friends!
                       Assina como quiseres!
       
                       Para assinar o Livro basta escrever   !assinar  < msg >  
                       Para ler todas as mensagens escrever  !ler  


Hope you can do this, it's just a matter of 'estectic'!!!

Keep helping who needs..

Thanks a lot

Herodes

There is a way to pop up a blank window , yes ...

but what do you mean by saying 'entering'? either you chat to or you receive chat from ...

there isnt a middle state in this ...
as there isnt in the pm chat with other ppl ...

BTW were is the Vital CREDITS note ??

Pit

Greetings Herodes

In first place...yes...The guestbook script isn't mine!!!
Is from plop, nerbos or another great scripter!
I simple edit it here but with no intention what so ever to make believe that is mine...
I don?t know how to make this scripts....
I never did any...

But i 'apoligise' the autor of this script...Honest

Now, what i mean is imagine i want to sign the guestbook, so i send a private msg to the bot by clicking right mouse, choosing the the pvt msg.
So a page blanc opens and stays as well, what i wanted was when i do that when entering the blanc page, even i don't type anything i wanted to receve promptly a msg with the comands..

Hope it work..

Thanks

Pit

Greetings Mutor

Thanks for the reply man
But that script is one level below this one i have...
There's nothing new on it...

P.S. I've said i'm sorry about the missing CREDITS, but it seems like my mistake is more importante that the help i need...

But thanks anyway...i'll research for who's the owner of this script i have and then i'll post here my sincere respects for it...

Thanks..


monnie

Herodes

Well what you ask of isnt possible ...
if you dont sent data to the bot there is no way it can respond on its own .. and the  "about-to-start-a-pm-session" simply isnt sending any data ..

The bot cant figure out that you've opened that window as you cant have known if some1 else does that on your nick .. you are only able to realise that he did if you get some chat ... I hope it's clear ..

Pit

Greetings

Sorry Herodes,
what you've said is not true!
I have a chatroom created by plop and it does what i say
When i enter the room
the boot sends me imedeatly a welcome msg
saying Hello
without any word by my nick

But thanks for your time

Pit

Herodes

if you dont send data to it ..
there is no way that it knows you want smth from it ..

So maybe that you dont explain what you need in the right way ?

I mean maybe  it triggers on Logging in to the hub .. or maybe some other way that you'll need to make clear .. :)

SMF spam blocked by CleanTalk