Hello Guest

Lua converter Dicebot V3 to Dicebot V4

  • 6 Replies
  • 296 Views
*

PMG

  • **
  • 69
  • +0/-0
    • View Profile
Lua converter Dicebot V3 to Dicebot V4
« on: May 15, 2020, 02:27:24 pm »
Hello i tried to create a notepad ++ macro  to help convert lua scripts of dicebot V3  to lua scritpts of dicebot V4. This is a first version, there may be errors and omissions do not hesitate to test and report any problems (telegram = @pmNofirg ant discord = pmNofirg#1916 ).

NotePad++ Download: https://notepad-plus-plus.org/downloads/

Tutorial:

1)- Download macro file: https://mega.nz/file/WD4E2QiJ#-coJhn7cjkfm1hSkSA8SPUSCHR5PZONS2bNBfh4wots

2)- Go to : %USERPROFILE%\Appdata\Roaming\Notepad++ and open this file:


3) copy paste contents of the file "DicebotV3toV4LuaConverter-BetaVersion-2.xml" into shortcuts.xml, here:


4) Run macro


video tutorial:


Tell me if it helped you, and if you don't understand something.
« Last Edit: May 15, 2020, 06:45:37 pm by PMG »



*

PMG

  • **
  • 69
  • +0/-0
    • View Profile
Re: Lua converter Dicebot V3 to Dicebot V4
« Reply #3 on: May 16, 2020, 12:33:52 pm »
Be carefful. check if you use variables out of scope, converter can't fix these issues.

For instance this following code can't works, calling function randomRoll(7,98) causes a problem.
its problem is that code is trying to use a variable out of scope. Since PreviousBet is now a parameter to the DoDiceBet function, it is only available inside of it.

Code: [Select]
base = 0.00000001

function DoDiceBet(PreviousBet, Win, NextBet)
    NextBet.Chance = randomRoll(7,98)
end

function ResetDice(NextBet)
    NextBet.Amount=base
    NextBet.Chance=49.5
    NextBet.High=true
end

function randomRoll(MIN,MAX)
    return( MIN + ((MAX-MIN)*((PreviousBet.Roll)/100)) )
end

Solution is either pass the whole object along as a parameter for randomRoll or just pass the roll along.
Code: [Select]
randomRoll(MIN,MAX,ROLL) return (MIN+((MAX-MIN)*((ROLL)/100.0))) end
New code:
Code: [Select]
base = 0.00000001

function DoDiceBet(PreviousBet, Win, NextBet)
    NextBet.Chance = randomRoll(7,98,PreviousBet.Roll)
end

function ResetDice(NextBet)
    NextBet.Amount=base
    NextBet.Chance=49.5
    NextBet.High=true
end

function randomRoll(MIN,MAX,ROLL)
    return( MIN + ((MAX-MIN)*((ROLL)/100)) )
end

« Last Edit: May 16, 2020, 12:38:07 pm by PMG »

*

PMG

  • **
  • 69
  • +0/-0
    • View Profile
Re: Lua converter Dicebot V3 to Dicebot V4
« Reply #4 on: May 16, 2020, 01:24:19 pm »
Update v5
https://mega.nz/file/DLwT2QIA#GYW7RYj0jmaAYx7kBbp7xuqSU_Z-XD_E-LXjM0jMWnU

currency = "btc"  < makes a mark and converts to > => SetCurrency(string NewCurrency) -- or use PreviousBet.Currency to read only :=>  = "btc"

newCurrency  = currencies[2] < converts to > => newCurrency  = SiteDetails.Currencies[2]
« Last Edit: May 16, 2020, 01:28:11 pm by PMG »

*

PMG

  • **
  • 69
  • +0/-0
    • View Profile
Re: Lua converter Dicebot V3 to Dicebot V4
« Reply #5 on: May 16, 2020, 09:42:45 pm »
Update V6
https://mega.nz/file/fSolFLDT#TjKsZOblbe61xTvejMnWQ1Bfm5c4WPQzvWG2OiZ4110

feature added: Moves all variables and functions into ResetDice() function, with the exception of dobet function


« Last Edit: May 17, 2020, 08:39:35 am by PMG »

*

Seuntjie

  • *****
  • 481
  • +13/-2
    • View Profile
Re: Lua converter Dicebot V3 to Dicebot V4
« Reply #6 on: May 17, 2020, 07:53:16 am »
You cannot define a function inside of another function.