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
estelle
Newbie


Joined: 26 Sep 2010
Posts: 8

PostPosted: Sun Sep 26, 2010 11:23 pm   

evaluating variables in the status window
 
Hello all, my first time posting, please be gentle with me Wink

I have a lovely status window in which I post the status of various buffs/shields, which are stored in variables. All this works perfectly, but I'm trying to get %if (or #IF) to work so that the color of the text displaying the variable will change depending on the state. I would like it to display the word "OFF" in red, and "ON" in green.

I have tried various ways to get something like the following to work:

Shield: %if(@shield="OFF", <color red>@shield</color>,<color green>@shield</color>)

to no avail. Is it even possible to evaluate variables in the status window? If so, can somebody show me what I'm doing wrong? Thanks!
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Mon Sep 27, 2010 12:51 am   
 
Try this:
Code:
Shield: %if(@shield="OFF", %concat("<color red>",@shield,"</color>"),%concat("<color green>",@shield,"</color>")
Reply with quote
estelle
Newbie


Joined: 26 Sep 2010
Posts: 8

PostPosted: Mon Sep 27, 2010 1:39 am   
 
Hmm...tried that and got this:

Shield: %if(@shield="OFF", %concat("",@shield,""),%concat("",@shield,"")

See invis:@sight
Resist:@resist
Strengthen:@strengthen
Barrier:@barrier

You see it gave me back the literal string, which was the problem I'd been having, plus it turn all the rest of my variable into literal strings too. Weird. Thoughts?
Reply with quote
Fizgar
Magician


Joined: 07 Feb 2002
Posts: 333
Location: Central Virginia

PostPosted: Mon Sep 27, 2010 3:10 am   
 
In the trigger that you set the value of the variable with try this:

for the off trigger
Code:
#var shield "<c red>Off</c>"


for the on trigger
Code:
#var shield "<c green>On</c>"


or something similar. just add the color codes to the variable when it's set.
_________________
Windows Vista Home Premium SP2 32-bit
AMD Athlon Dual Core 4400+ 2.31 GHz
3 GB RAM
CMUD 3.34
Reply with quote
estelle
Newbie


Joined: 26 Sep 2010
Posts: 8

PostPosted: Mon Sep 27, 2010 3:40 am   
 
That works! Thank you!
Reply with quote
Aerious
Wanderer


Joined: 21 Jan 2008
Posts: 62

PostPosted: Wed Sep 29, 2010 8:12 pm   
 
I have multiple status windows that use @variables..

Code:
%if(%db(@prots,greater),%db(@prots,greater_name) " " %eval(@timer-%db(@prots,greater_start))~(%db(@prots,greater_history)~),%ansi(red,dark)%db(@prots,greater_name) " Off"%ansi(reset))@test123


Code:
%if(%db(@prots,iw),%db(@prots,iw_name) " " %eval(@timer-%db(@prots,iw_start))~(%db(@prots,iw_history)~),%ansi(red,dark)%db(@prots,iw_name) " Off"%ansi(reset))@test123


This one is actually on the Status Bar.
Code:
<send 'scrollfound=""'>@scrollfound</send>


the @test123 thing is a variable that I have oscillating with "" and " " every 5 seconds (using a 5 second alarm) which allows my status window to update my timers every 5 seconds.. (only way i've seen to do this?
Reply with quote
Aerious
Wanderer


Joined: 21 Jan 2008
Posts: 62

PostPosted: Wed Sep 29, 2010 8:14 pm   
 
Ahh I see.. it was a variable assignment issue,

Glad you got it worked out!
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