Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
sharhazad
Newbie


Joined: 27 Aug 2015
Posts: 2

PostPosted: 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
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4662
Location: Pensacola, FL, USA

PostPosted: 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
Reply with quote
sharhazad
Newbie


Joined: 27 Aug 2015
Posts: 2

PostPosted: 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
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4662
Location: Pensacola, FL, USA

PostPosted: 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
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net