what is the line that i need to wirte in the main function that will do a loop in the script every time that i chosse
function main()
SetTimer(2hours)
StartTimer()
end
???????
is this one?
What do you mean..??
that i just a timer
i want the script to do a loop every time that i chosse but without the command
the script shuld do it by it salf
like a self timer
well, i don't understand what you mean by looping through your code ... ?
function Main()
SetTimer(10000)
StartTimer() --Trigger the timer in any function
end
function OnTimer()
SendToAll("Bla bla")
StopTimer()
end
no dude
my point is that i want the script to start on is own
as soon as you click 'Restart Scripts' it will run by it's own
ok just a sec
take exemple of trivia
i will restart the program and then someone will be need to start it .
i want it to start by is own
ok? every 2 hours
it is indeed hard for us to help you unless we can't see the code....
;)
the basic trivia 2.2
BotName = "TriviaBot"
ScriptVersion = "v2.2"
BotVersion = BotName.." "..ScriptVersion
-- This file is not needed it will be created if it not exists
strTrivScoreFile = "TriviaScores.dat"
-- This file is needed unless you want to run a Trivia with only two questions ;)
strDefTrivFile = "trivia.dat"
strTrivFile = strDefTrivFile
strQFile = "Questions.dat"
-- This char will be the global separator? (Make it one that is not used in nicknames nor questions ;)
strGSep = "*"
-- This char is used to mask the unrevealed chars
strCMask = "@"
-- Default startup mode of Trivia!
lngDefMode = 0 -- (0 = game is played in chat!, 1 = game is played in chat but questions only show for players, 2 = game is played in pm with players)
lngMode = lngDefMode
-- Max number of questions to show when a Operator ask to see list Questions 0 = 0, -1 = Disabled
lngMaxShowList = 5
-- Max no of Hints per word, and always hit on a hidden char
lngMaxHints = 4
boolHintAlwaysHitHidden = nil -- (nil = off, 1 = on)
-- How much time before a question end. Time in Trivia is measured in 15 seconds, 1 = 15 seconds, 2 = 30 seconds etc!
-- Rest is how long to rest after a question is solved depening on when the word is solved in the Timer loop it is ?15 secs to the setting!
lngMaxTime = 8 -- (Needs to be a multiple of 4 i.e. 4 / 8 / 12 / 16)
lngRestTime = 2
lngHintTime = lngMaxTime / 4
-- How often should the bot autosave the scores
boolAutoSaveScores = 1 -- (nil = off, 1 = on)
countSaveTurns = 10 -- After how many questions should the scores be saved
-- Should bot reveal the correct answer once time is up?
boolRevealAnswer = 1 -- (nil = off, 1 = on)
-- Should the bot display what guess made the word become a little clearer if played in PM!
boolShowGuessesInPM = 1 -- (nil = off, 1 = on)
-- Should the bot Auto Reveal Hints?
boolAutoHint = 1 -- (nil = off, 1 = on)
-- Should the bot auto login every user on connect ?
boolAutoLogin = nil -- (nil = off, 1 = on)
-- Do you want users to be able to add questions ? Operators can always add questions.
boolAddQuestion = 1 -- (nil = No, 1 = Yes)
-- TriggStart is what char the commands should begin with I use ! but you can use # or whatever
TriggStart = ""
-- Theese are the different triggers I've tried to name them so that one easily understand what they do!
-- I include TriggStart and then the word within "" this word is not casesensitive!
JoinTrigg = TriggStart.."tbjoin"
PartTrigg = TriggStart.."tbpart"
StartTrigg = TriggStart.."tbstart"
StopTrigg = TriggStart.."tbstop"
WordTrigg = TriggStart.."tbword"
QuizTrigg = TriggStart.."tbquestion"
RestartTrigg = TriggStart.."tbrestart"
PointTrigg = TriggStart.."tbpoints"
ScoreTrigg = TriggStart.."tbscores"
PlayerTrigg = TriggStart.."tbplayers"
QuestionsTrigg = TriggStart.."tbquestions"
ReloadTrigg = TriggStart.."tbreload"
HelpTrigg = TriggStart.."tbhelp"
ExtraHelpTrigg = TriggStart.."tbhelp+"
SaveTrigg = TriggStart.."tbsavescores"
LoadTrigg = TriggStart.."tbloadscores"
ModeTrigg = TriggStart.."tbmode"
HintTrigg = TriggStart.."tbhintme"
TopTrigg = TriggStart.."tbtopten"
AddTrigg = TriggStart.."tbaddquestion"
bcount = 0
scount = 0
sQuestion = ""
sAnswer = ""
guessArray = {}
lngGuessmax = 0
playerArray = {}
pointArray = {}
lngWord = 0
lngPassed = 0
lngHinted = 0
strWord = ""
strQuestion = ""
strSolved = ""
strBanner = "Type '"..StartTrigg.."' to start Trivia, '"..StopTrigg.."' to stop Trivia, type '"..JoinTrigg.."' to Join and '"..PartTrigg.."' to Part!"
strStart = "TriviaBot "..ScriptVersion.." started! "..strBanner
strStopp = "TriviaBot "..ScriptVersion.." stopped! "..strBanner
function Main()
frmHub:RegBot(BotName)
ReloadQuestions()
setlocale("swe")
LoadScores()
end
function NewUserConnected(curUser)
if (boolAutoLogin) then
if (not (playerArray[curUser.sName])) then
playerArray[curUser.sName] = 1
else
playerArray[curUser.sName] = nil
end
end
end
function OpConnected(curUser)
if (boolAutoLogin) then
if (not (playerArray[curUser.sName])) then
playerArray[curUser.sName] = 1
else
playerArray[curUser.sName] = nil
end
end
end
function UserDisconnected(curUser)
playerArray[curUser.sName] = nil
end
function OpDisconnected(curUser)
playerArray[curUser.sName] = nil
end
function DataArrival(curUser, data)
local boolPlaydata = nil
if (strsub(data, 1, 1) == "<") then
data = strsub(data, 1, (strlen(data) - 1))
if ((lngMode == 0) or (lngMode == 1)) then
boolPlaydata = 1
end
elseif (strsub(data, 1, 4) == "$To:") then
data = strsub(data, 1, (strlen(data) - 1))
local _, _, whoTo = strfind(data,"$To:%s+(%S+)")
if (whoTo == BotName) then
data = strsub(data, (15 + strlen(BotName) + strlen(curUser.sName)))
if (lngMode == 2) then
boolPlaydata = 1
local _, _, chat = strfind(data, "%b<>%s(.+)")
SendChatToOthers(chat, curUser)
end
end
end
local _, _, firstWord = strfind(data, "%b<>%s+(%S+)")
just tell me where did u change it plz chosse i want to know
sorry for the english again
make the stop command start the timer and have the timer start the game.
thats all.
plop
if i knaw how to set the timer i won't ask but i don't know sorry :(
if u can tell me how it will be wonderfull
i need only the basic command
1. how to set the timer for (sec/min/hour)
2. how to set the timer to be on
3. how to set the start triger by the timer
10x for everything dude
1) SetTimer(milliseconds)
If you want to set seconds it is:
SetTimer(seconds * 1000)
Minutes:
SetTimer(minutes * 60000)
etc....
2) StartTimer()
StopTimer() will set the timer to be off
3) function OnTimer() ... end
Make this function global and it will be called at the increment you specified in SetTimer after you call StartTimer.
-NotRabidWombat
if i have more then one timer what shuld the name will be?
You can not have more than one timer.
-NotRabidWombat
well 10x dude u helped me alot anyway