Hello Guest

*SOLVED* I'm Lost, Need Help Converting From Old DiceBot to KryGamesBot

  • 4 Replies
  • 298 Views
*

Jebula999

  • **
  • 5
  • +1/-0
    • View Profile
Hey guys,

So i spent around a year or two self learning how to write scripts in LUA for the original DiceBot, and i got quite good at it (I think)

I just saw today that the new KryGamesBot was available, but now for the life of me i cannot wrap my head around the new method/language of writing scripts.

I have a 91 line scrip, which is my pride and joy, and i am trying to understand how to convert it to the new system, but my knowledge of how functions work and how the format is used is really hindering me.


Is there anyone willing to help me understand the new system, and to hopefully in the process change my script to the new system.
After writing hundreds of scripts, i am afraid my mind is too set on the format it is used to.

I do not simply want someone to convert/retype it to the new format, i would like to understand it so that i can continue writing scripts using the new bot in future.

Thanks in advance.
« Last Edit: June 19, 2020, 09:30:19 am by Jebula999 »

*

Seuntjie

  • *****
  • 498
  • +14/-2
    • View Profile
Re: I'm Lost, Need Help Converting From Old DiceBot to KryGamesBot
« Reply #1 on: June 18, 2020, 11:12:20 pm »
An important note here is that KryGamesBot is still in ALPHA, it's not been officially launched, it's just available for testing. as such, there's still a lot of features missing and a lot of thing doesn't work properly or hasn't been tested thoroughly yet. Use at your own risk even more than usual. Also, once it does actually launch , there will be more material available to help understand the new API to guide you in converting your script.

Now to your question. The language didn't change, it's still LUA, just a newer version of it. The format of the script didn't change by much and the process of the script is still the same. You click start, the script is loaded,your initial bet is received from the script, a bet is placed and after every bet, the dodicebet function is called.

There's only 1 thing that's changed that really needs a mind shift, the rest of the stuff just moved around or got renamed.

The thing that changed is the inclusion of the ResetDice function. This function is called in between loading the script and placing the first bet and it dictates what your first bet should be using the parameters (it's also called when a reset condition is met, but we'll talk about that when you're more comfortable with the new programmer mode). So instead of setting the nextbet, chance and bethigh variables at the top of your script, you set NextBet.Amount, NextBet.Chance and NextBet.High inside of the ResetDice function.

Now for the rest of the stuff that moved around:
inside DoDiceBet you have 3 parameters, PreviousBet (which is akin to the lastBet object from DiceBot), Win (which is the same as win in DiceBot) and NextBet (Which is a combination of nextbet, chance and bethigh into 1 object). In addition to these parameters, there's some variables available to you: Stats (this contains all stats in the Session Stats window), SiteDetails (contains the site name, available currencies, house edge etc), SiteStats (Contains the stats user stats window) and Balance.

To put it simply:
Instead of nextbet, use NextBet.Amount
Instead of chance, use NextBet.Chance
instead of bethigh, use NextBet.High
instead of wins, use Stats.Wins
instead of currentstreak, use Stats.CurrentStreak
instead of profit, use Stats.Profit
instead of previousbet, use PreviousBet.TotalAmount
instead of currentprofit, use PreviousBet.Profit

Here's the sample/template that's included with the bot to illustrate how little has changed. It's just a basic martingale
Code: [Select]
base = 0.00000001
function DoDiceBet(PreviousBet, Win, NextBet)
if Win then
NextBet.Amount=base -- In v3, this would just be nextbet=base
NextBet.High=NextBet.High
else
NextBet.Amount=PreviousBet.TotalAmount*2 -- in v3, this would be nextbet=previousbet*2
end
end

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

Be sure to read through the "DiceBot Programmer mode.docx" file and the ReadMe.txt file included with KryGamesBot, it has an explanation of how the new system works, the available variables and what properties each one has available.

If you have more specific questions than "I'm lost", I'd probably be happy to answer them. The more specific, the better. And including code samples where possible also helps.
« Last Edit: June 18, 2020, 11:14:26 pm by Seuntjie »

*

Jebula999

  • **
  • 5
  • +1/-0
    • View Profile
Re: I'm Lost, Need Help Converting From Old DiceBot to KryGamesBot
« Reply #2 on: June 19, 2020, 12:18:48 am »
Thanks @Seuntjie for the detailed response.

After a lot of back and forth through the forum and the tutorials/sample files i have managed to completely migrate my scrip to the updated format.

It did seem daunting at first, as if i was looking at a new language, but i see it's just more detailed than before. Or as they say "Same same, but different" xD

I would love to have been more specific than "I'm lost"... but at that moment i truly was lost, i had no idea where to begin or how to more accurately describe what part was confusing, because it all was.


There is one issue i am having, and without starting a new thread i will ask it here:
During my troubleshooting, i was trying to print to console like you could in DiceBot, to try pinpoint where something was going wrong. But no matter the format or method, i could not get it to print.
Here are some examples i used:
Code: [Select]
print(a)
print("a")
print('a')


I know previously you could type
Code: [Select]
print("Balance: "..balance)But when trying this, in console and in script, nothing shows up. Am i doing it completely wrong, or is it not fully implemented yet? Maybe i'm even missing where it's printing to?
I even tried what you showed in a tutorial below, but was unsuccessful.
Code: [Select]
function prettyprint(bal, profit, bets, wins)
  if bets%1000==0 then --every 1000 bets
    print('Your Balance:'.bal)
    print('You\'ve made '.profit.' Profit so far')
    print('You\'ve made a total of '.bets.' bets')
    print('Of which you have won '.wins)
    print('And have lost '.(bets-wins))
  end
end

*

Seuntjie

  • *****
  • 498
  • +14/-2
    • View Profile
Re: I'm Lost, Need Help Converting From Old DiceBot to KryGamesBot
« Reply #3 on: June 19, 2020, 07:51:34 am »
Try using Print

*

Jebula999

  • **
  • 5
  • +1/-0
    • View Profile
Re: I'm Lost, Need Help Converting From Old DiceBot to KryGamesBot
« Reply #4 on: June 19, 2020, 08:13:49 am »