|
sharhazad Newbie
Joined: 27 Aug 2015 Posts: 2
|
Posted: Thu Aug 27, 2015 6:52 am
suggestions for a macro in cmud |
Ok i need a hand at coding a shuffling program in cmud as a macro or button
I need to take 66 cards get a random card number then put that card in the deck . Then i need to do this another 65 times each time the max number gets 1 less till it is 0
so im thinking that it would look something like
random number 1-66
put random card # in deck
max number =number -1
return
or something like that
anyone have any ideas
Sharhazad |
|
|
|
shalimar GURU
Joined: 04 Aug 2002 Posts: 4715 Location: Pensacola, FL, USA
|
Posted: Thu Aug 27, 2015 7:36 am |
best way for that would be a string list
#ALIAS shuffleCards {cards="Ace of Hearts|Two of Hearts|etc|etc"}
#ALIAS randomCard {
$num=%random(1, %numitems(@cards))
$thisCard=%item(@cards, $num)
#DELITEM cards $thisCard
#SAY {You drew $thisCard}
}
This allows you to only pick of the remaining cards left in the deck until you reshuffle.
Then your button or macro can just call the aliases. |
|
_________________ Discord: Shalimarwildcat |
|
|
|
sharhazad Newbie
Joined: 27 Aug 2015 Posts: 2
|
Posted: Fri Aug 28, 2015 6:35 am |
shalimar wrote: |
best way for that would be a string list
#ALIAS shuffleCards {cards="Ace of Hearts|Two of Hearts|etc|etc"}
#ALIAS randomCard {
$num=%random(1, %numitems(@cards))
$thisCard=%item(@cards, $num)
#DELITEM cards $thisCard
#SAY {You drew $thisCard}
}
This allows you to only pick of the remaining cards left in the deck until you reshuffle.
Then your button or macro can just call the aliases. |
ok i really appreciate your help , but im sure i just didnt explain myself well. all i need is to pick a random number between 1 66 then put that number card into a container.
tehn i need to make the random one less. Continue until it has gone through this step 66 times, then all cards will be in the container ready to be drawn
sharhazad |
|
|
|
shalimar GURU
Joined: 04 Aug 2002 Posts: 4715 Location: Pensacola, FL, USA
|
Posted: Sat Aug 29, 2015 7:53 am |
$numCards=66
#WHILE $numCards {$num=%random(1, $numCards);put card $num in container;$numCards=($numCards-1)} |
|
_________________ Discord: Shalimarwildcat |
|
|
|
|
|