|
Dyron Apprentice
Joined: 08 Apr 2004 Posts: 103 Location: USA
|
Posted: 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. |
|
|
|
charneus Wizard
Joined: 19 Jun 2005 Posts: 1876 Location: California
|
Posted: 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 |
|
|
|
Dyron Apprentice
Joined: 08 Apr 2004 Posts: 103 Location: USA
|
Posted: Mon Sep 15, 2008 2:48 am |
Thanks you're awesome!
|
|
|
|
Dyron Apprentice
Joined: 08 Apr 2004 Posts: 103 Location: USA
|
Posted: 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 |
|
|
|
Tech GURU
Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: 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! |
|
|
|
shalimar GURU
Joined: 04 Aug 2002 Posts: 4690 Location: Pensacola, FL, USA
|
Posted: Mon Sep 15, 2008 4:33 am |
%additem = duplicates
#ADDITEM != duplicates |
|
_________________ Discord: Shalimarwildcat |
|
|
|
charneus Wizard
Joined: 19 Jun 2005 Posts: 1876 Location: California
|
Posted: 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 |
|
|
|
|
|