Post
Topic
Board Gambling discussion
Re: Seuntjie' Dice bot programmers mode discussion.
by
HCP
on 29/04/2017, 02:01:31 UTC

You'll have to look this up.  But there is a way to create an array in LUA  it might be something like
betseq = {"Lo","Lo","Hi","Hi","Lo" etc......}
Yep, that is exactly how you create an "array" (in LUA they are "tables")...

And just a FYI, the convention in LUA is to index Arrays from 1... don't start counting at 0 like you would in C or Java etc Wink

hi guy!

i need to set chance from array like this:
chance =  {48,50,52,54}

and when win set chance random from the array

anyone help me?
Firstly, don't call your array "chance"... that is a built in variable that the bot uses to send the chance value to the dicesite Wink

Code:
chanceArray = {48,50,52,54}

if win then
  chance = chanceArray[math.random(#chanceArray)]
end

This will pick a "random" value from the chanceArray... the #chanceArray value is the number of items in the Array... so you can add more values or take some out and the code will still run without generating an "Index Out of Bounds" type error Wink