|
eupher Apprentice
Joined: 18 Jan 2001 Posts: 116 Location: USA
|
Posted: Wed Dec 08, 2010 4:51 pm
%pop and the status bar |
I like to keep my pendingHeals variable (which is a list) on my status bar. It basically shows the name of all the targets for heals I've sent that haven't executed yet.
<stat name="Pending Heals" priority="11870" id="1187">
<value>Pending: @pendingHeals</value>
</stat>
I use %additem and %pop to add and remove targets. %additem is working fine because I use it in an assignment back to the pendingHeals variable...
pendingHeals=%additem(bob,@pendingHeals)
When I do this, bob is added to the status as expected.
However, since %pop returns the item popped from the list and not the list itself, I can't use it the same way...
$temp=%pop(pendingHeals)
When I do this, bob is still on the status bar even though he's not in the pendingHeals list anymore.
I ended up needing to add an extra assignment of pendingHeals to itself in order to get the status bar to update...
pendingHeals=@pendingHeals
Since %pop changes the value of a variable, shouldn't that change register with the status bar?
Thanks! |
|
|
|
Erasmus Wanderer
Joined: 04 Aug 2004 Posts: 82 Location: Philadelphia
|
Posted: Wed Dec 08, 2010 6:01 pm |
%pop() actually modifies the variable as part of its code, unlike %additem() so there is no variable assignment necessary when using %pop().
#CALL %pop(pendingHeals) should work fine and since the variable is modified the status bar would update to reflect.
Edit: Nevermind. I actually read your whole post (unlike earlier apparently), and agree that you would think the status bar would update with the new variable values.
Erasmus |
|
_________________ Erasmus |
|
|
|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Wed Dec 08, 2010 6:05 pm |
That should work. However, it sounds like Eupher is seeing that using %pop does not cause the status bar to update. If this is true, it indicates a bug in that %pop is not setting the internal variable telling Cmud that it has been modified. I'm at work and can't test this just now. Can anyone else verify this?
|
|
|
|
Erasmus Wanderer
Joined: 04 Aug 2004 Posts: 82 Location: Philadelphia
|
Posted: Wed Dec 08, 2010 6:10 pm |
According to the #UPDATE help file there are certain things that do not automatically cause an update on status bar or button items. Whether or not this is supposed to be one of them I don't know.
At any rate try:
#UPDATE 1187
This should force the status bar to update with the new variable values. 1187 is the id of the status bar from your script (id="1187"). |
|
_________________ Erasmus |
|
|
|
eupher Apprentice
Joined: 18 Jan 2001 Posts: 116 Location: USA
|
Posted: Wed Dec 08, 2010 6:43 pm |
Thanks for the help.
The #UPDATE command doesn't seem to be fixing the problem. Maybe I'm doing something wrong...
Also, if there are instances where changing the value of a variable used in the status bar doesn't get reflected in the status bar, requiring the use of the #UPDATE command... that might be something good to add to the help file on #STATUS. Right now all it says about variables that change is...
"The status line is updated whenever a variable is changed."
Noting exceptions and pointing to help on #UPDATE would be helpful. :)
It's also unclear to me, in reading help on #UPDATE, that this situation would apply. The status bar I have defined doesn't rely on functions at all. It's just a variable name. I'm not sure if it's saying that any variable that might be changed by a function elsewhere won't be up to date (ouch), or if function calls in the status bar definition itself won't keep updating without an explicit call to #UPDATE (what I hope it's saying).
Thanks again! |
|
|
|
Fizgar Magician
Joined: 07 Feb 2002 Posts: 333 Location: Central Virginia
|
Posted: Wed Dec 08, 2010 9:28 pm |
Rahab wrote: |
That should work. However, it sounds like Eupher is seeing that using %pop does not cause the status bar to update. If this is true, it indicates a bug in that %pop is not setting the internal variable telling Cmud that it has been modified. I'm at work and can't test this just now. Can anyone else verify this? |
This sounds like the case. Like stated above using %pop on a variable in the status bar will not change what is shown. However if after using %pop you type #var <variable shown on status bar> or open the package editor and click on the variable that is displayed on the status bar, what is shown on the bar is updated. |
|
_________________ Windows Vista Home Premium SP2 32-bit
AMD Athlon Dual Core 4400+ 2.31 GHz
3 GB RAM
CMUD 3.34 |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Wed Dec 08, 2010 10:42 pm |
#UPDATE does not take the numeric ID. The numeric ID shown in XML never gets used in any scripts. The #UPDATE command needs the ID "name" assigned to the status bar entry. Go into the Package Editor, select the status bar entry, then click the More button to see the advanced options along the bottom. You'll need the ID Name field there. That is what #UPDATE needs to force the status bar entry to refresh.
The %pop command won't actually register itself as detecting a change in the variable since the variable is just passed as a "string" name (pendingHeals) and not a true variable reference (@pendingHeals). |
|
|
|
eupher Apprentice
Joined: 18 Jan 2001 Posts: 116 Location: USA
|
Posted: Thu Dec 09, 2010 12:13 am |
Probably doing something stupid here....
but when I click the More button in the package editor I only see 4 things:
show in status bar
show in status window
priority
notes
There's an ID field for all my other kinds of settings, just not this status bar.
I'm running 3.32.
Also, should I even worry about this? Is there some disadvantage to getting the status bar to update this variable by just assigning the variable to itself?
Thanks |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Thu Dec 09, 2010 12:29 am |
Unlike other settings, the id name field for a status object is at the top (rather obviously labeled Name, by the way) rather than on the More panel.
|
|
_________________ EDIT: I didn't like my old signature |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Thu Dec 09, 2010 5:50 pm |
Yep, Matt is correct. I forgot about that too.
|
|
|
|
Zoticus Beginner
Joined: 16 Jan 2010 Posts: 24
|
Posted: Thu Jun 02, 2011 7:47 am |
So is that the fix? I've recently run into this problem myself, and it's very very annoying, as I prefer to use the status bar to keep track of various variable values instead of outputting a #say or #echo, as combat can move fast - is use of the #update command meant to be a fix for this issue?
Edit - looks like it is. Still not sure why %pop doesn't work as it used to, but hey. |
|
|
|
|
|