Post
Topic
Board Gambling discussion
Re: Seuntjie' Dice bot programmers mode discussion.
by
chilly2k
on 29/04/2017, 13:39:57 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

  Good to know, I program in so many languages it's tough to keep track.  I actually did start that table with an index of 1.  I reset the index to 0 because it will be incremented before checking it.  Call it dumb luck... Smiley 

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



  That's slick.  I didn't know about the #, I'll have to keep this in mind. 

Thanks for all of your tips and tricks...