Hello Guest

Reset Script

  • 2 Replies
  • 242 Views
*

Jessjxx19

  • *
  • 1
  • +0/-0
    • View Profile
Reset Script
« on: June 24, 2020, 11:44:27 am »
Hello! I am currently building a script but i need some help.
I want to include a function that stops my script and start it again ( like a reset ) at line 28

if (!win) then
   losecount += 1
   if losecount >= 5 then
       -- I NEED A RESET FUNCTION HERE
   end
into this script :

Code: [Select]
chnc           = 75
chance         = chnc
basebet        = 1
nextbet        = basebet
bethigh        = true
losecount      = 0
enablesrc      = true
rnd            = 0
resetseedonbet = 2000
stoponwin      = 10
function dobet()
rnd += 1
if profit > stoponwin then
    stop()
end
    if (win) then
        if rnd > resetseedonbet then
        rnd = 0
        resetseed()
        end
    chance = chnc
   nextbet = basebet
   losecount = 0
end
if (!win) then
   losecount += 1
   if losecount >= 5 then
       -- I NEED A RESET FUNCTION HERE
   end
   if (losecount > 1) then
      nextbet = previousbet*2
   chance = (1/(((nextbet+(nextbet-basebet))/nextbet)))*100
   if chance < 49.5 then
   chance = 49.5 end
   bethigh = !bethigh
      print ("LOSE")
   print(nextbet)
   print(chance)
   print(profit)
   print(bets)
   else
      nextbet = previousbet*2
   chance = (1/(((basebet+nextbet))/nextbet))*100
      if chance<49.5 then
   chance=49.5 end
   bethigh = !bethigh
   print ("LOSE")
   print(nextbet)
   print(chance)
   print(profit)
   print(bets)
end
end
end

Thanks for your help!

*

Seuntjie

  • *****
  • 496
  • +14/-2
    • View Profile
Re: Reset Script
« Reply #1 on: June 24, 2020, 02:08:59 pm »
To reset a script, you need to reset your own variables. You can do that by just setting them to their original values or using a function to do it.

I made a tutorial about a resumable script but you can use the initialize function to reset if you implement it correctly: https://forum.seuntjie.com/index.php?topic=2.msg2195#msg2195

*

svenjatzu

  • *
  • 3
  • +0/-0
    • View Profile
Re: Reset Script
« Reply #2 on: June 26, 2020, 03:54:37 pm »
is it also possible to add a sleeptimer like wait 30-60 sec before reset the script?