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
Scirkhan
Apprentice


Joined: 14 Sep 2007
Posts: 167
Location: aztx

PostPosted: Wed Jan 28, 2009 4:12 am   

Additem %remove
 
#additem CardList {%remove(%item(@CardList2,%random(1,%numitems(@CardList2))),@CardList2)}

I don't know why that doesn't work.
Can someone tell me why it doesn't work? Thank you!
Reply with quote
Tech
GURU


Joined: 18 Oct 2000
Posts: 2733
Location: Atlanta, USA

PostPosted: Wed Jan 28, 2009 5:48 am   
 
What exactly isn't working? What's the value of @CardList2?

I'm not 100% but I think you really want to be using %delitem(s,list) instead of %remove.
_________________
Asati di tempari!
Reply with quote
Scirkhan
Apprentice


Joined: 14 Sep 2007
Posts: 167
Location: aztx

PostPosted: Wed Jan 28, 2009 5:55 am   
 
Yeah I tried that first, It seems to be not working with just: %delitem(%item(@CardList2,%random(1,%numitems(@CardList2))),@CardList2) being considered.

It acts much differently if you replace %delitem with %additem

My fifty-second post, and I'm talking about cards..
Reply with quote
Tech
GURU


Joined: 18 Oct 2000
Posts: 2733
Location: Atlanta, USA

PostPosted: Wed Jan 28, 2009 8:11 am   
 
If you are trying to remove it from one list and it to the other you may need to do it several steps.

Code:
#VAR Temp %item(@CardList2,%random(1,%numitems(@CardList2))),@CardList2)
#ADDITEM CardList {@Temp}
#CALL %delitem (@Temp, @CardList2)


Try that.
_________________
Asati di tempari!
Reply with quote
Scirkhan
Apprentice


Joined: 14 Sep 2007
Posts: 167
Location: aztx

PostPosted: Thu Jan 29, 2009 6:39 am   
 
Yes that'll work.
But do you know the first trigger does not work? I have somewhat of an idea.
Reply with quote
shalimar
GURU


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

PostPosted: Thu Jan 29, 2009 7:16 am   
 
because #delitem returns the new value of the variable expanded... this|that|theother
if you pass that to #ADDITEM in thinks its all one string entry of "this|that|theother"
_________________
Discord: Shalimarwildcat
Reply with quote
Scirkhan
Apprentice


Joined: 14 Sep 2007
Posts: 167
Location: aztx

PostPosted: Thu Jan 29, 2009 7:46 pm   
 
It does it to this line too shalimar

%delitem(%item(@CardList2,%random(1,%numitems(@CardList2))),@CardList2)

But it does think it is all one string..
Reply with quote
Leitia
Adept


Joined: 04 May 2007
Posts: 292
Location: Boston

PostPosted: Sat Jan 31, 2009 3:52 pm   
 
If I really needed to have that as one function, I would try to work with %exec() or %eval() or %number(), but I wouldn't know which or suppose why just now.
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