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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
DeathDealer
Adept


Joined: 20 Jul 2004
Posts: 268

PostPosted: Mon Mar 14, 2005 5:40 pm   

%random & #send **SOLVED**
 
I'm looking for output in this format for occasional notes:
Code:
A              B              C
1              5              9
2              6              10
3              7              11
4              8              12
Except that the #'s should be random for thier column.
Using this topic http://forums.zuggsoft.com/phpbb/viewtopic.php?t=16205&highlight=random I've been able to come up with this:
Code:
#CLASS {Shuffle}
#ALIAS Shuffle {
  #SEND "A              B              C"
  #4 {
    #VAR A_Index %random( 1, %numitems( @A))
    #VAR A_Shuffle %item( @A, @A_Index)
    #DELN A @A_Index
    #VAR B_Index %random( 1, %numitems( @B))
    #VAR B_Shuffle %item( @B, @B_Index)
    #DELN B @B_Index
    #VAR C_Index %random( 1, %numitems( @C))
    #VAR C_Shuffle %item( C, C_Index)
    #DELN C @C_Index
    #send "@A_Shuffle              @B_Shuffle              @C_Shuffle"
    }
  #reset Shuffle
  }
#VAR A {1|2|3|4} {1|2|3|4}
#VAR B {5|6|7|8} {5|6|7|8}
#VAR C {9|10|11|12} {9|10|11|12}
#CLASS 0
But for some reason the #sending of the shuffled info only gives me the output of
Code:
@A_Shuffle              @B_Shuffle              @C_Shuffle
@A_Shuffle              @B_Shuffle              @C_Shuffle
@A_Shuffle              @B_Shuffle              @C_Shuffle
@A_Shuffle              @B_Shuffle              @C_Shuffle
I tried to put each of them in <>'s and I would only get the same # in each column:
Code:
1              5              9
1              5              9
1              5              9
1              5              9
Not sure what I am missing.
_________________


Last edited by DeathDealer on Fri Apr 01, 2005 8:06 pm; edited 1 time in total
Reply with quote
Dharkael
Enchanter


Joined: 05 Mar 2003
Posts: 593
Location: Canada

PostPosted: Mon Mar 14, 2005 5:51 pm   
 
2 things
the line
Code:
#VAR C_Shuffle %item( C, C_Index)

should be replaced with
Code:
#VAR C_Shuffle %item(@C, @C_Index)

and this line
Code:
#send "@A_Shuffle              @B_Shuffle              @C_Shuffle"

replaced with this one
Code:
#send %expand( "@A_Shuffle              @B_Shuffle              @C_Shuffle")
_________________
-Dharkael-
"No matter how subtle the wizard, a knife between the shoulder blades will seriously cramp his style."
Reply with quote
DeathDealer
Adept


Joined: 20 Jul 2004
Posts: 268

PostPosted: Mon Mar 14, 2005 6:00 pm   
 
The C, C_Index/@C, @C_Index was my typo.
The %eval() is my stupidity :-)
Thanks!
_________________
Reply with quote
Dharkael
Enchanter


Joined: 05 Mar 2003
Posts: 593
Location: Canada

PostPosted: Mon Mar 14, 2005 6:03 pm   
 
%eval or %expand I had edited my post above and changed to %expand most likely after you had seen it Smile
_________________
-Dharkael-
"No matter how subtle the wizard, a knife between the shoulder blades will seriously cramp his style."
Reply with quote
DeathDealer
Adept


Joined: 20 Jul 2004
Posts: 268

PostPosted: Mon Mar 14, 2005 6:37 pm   
 
2 questions
1) Does it make a diff if it's %eval or %expand? %eval is working so is there a reason that %expand should be used instead?
2) How would I store each value and set it so that the same value is not in the same place the next time it's run? like 3 wont be in the 2nd spot twice in a row. I would go even more in depth and ask how about if it was never in the same spot 3 times if it were possible.
_________________
Reply with quote
Vitae
Enchanter


Joined: 17 Jun 2005
Posts: 673
Location: New York

PostPosted: Tue Sep 13, 2005 5:08 pm   
 
Well, got an updated question with regards to this.
Something that I had been meaning to ask and never got around to.
Code:
#CLASS {PortalShuffle}
#ALIAS Shuffle {
  #RESET "portalshuffle"
  bo personal
  note write Vitae
  Maze Portal Switches
  #SEND "~@CRoom Vnum: A           Room Vnum: B           Room Vnum: C"
  #SEND "~@GPortal reset order     Portal reset order     Portal reset order~@M"
  #4 {
    #VARIABLE A_Index %random( 1, %numitems( @A))
    #VARIABLE A_Shuffle %item( @A, @A_Index)
    #DELNITEM A @A_Index
    #VARIABLE B_Index %random( 1, %numitems( @B))
    #VARIABLE B_Shuffle %item( @B, @B_Index)
    #DELNITEM B @B_Index
    #VARIABLE C_Index %random( 1, %numitems( @C))
    #VARIABLE C_Shuffle %item( @C, @C_Index)
    #DELNITEM C @C_Index
    #SEND %eval( "@A_Shuffle                      @B_Shuffle                      @C_Shuffle")
    }
  #SEND ~@w
  #SEND "~@CRoom Vnum: D           Room Vnum: E           Room Vnum: F"
  #SEND "~@GPortal reset order     Portal reset order     Portal reset order~@M"
  #4 {
    #VARIABLE D_Index %random( 1, %numitems( @D))
    #VARIABLE D_Shuffle %item( @D, @D_Index)
    #DELNITEM D @D_Index
    #VARIABLE E_Index %random( 1, %numitems( @E))
    #VARIABLE E_Shuffle %item( @E, @E_Index)
    #DELNITEM E @E_Index
    #VARIABLE F_Index %random( 1, %numitems( @F))
    #VARIABLE F_Shuffle %item( @F, @F_Index)
    #DELNITEM F @F_Index
    #SEND %eval( "@D_Shuffle                      @E_Shuffle                      @F_Shuffle")
    }
  #SEND ~@w
  #SEND Thank you.
  #SEND end
  #SEND p
  }
#VARIABLE A {1|2|3|4} {1|2|3|4}
#VARIABLE B {3|1|5|4} {3|1|5|4}
#VARIABLE C {1|6|3|4} {1|6|3|4}
#VARIABLE D {2|1|3|4} {2|1|3|4}
#VARIABLE E {4|2|3|1} {4|2|3|1}
#VARIABLE F {3|1|7|4} {3|1|7|4}
#VARIABLE A_Index {1}
#VARIABLE A_Shuffle {3}
#VARIABLE B_Index {1}
#VARIABLE B_Shuffle {1}
#VARIABLE C_Index {1}
#VARIABLE C_Shuffle {4}
#VARIABLE D_Index {1}
#VARIABLE D_Shuffle {4}
#VARIABLE E_Index {1}
#VARIABLE E_Shuffle {4}
#VARIABLE F_Index {1}
#VARIABLE F_Shuffle {7}
#CLASS 0
OutPut:
Code:
Room Vnum: A           Room Vnum: B           Room Vnum: C
Portal reset order     Portal reset order     Portal reset order
4                      4                      1
2                      3                      6
1                      5                      3
3                      1                      4
Room Vnum: D           Room Vnum: E           Room Vnum: F
Portal reset order     Portal reset order     Portal reset order
2                      3                      3
3                      1                      1
1                      2                      4
4                      4                      7


(the ~@C ~@G ~@M are Aards color codes)
The thing is, in each room only one portal needs to be shuffled. The one that needs to be shuffled is the one that ALWAYS needs to be shuffled. The other 3 all lead to the same room and don't need to be moved except to be replaced by the correct one.

If in room A #4 is the one that needs to be shuffled then when i run it again (for at least the next 2 times) what would it look like to have it just change that.
The other #'s in each vnum are of no concern but cost gold to change and hence a waste of gold.
So if the current sort is 1 2 3 4 with 4 being the correct one, the next time i shuffle, if i can have 1 4 3 2, and then the next 4 1 3 2 type of thing...not sure how to go about it. 3 hasn't moved which is fine.
I'm assuming this is a whole store the room vnum/portal id to a var and compare with an %ismember but honestly aint sure and not even 75% sure what the heck this code even does :-) for example why is *_Index ALWAYS 1. don't matter what i put as room vnum or portal, not even if i delete it. it comes out to 1...wth?

Thanks for any help
*bow*
_________________
http://www.Aardwolf.com
Reply with quote
Vitae
Enchanter


Joined: 17 Jun 2005
Posts: 673
Location: New York

PostPosted: Wed Sep 14, 2005 8:15 pm   
 
*bump*
_________________
http://www.Aardwolf.com
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD 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