sensi1.5.lua
 

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

sensi1.5.lua

Started by Apache, 13 August, 2005, 13:55:54

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Apache

I need help whit sensi1.5.lua

I can?t lode It and get this:  [12:57] Syntax C:\Programmer\PtokaX\scripts\sensi1.5.lua:18: function arguments expected near `='

??
Or Is there a new on?  :))  This is the one i got !!

code:
-------------------
-- Thks to Ptaczek for his TrickerBot.lua, and many things else...
-- Thks to Skrollster, for the random synthax -- (http://lua.bcs-solutions.de/thread.php?t...2a4078fa73ba6be)
-- Thks to MatrixX for some help, too... -- (http://lua.bcs-solutions.de/thread.php?t...f4cc&page=2)
-- And thks to the others, for their help... ;o)
----------------------------------------------------------------
-- seNsi v1.5
-- Description:
-- Each 20 min, Bot is talking alone, with random questions...
-- If someone speaks again on main chat, there is a random answer, -- and then the timer is starting again.
-- If the user says a known trig (ex: 'hey '), and the bot was -- feeling alone, after 20min, Bot will choose the correct answer -- (ex:'Yessss,...[USER] happy to hear U again,, :))')
-- If the users is just sending some commands (#,!,?,+) the timer -- is not re starting, and the bot is not answering... ( i thought it -- was nicest like that... )
-- Now, no more the 'a' synthax,... (but I'm still quite nb in -- lua...)
-- If no one is speaking at 7:00 Am, seNsi will try to wake up the -- hub...and at 19:00 Pm, she'll probably ask for one drink... :D
----------------------------------------------------------------

Bot = "seNsi"
botname = "UrPmBot"

trigs = {
hey="how R U doing? [USER]",
bye="See ya [USER]",
["fine u"]="I am lame... ",
["+isakill"]="my comment here",
["need some"]="Hum... maybe pray for it...",
loool="Yeah, [USER] ! It was really funny...",
["take care"]="U 2... :o)"
}

idlequestions = {
"Y'a quelqu'un !? :(( ",
"Tout le monde dors ?!",
"All are sleeping ?!",
"Chuis toute seul :?(",
"Haaaaaaaaloooooooooo !!! ",
"Ben ayest j'V commencer ? tripper...",
"L'aur? voulu !!",
"Bin wieder daaaaaaaaa !! ",
"Don't leave me alone.... :'(",
"Ne Ne, das kenn ich nicht das hier nix los ist. HUHU !! "
}

idleanswers = {
"Aaaahh, dear [USER]... i was feeling quite alone.... :o)",
"Yessss,...[USER] happy to hear U again,, :))",
"Sorry to disturb u, [USER], but i was quite upset... :s ",
"Thks, [USER]... i thought something was wrong with ur keyboard...",
"Merci, [USER]... j'me sens moins seule, tout d1 coup... :))"
}

idlemorninganswers = {
"Wow... [USER]... ur night was certainly short.... :p",
"Yeahh !!! GOOOOOD MORNIIIIIIIIIING [USER] !",
"So, [USER],...coffee for me please, yep... :o)"
}

idlemorning = {
"Driiiiiiing... Time to Wake Uuuuuuuuuuup !! :D",
"GOOOOOD MORNIIIIIIIIIING HUBSTERRRRRRRRRRRRRS !!!!!!!",
"Hmm.....Someone is awake ??!!"
}

idleevening = {
"Time to have a drink, no ? :o)",
"Hum hum... place is really quiet, at this time... :'(",
"At this time, u shouldn't sleep... :-("
}

idleeveninganswers = {
"Well, at least... Some of urs are still alive,... cool :D",
"I was upset,... that's all... :(",
"It's time...If u offer me a drink... i couldn't say no.... :p"
}

sec = 1000
min = 60 * sec
hour = 60 * min

index = nil

function Main()
quiet = "false"
talk = "allow"
WaitingForAnswerAfterQuiet = "false"
WaitingForAnswerMorning = "false"
WaitingForAnswerEvening = "false"
SetTimer(20*min)
StartTimer()
frmHub:RegBot(botname)
end

function DataArrival(user, data)

-- Pm events --

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 (user.bOperator) then

if (cmd=="!quiet") then
quiet = "true"
talk = "notallow"
StopTimer()
user:SendPM(botname,"Ok,...I'll be quiet now... :s")
end

if (cmd=="!talk") then
talk = "allow"
quiet = "false"
WaitingForAnswerAfterQuiet = "false"
WaitingForAnswerMorning = "false"
WaitingForAnswerEvening = "false"
StartTimer()
user:SendPM(botname, "Ahh... So nice to hear that... :o)")
end
end
end
end

-- Main Chat events --

if( strsub(data, 1, 1) == "<" ) then
data=strsub(data,1,strlen(data)-1)

s,e,cmd = strfind( data, "%b<>%s+(%S+)" )
s,e,mess = strfind(data, "%b<> ([%w ]*)")

-- Trigs Answers --

for key, value in trigs do

-- Answer to mess command if bot is allowed to speak --

if mess or cmd and talk == "allow" then

-- Answer to the trig, with 1 trig response, if bot wasn't quiet since a while --

if WaitingForAnswerAfterQuiet == "false" then
if( strfind( strlower(mess), key) ) or ( strfind( strlower(cmd), key) ) then
answer, x = gsub(value, "%b[]", user.sName)
SendToAll(Bot, answer )
break
end
end
end

end

-- Restart the timer each time someone is talking on the main chat, if bot is allowed to talk --


if mess or cmd then
if talk == "allow" then

if iscommand(cmd) or iscommand(mess) then
else
StopTimer()
StartTimer()
end
end
end

-- Quiet the bot (ops command) --

if (cmd=="!quiet") then
if user.bOperator then
quiet = "true"
talk = "notallow"
SendToAll(Bot, "Ok,...I'll be quiet now... :s")
StopTimer()
else

-- Answer if a user try to use the command !quiet and if it is allowed to talk - then, check if the bot was quiet or not before --

if talk == "allow" and WaitingForAnswerAfterQuiet == "false" then
SendToAll(Bot, "hum...hum...")
end
end
end

-- Allow the bot to talk (ops command) --

if (cmd=="!talk") then
if user.bOperator then
talk = "allow"
quiet = "false"
WaitingForAnswerAfterQuiet = "false"
WaitingForAnswerMorning = "false"
WaitingForAnswerEvening = "false"
StartTimer()
SendToAll(Bot, "Ahh... So nice to hear that... :o)")
else

-- Answer if a user try to use the command !talk and if it is allowed to talk - then, check if the bot was quiet or not before --

if talk == "allow" and WaitingForAnswerAfterQuiet == "false" then
SendToAll(Bot, "hum...")
end
end
end

-- Receiving entries on the main chat --

if cmd or mess then
if talk == "allow" then

-- Morning Answer --
if WaitingForAnswerMorning == "true" then

-- Ignore the line commands begining with '+'/'!'/'#'/'?'. Bot won't replye - nicest, i think... :o) --

if iscommand(cmd) or iscommand(mess) then
else

-- Answer to chat entries --
index = random(1,getn(idlemorninganswers))
answer, x = gsub(idlemorninganswers[index], "%b[]", user.sName)
SendToAll(Bot, answer)
WaitingForAnswerAfterQuiet = "false"
WaitingForAnswerMorning = "false"
WaitingForAnswerEvening = "false"
end
end

-- Evening Answer --
if WaitingForAnswerEvening == "true" then

-- Ignore the line commands begining with '+'/'!'/'#'/'?'. Bot won't replye - nicest, i think... :o) --

if iscommand(cmd) or iscommand(mess) then
else

-- Answer to chat entries --
index = random(1,getn(idleeveninganswers))
answer, x = gsub(idleeveninganswers[index], "%b[]", user.sName)
SendToAll(Bot, answer)
WaitingForAnswerAfterQuiet = "false"
WaitingForAnswerMorning = "false"
WaitingForAnswerEvening = "false"
end
end

-- Answer after the bot was too quiet --

if WaitingForAnswerAfterQuiet == "true" then

-- Ignore the line commands begining with '+'/'!'/'#'/'?'. Bot won't replye - nicest, i think... :o) --

if iscommand(cmd) or iscommand(mess) then
else

-- Answer to chat entries --
index = random(1,getn(idleanswers))
answer, x = gsub(idleanswers[index], "%b[]", user.sName)
SendToAll(Bot, answer)
WaitingForAnswerAfterQuiet = "false"
WaitingForAnswerMorning = "false"
WaitingForAnswerEvening = "false"
end
end
end
end
end

end

function OnTimer()
time()
trig = "notdone"

-- Idle trigs, for the morning, and the evening :o) --

if H=="07" then
index = random(1,getn(idlemorning))
SendToAll(Bot, idlemorning[index])
WaitingForAnswerAfterQuiet = "false"
WaitingForAnswerMorning = "true"
WaitingForAnswerEvening = "false"
StartTimer()
trig = "done"
end

if H=="19" then
index = random(1,getn(idleevening))
SendToAll(Bot, idleevening[index])
WaitingForAnswerAfterQuiet = "false"
WaitingForAnswerMorning = "false"
WaitingForAnswerEvening = "true"
StartTimer()
trig = "done"
end

-- Others idle trigs --

if trig == "notdone" then
index = random(1,getn(idlequestions))
SendToAll(Bot, idlequestions[index])
WaitingForAnswerAfterQuiet = "true"
end
end

-- Get Time --

function time()
S = date("%S")
H = date("%H")
M = date("%M")
D = date("%d")
MM = date("%m")
Y = date("%y")
return H
end

function iscommand(str)
return strsub(str, 1, 1) == "!" or strsub(str, 1, 1) == "?" or strsub(str, 1, 1) == "+" or strsub(str, 1, 1) == "#"
end
Do something ----------> Anything---------->Any minute now...

Jelf

1. The script you posted is in Lua4 not Lua5

2. A quick search would have shown you this..

SMF spam blocked by CleanTalk