PtokaX forum

Archive => Archived 4.0 boards => Request for Lua 4 scripts => Topic started by: skandaluz on 15 September, 2004, 18:19:52

Title: tip of the day
Post by: skandaluz on 15 September, 2004, 18:19:52
ok my last request was not possible but i got an idea not sure if it exsits have looked but found nothing
since my hub isnt a really talkative one i was thinking of adding a bot/script that when a specified number of users is reached it types out a random user configured message to the channel sumthing like "Tip of the Day: Find a Faker or Someone Violating the !rules Report Him/Her by Typin in Main Chat !report " but then it waits a set amount of time before chekin if the number of users is reached again before saying another message
i know u could just add the message to your welcome or rules txt but who really reads that haha
if sumone could help out it would be great
Title:
Post by: bastya_elvtars on 15 September, 2004, 19:14:54
Try SensiBot, it speaks when no main event occurs in 20 mins or whatever u set.

http://www.plop.nl/ptokaxbots/Guibs.php
Title:
Post by: skandaluz on 15 September, 2004, 21:13:39
not quite what i was lookin for i dont want the bot to respond to users and i would like it to type the msg when a certain number of users are in the hub as i have 2 diff peak times and would like to have as many users as possible able to read the message without having to pm them and without having to reapeat the message too many times cause noone talks in my hub therefore the message would always stay there at least for the ppl already in there
Title:
Post by: skandaluz on 16 September, 2004, 16:58:07
That is excellent ...thnx Mutor havent tried it but i'm suer it will work good i'll let u know
Title:
Post by: BoJlk on 16 September, 2004, 21:34:43
Hi Mutor!

It works Fine!

BTW i tried to add some sentences
and got Syntex Error...

I just duplicated the lines with the sentences
Exactly like they are and wirted of my own

Just for fun...

Quote--What Should this bot say in main chat when enough users have logged in.
--
Echoes = {
"Tip of the Day: Find a Faker or Someone Violating the !rules Report Him/Her by Typin in Main Chat !report ",
"Help I've fallen and I...   ...hey nice carpet.",
"***Another Funny sentence HERE!",
"24 hours in a day ... 24 beers in a case ... coincidence?",
"Multitasking : Screwing up several things at once.",
"The reason talk is cheap is that supply exceeds demand.",
"Support bacteria - they're the only culture some people have.",
"BE ALERT! ...The world needs more lerts.",
"Shin: a device for finding furniture in the dark",
"Nothing is fool-proof to a sufficiently talented fool.",
"If ignorance is bliss, you must be orgasmic.",
"Stealth means never having to say you're sorry.",
"Send Mutor all your money"
}
--End User Settings----------------------------------------------------------------------------------
Title:
Post by: BoJlk on 17 September, 2004, 01:38:13
I'm Sorry to Post the entire Script again... :D

I wanted you to instruct me where do i add
The needed lines to be displayed...?

Quote--Echo 1.0
--by Mutor The Ugly
--Request by skandaluz
--
--Sends random messages to main after a specified number of users have logged in.
--
--User Settings-------------------------------------------------------------------------------------
Bot = "[Sentry]"      -- Rename to your main Px bot.
Mins = 2         -- Interval [in minutes] between usercounts before 'Logins' reached.
Pause = 5         -- Interval [in minutes] between usercounts after 'Logins' reached.
Logins = 10         -- Equal to or more than this number of connected users, bot shall speak.
CommOn = "+speak"      -- Start script and check usercount.
CommOff = "+hush"      -- Stop the script.
EchoOn = "1"      -- Start script on or off  ["1"=on "0"=off].
--
--
--What Should this bot say in main chat when enough users have logged in.
--
Echoes = {
"Tip of the Day: Find a Faker or Someone Violating the !rules Report Him/Her by Typin in Main Chat !report ",
"Help I've fallen and I...   ...hey nice carpet.",
"** i need to add here?.",
 Like this???
 "The Lua Language Board = http://board.univ-angers.fr..."
"24 hours in a day ... 24 beers in a case ... coincidence?",
"Multitasking : Screwing up several things at once.",
"The reason talk is cheap is that supply exceeds demand.",
"Support bacteria - they're the only culture some people have.",
"BE ALERT! ...The world needs more lerts.",
"Shin: a device for finding furniture in the dark",
"Nothing is fool-proof to a sufficiently talented fool.",
"If ignorance is bliss, you must be orgasmic.",
"Stealth means never having to say you're sorry.",
"Send Mutor all your money"
}
--End User Settings----------------------------------------------------------------------------------

function Main()
   SetTimer(Mins*60000)
   CheckCount()
end

function NewUserConnected(user, data)
   CheckCount()
end

function UserDisconnected(user, data)
   CheckCount()
end

OpConnected = NewUserConnected
OpDisconnected = UserDisconnected

function DataArrival(user, data)
   s,e,cmd = strfind(data, "%b<>%s+(%S+)(%S+)")
   if (cmd==CommOn) and user.bOperator then
      EchoOn = "1"
      user:SendData(Bot,"\r\n\r\n\t--<< [ Echo Started ] >>--   Timer Settings: Primary = "..Mins.." minutes. Pause = "..Pause.." minutes.\r\n\tType '"..CommOff.."' to stop script.\r\n\r\n")
      CheckCount()
   return 1
   elseif (cmd==CommOff) and user.bOperator then
      EchoOn = "0"  
      user:SendData(Bot,"\r\n\r\n\t--<< [ Echo Stopped ] >>--   Script has been stopped. Type '"..CommOn.."' to start script.\r\n\r\n")
      CheckCount()
   return 1
   end

end

function CheckCount()
if EchoOn ~= "1" then return 1 end
local UserCount = frmHub:GetUsersCount()
   if UserCount >= Logins then
      Enough = "yes"
      StartTimer()
   else
      Enough = ""
      SendToAll(Bot,"\r\n\r\n\tEcho paused, not enough users logged in.\r\n\tUser count will be checked again at next user login.   8-)\r\n\r\n")
      StopTimer()
   end
end

function OnTimer()
   echo = Echoes[random(1, getn(Echoes))]
      SendToAll(echo)
      StopTimer()
         if Enough == "yes" then
            SetTimer(Pause*60000)
         end
      CheckCount()
end
Title:
Post by: skandaluz on 17 September, 2004, 02:13:17
this message appears in the main chat to all i would like know if it has to be there and if so can it be looped back to the bot in a way that it does not disturb users or ops
i'm using the exact code above thnx

"Echo paused, not enough users logged in.
   User count will be checked again at next user login.   8-) "
Title:
Post by: Typhoon on 17 September, 2004, 09:05:10
about this line in the script ...

"The Lua Language Board = http://board.univ-angers.fr..."



you are missing the most IMPORTANT for it to work

a COMMA after each line  in the table  .... everything else wont work !
Title:
Post by: skandaluz on 18 September, 2004, 01:53:08
Not sure why but its not workin for me i still get the
 
 
 
   Echo paused, not enough users logged in.
   User count will be checked again at next user login. 8-)  
even when theres enough users online ... ive set the logins to 130 and there was 137 users still nothing 8/ not sure whats wrong
 heres the code i'm workin with




--Echo 1.0
--by Mutor The Ugly
--Request by skandaluz
--
--Sends random messages to main after a specified number of users have logged in.
--
--User Settings-------------------------------------------------------------------------------------
Bot = "?Robocop?"      -- Rename to your main Px bot.
Mins = 1         -- Interval [in minutes] between usercounts before 'Logins' reached.
Pause = 720         -- Interval [in minutes] between usercounts after 'Logins' reached.
Logins = 130         -- Equal to or more than this number of connected users, bot shall speak.
CommOn = "!speak"      -- Start script and check usercount.
CommOff = "!hush"      -- Stop the script.
EchoOn = "1"      -- Start script on or off  ["1"=on "0"=off].
--
--
--What Should this bot say in main chat when enough users have logged in.
--
Echoes = {
"Tip of the Day: Find a Faker or Someone Violating the !rules Report Him/Her by Typin in Main Chat !report ",
"Tip of the Day: Most Users Search with Too Many Words this is NOT a Very Efficient Search Method...Try Searching with only One or Two Words if Too Many Results Then Add Another Word.",
"Tip of the Day: This Hub is Growng Fast Eventualy We Will Reach Our User Limit and Unregisterd Users Will Not be able to get in if its Full...To Prevent this Type !regme in main Chat to Get an OP to Register U so u can come in Even if the Hub is Full",
"Tip of the Day: Hey Did You Know That by Typin !slots u can Find out Who Has Free Slots...SweeT!",
"Tip of the Day: Type !help to see a List of Commands Available to All",
"Tip of the Day: To See a List of All Other Excelent Hubs in our Network Type !network",
"Tip of the Day: Want Your Voice Heard? Go to http://www.hublist.org/?p=hub&id=80126 and Leave Your Comments/Suggestions",
"Shin: a device for finding furniture in the dark",
"Nothing is fool-proof to a sufficiently talented fool.",
"If ignorance is bliss, you must be orgasmic.",
"Stealth means never having to say you're sorry.",
"Send Mutor all your money"
}
--End User Settings----------------------------------------------------------------------------------

function Main()
   SetTimer(Mins*60000)
   CheckCount()
end

function NewUserConnected(user, data)
   CheckCount()
end

function UserDisconnected(user, data)
   CheckCount()
end

OpConnected = NewUserConnected
OpDisconnected = UserDisconnected

function DataArrival(user, data)
   s,e,cmd = strfind(data, "%b<>%s+(%S+)(%S+)")
   if (cmd==CommOn) and user.bOperator then
      EchoOn = "1"
      user:SendData(Bot,"\r\n\r\n\t--<< [ Echo Started ] >>--   Timer Settings: Primary = "..Mins.." minutes. Pause = "..Pause.." minutes.\r\n\tType '"..CommOff.."' to stop script.\r\n\r\n")
      CheckCount()
   return 1
   elseif (cmd==CommOff) and user.bOperator then
      EchoOn = "0"  
      user:SendData(Bot,"\r\n\r\n\t--<< [ Echo Stopped ] >>--   Script has been stopped. Type '"..CommOn.."' to start script.\r\n\r\n")
      CheckCount()
   return 1
   end

end

function CheckCount()
if EchoOn ~= "1" then return 1 end
local UserCount = frmHub:GetUsersCount()
   if UserCount >= Logins then
      Enough = "yes"
      StartTimer()
   else
      Enough = ""
      SendToAll(Bot,"\r\n\r\n\tEcho paused, not enough users logged in.\r\n\tUser count will be checked again at next user login. 8-)\r\n\r\n")
      StopTimer()
   end
end

function OnTimer()
   echo = Echoes[random(1, getn(Echoes))]
      SendToAll(echo)
      StopTimer()
         if Enough == "yes" then
            SetTimer(Pause*60000)
         end
      CheckCount()
end
Title:
Post by: skandaluz on 20 September, 2004, 18:26:12
Everything works Great :]  Now do u think it would be possible to add hub command to change Mins, Pause, Logins ex. - !ELogin    etc..
Title:
Post by: Snooze on 20 September, 2004, 20:03:03
off topic
"Send Mutor all your money" ROFL
Title:
Post by: skandaluz on 27 September, 2004, 23:22:29
i guess no in hub commands to be added here?  ?(
Title:
Post by: Boostland on 28 September, 2004, 22:21:46
Nice script seems to be working well now, I might put it on the rest of the Axis hubs.
Great for those quiet times when there is no chat going on.