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


Joined: 08 Apr 2004
Posts: 103
Location: USA

PostPosted: Sun Sep 14, 2008 10:27 pm   

Echo question
 
Trying to work on an echo... I've got about 30 or so variables I'd like to echo if they are active at a certain line.. So lets say this:

confusion = 1, stupidity = 1, epilepsy = 1, vertigo = 0

I want to make an echo on this trigger line

What are they afflicted with?

#echo They have confusion, stupidity, epilepsy.
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Mon Sep 15, 2008 1:26 am   
 
Well, long way around it would be:

#ECHO They have %if(@confusion, "confusion"), %if(@stupidity, "stupidity"), %if(@epilepsy, "epilepsy") etc...

Easier way would be to put all afflictions into one variable... such as this:

#TRIGGER {You are afflicted with confusion.} {#ADDITEM afflictionlist "confusion"}
#TRIGGER {You are afflicted with stupidity.} {#ADDITEM afflictionlist "stupidity"}

and so forth.

Then you can do:

#ECHO They have %expandlist(@afflictionlist, ", ")

Then you can trigger to remove afflictions off it...

#TRIGGER {You are no longer afflicted with stupidity.} {#DELITEM afflictionlist "stupidity"}

Hope that helps.

Charneus
Reply with quote
Dyron
Apprentice


Joined: 08 Apr 2004
Posts: 103
Location: USA

PostPosted: Mon Sep 15, 2008 2:48 am   
 
Thanks you're awesome!
Reply with quote
Dyron
Apprentice


Joined: 08 Apr 2004
Posts: 103
Location: USA

PostPosted: Mon Sep 15, 2008 3:20 am   
 
Hrmm.. what about an if statement to stop the additem from adding an affliction already in it?
as in.. if stupidity is already in that list, I don't want to add it twice
Reply with quote
Tech
GURU


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

PostPosted: Mon Sep 15, 2008 4:23 am   
 
Use %ismember to determine what's in the list already. If you use the %additem function, it won't put duplicates in the list.
_________________
Asati di tempari!
Reply with quote
shalimar
GURU


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

PostPosted: Mon Sep 15, 2008 4:33 am   
 
%additem = duplicates
#ADDITEM != duplicates
_________________
Discord: Shalimarwildcat
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Mon Sep 15, 2008 12:57 pm   
 
Shalimar is correct on this one. :p #ADDITEM does not add duplicates, so it'll never add the affliction twice. :)

Charneus
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