Hello All,
I a working on a Baccarat Training Tool that put old shoes in and allows the person to do one hand at time to play the next hand. I already figured out how to populate it all at once using "Repeat with" statements but I need to put one at a time in and press the button each time to put the next "Dot" in place.
here is the code for the "show complete shoe" and it works perfect. Is there a way to to have the repeat with statements wait for a button press each time or how would i do this one by one. The button sets all the variables and clears the grid as well. Just want to hit it each time and have a dot appear in the right spot. This way the user can see just one hand at a time like playing in a casino.
Thanks again so much. This is the last step and its done except to make it look pretty..lol
Mike
-- Show complete shoe
Put "1" into ShoeColumn
Put "1" into shoeLine
put " " into field "BacCard"
Set the itemDel to space
put "0" into tNoHands
put "0" into tNoBankers
put "0" into tNoPlayers
--set P or B start of Game
put char 1 of fld "ShoeInfoFromList2" into PBstart
delete char 1 of fld"ShoeInfoFromList2"
delete char 1 of fld"ShoeInfoFromList2"
--how many colums are to populate
put the number of items of fld "ShoeInfoFromList2" into tmpcolums
repeat with col = 1 to tmpcolums
Set the itemDel to space
Put item col of fld "ShoeInfoFromList2" into tmpcolums2
repeat with lin = 1 to tmpcolums2
Set the itemDel to tab
put tNoHands +1 into tNoHands
--swith between colors
if PBstart = "B" then
put "1141" into PBColor
put tNoBankers +1 into tNoBankers
else if PBstart = "P" then
put "1142" into PBColor
put tNoPlayers +1 into tNoPlayers
end if
put "1" into of char 1 of item col of line lin of field "BacCard"
set the imagesource of char 1 of item col of line lin of field "BacCard" to PBColor
end repeat
--switch color
if PBstart ="B" then
Put "P" into PBstart
else if PBstart ="P" then
Put "B" into PBstart
end if
end repeat
--populate stats
Put tNoHands into fld "NoHands"
put tNoBankers into fld"NoBankers"
Put tNoPlayers into fld"NoPlayers"
How to Press button to just add one thing?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
-
- Livecode Opensource Backer
- Posts: 46
- Joined: Fri Aug 02, 2013 12:14 am
Re: How to Press button to just add one thing?
I'm no Klaus, but can't you just use the "repeat" sections in an "on mousedown" section? And keep track of columns using a variable?
I am not sure exactly what is going on with the code per se... I'd be better if I had a stack rather than an image... but if the repeat is doing something, then returning to the top of the repeat, and continuing until a point, it would make sense to do a mousedown command, with an if statement to check the number of columns so you don't go too far.
which should only do stuff if: a) a mousedown is detected and b) the number of columns is under a certain amount, effectively allowing it to "repeat" a function until a certain point is reached.
Again... I'm no Klaus...
BB
XdM
I am not sure exactly what is going on with the code per se... I'd be better if I had a stack rather than an image... but if the repeat is doing something, then returning to the top of the repeat, and continuing until a point, it would make sense to do a mousedown command, with an if statement to check the number of columns so you don't go too far.
Code: Select all
on mousedown
if -- the number of columns-- < tmpcolumns then
--do stuff--
else
exit mousedown
end mousedown
Again... I'm no Klaus...
BB
XdM
-
- Livecode Opensource Backer
- Posts: 46
- Joined: Fri Aug 02, 2013 12:14 am
Re: How to Press button to just add one thing?
Hey Guys
Sorry for the late reply. I got the project done and its amazing. It maybe a tool to sell. I did not know Baccarat was as big as it is.
Thanks again to all of you for your help.
Mike
Sorry for the late reply. I got the project done and its amazing. It maybe a tool to sell. I did not know Baccarat was as big as it is.
Thanks again to all of you for your help.
Mike
Re: How to Press button to just add one thing?
Congrats Mike