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
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Mon May 26, 2008 5:11 pm   

Status Bar, Color and IF/Switch statements?
 
Am I able to put an IF/Switch statement in a status bar item, and use color?

So, for instance

#status {
#SWITCH (@questitem)
("Royal Sceptre") {#COLOR Some purple color;@questitem}
("Crown Jewels") {#COLOR some green color;@questiem}
...
}

Also, how do I put a name in a status, every time I try #status name { text } it puts the name in with the text...
Reply with quote
Guinn
Wizard


Joined: 03 Mar 2001
Posts: 1127
Location: London

PostPosted: Mon May 26, 2008 5:51 pm   
 
I'd personally use an alias to do the work

#ALIAS setStatus {
#SWITCH (@questitem)
("Royal Sceptre") {#STATUS {whatever}}
("Crown Jewels") {#STATUS {whatever}}
}

Or you could use %switch if not
_________________
CMUD Pro, Windows Vista x64
Core2 Q6600, 4GB RAM, GeForce 8800GT
Because you need it for text... ;)
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Mon May 26, 2008 6:14 pm   
 
Well, I don't want it to add new instances to the status every time I quest and this needs to update for each new quest.

As it is right now it' just sits there on the status bar, empty if it has no value [ ] or, if it does have a value [Crown Jewels]
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Mon May 26, 2008 6:37 pm   
 
Statusbar items, I believe, operate under the same restrictions as #VARFUNC functions do. So, basically, you cannot use #commands in them. There's enough functions available for you to get around this, though:

#COLOR/#CW ==> %ansi() or <color colorname/colorcode></color>
#SWITCH ==> %switch()
#IF ==> %if()
_________________
EDIT: I didn't like my old signature
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Mon May 26, 2008 8:34 pm   
 
Guinn - you could just put the @QuestItem variable in the status bar. If you want to put some other output based on the item, you could just have a variable @QuestItemText or something that you set, as you're doing there, with an alias and #switch.

Matt's right about status windows only containing text and functions. You might find %case useful, too.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Mon May 26, 2008 10:12 pm   
 
So use the functions instead of commands? IF they're the same thing, what's the point in the distinction?
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
Anaristos
Sorcerer


Joined: 17 Jul 2007
Posts: 821
Location: California

PostPosted: Tue May 27, 2008 1:53 am   
 
I hate getting involved in this, but commands are directives to CMUD while functions just return values (otherwise they would not be called functions...). So the status must be something that evaluates to a string, commands don't evaluate to anything.
_________________
Sic itur ad astra.
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Tue May 27, 2008 2:09 am   
 
simple enough distinction to me. Why do you hate getting involved in it?
_________________
Listen to my Guitar - If you like it, listen to more
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