Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD Beta Forum
manbat
Novice


Joined: 21 Mar 2009
Posts: 35

PostPosted: Tue Apr 21, 2009 11:25 pm   

Status Bar Not Updating
 
Am I mistaken or is the statusbar and status window supposed to contantly be up to date with variables?

I have in my statusbar

@timeleft

And @timeleft is

#IF (@resting) {Ticks Remaining: %eval(5-@ticks) }

and my tick timer updates @ticks. It works, except it's not updating on the ticks when @ticks is changed....
Reply with quote
Obyron
Novice


Joined: 29 Jan 2006
Posts: 40
Location: Aardwolf

PostPosted: Wed Apr 22, 2009 7:52 am   
 
I'm having the same problem with %roomname, %zonename, and %roomnum in my statusbar. They don't stay updated when I move, which worked fine in Zmud.
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Wed Apr 22, 2009 9:47 am   
 
Firstly, variables can't contain code like what you've posted here. To do so, it'd need to be a function, which won't display properly on the status bar. Well, no, that's not quite accurate - let me explain how the status bar works.

The status bar monitors any variables that're in it. It watches for when the value of those variables change, and repaints the status line when any changes occur. In this case, your variable contains "#IF (@resting) {Ticks Remaining: %eval(5-@ticks) }", which if you think about it never actually changes - the contents of the variables in it might change, but the actual variable references don't change, so the status bar will never update.

So basically, if you want the statusbar to monitor a variable, that variable needs to be inside the actual text of the status window. If you put %if(@resting,Ticks Remaining: %eval(5-@ticks)) directly into the status bar, it'll hopefully start working.

If your @timeleft() is actually a function that's supposed to #return the string "Time Remaining: %eval(5-@ticks)" - so you meant the code to be #IF (@resting) {#return Ticks Remaining: %eval(5-@ticks) } - then it's pretty easy to trick the status bar into updating the function. All you need to do is put the variables you want to monitor into the actual text of the status bar, changing your function call from @timeleft() to @timeleft(@resting,@ticks). The variables won't be displayed because they're passed to the function, but because they're in the status bar, they'll be monitored for updates.

Similarly, Obyron, your trouble is caused by there being no variable to check. There're a few ways of tricking the status bar into refreshing those functions - I think the easiest would be to have a variable that you flip between 0 and 1 every time the OnRoomEnter event is issued. The generally-accepted way of fooling the status bar into watching a variable you don't care about is to put it in an %if with no other arguments, like %if(@RoomChange). This will check the variable, but the %if will always return nothing whether it's false or true.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Arde
Enchanter


Joined: 09 Sep 2007
Posts: 605

PostPosted: Wed Apr 22, 2009 3:22 pm   
 
"Add this to documentation"! Excellent explanation, Fang!

And for the lazy ones the new command #UPDATE status-element-id has been introduced several versions ago. :)
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Sat Apr 25, 2009 9:02 pm   
 
Arde wrote:
"Add this to documentation"! Excellent explanation, Fang!

And for the lazy ones the new command #UPDATE status-element-id has been introduced several versions ago. :)


Yet there's no documentation ANYWHERE that states how or what #UPDATE is used for. Not even in the Help library. *shrug*

Charneus
Reply with quote
Dumas
Enchanter


Joined: 11 Feb 2003
Posts: 511
Location: USA

PostPosted: Sat Apr 25, 2009 9:27 pm   
 
charneus wrote:
Arde wrote:
"Add this to documentation"! Excellent explanation, Fang!

And for the lazy ones the new command #UPDATE status-element-id has been introduced several versions ago. :)


Yet there's no documentation ANYWHERE that states how or what #UPDATE is used for. Not even in the Help library. *shrug*

Charneus


True, but it was only added back in 3.04, meaning one could easily find the version note for it.

Quote:
Added: #UPDATE command to force a button or status bar item to update
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Mon Apr 27, 2009 1:45 pm   
 
None of the new commands added in 3.xx have documentation in the help library. This makes sense, since it avoids confusing the majority of users who are using the public version.
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Mon Apr 27, 2009 3:07 pm   
 
Rahab wrote:
None of the new commands added in 3.xx have documentation in the help library. This makes sense, since it avoids confusing the majority of users who are using the public version.


Yeah, I figured as much, but Arde had said 'several versions ago' which implies quite possibly 2.xx, which would be public. :P

I had missed the #UPDATE command, at any rate.

Charneus
Reply with quote
Arde
Enchanter


Joined: 09 Sep 2007
Posts: 605

PostPosted: Mon Apr 27, 2009 4:50 pm   
 
charneus wrote:
Yeah, I figured as much, but Arde had said 'several versions ago' which implies quite possibly 2.xx, which would be public. :P
Charneus

I hope you forgive me for that. ;)
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD Beta Forum 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