what is the line that i need to write???
 

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

what is the line that i need to write???

Started by Psy-[A], 08 February, 2004, 21:18:39

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Psy-[A]

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?

kepp

What do you mean..??


that i just a timer
Guarding    

Psy-[A]

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

kepp

#3
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
Guarding    

Psy-[A]

no dude
my point is that i want the script to start on is own

kepp

as soon as you click 'Restart Scripts' it will run by it's own
Guarding    

Psy-[A]

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

kepp

#7
it is indeed hard for us to help you unless we can't see the code....
;)
Guarding    

Psy-[A]

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

plop

make the stop command start the timer and have the timer start the game.
thats all.

plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

Psy-[A]

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

NotRabidWombat

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


I like childish behavior. Maybe this post will be deleted next.

Psy-[A]

if i have more then one timer what shuld the name will be?

NotRabidWombat

You can not have more than one timer.

-NotRabidWombat


I like childish behavior. Maybe this post will be deleted next.

Psy-[A]

well 10x dude u helped me alot anyway

SMF spam blocked by CleanTalk