|
ReedN Wizard
Joined: 04 Jan 2006 Posts: 1279 Location: Portland, Oregon
|
Posted: Thu Mar 20, 2008 1:53 pm
[2.20] Button Label not updated to blank when value is null. |
I have a button who's label is %item(@somearray, 1). When there is an item at position 1 in the array everything is fine. If I make the list a %null the %item is now returning a %null value which should change the button text to "" (%null). When I set the array to %null, the old value that was in the array doesn't get removed from the label text. I'm still looking at the old value even after I empty the array. It stays stuck at the old value until I populate the array with a non-null value.
|
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Fri Mar 21, 2008 5:13 pm |
Added to bug list.
|
|
|
|
Arminas Wizard
Joined: 11 Jul 2002 Posts: 1265 Location: USA
|
Posted: Thu May 08, 2008 3:17 am |
ReedN you WERE talking about a "string list" an not a real array right?
I'm gonna call this fixed for 2.24. If I'm wrong please speak up. |
|
_________________ Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram |
|
|
|
ReedN Wizard
Joined: 04 Jan 2006 Posts: 1279 Location: Portland, Oregon
|
Posted: Thu May 08, 2008 6:02 am |
In my case it was indeed a "string list". It's still here in 2.24:
Procedure:
Code: |
1) Create a button with the display value of %item(@stringvar, 1)
2) #additem stringvar one
3) You should see the button update with 'one'
4) #var stringvar %null
5) The text in the button of 'one' still remains.
|
|
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Thu May 08, 2008 6:13 am |
Try doing
#var stringvar ""
instead of using %null. At least that worked for me. Using {} also worked. Let me know if those work for you or not so that I can see if it's a problem with %null or something else in your settings. |
|
|
|
ReedN Wizard
Joined: 04 Jan 2006 Posts: 1279 Location: Portland, Oregon
|
Posted: Thu May 08, 2008 1:08 pm |
Fixed the procedure. You need to have other text in there as well. So just having the button be '%item(@stringvar, 1)' won't do it, but having the button text be '1) %item(@stringvar, 1)' shows the issue.
Procedure:
Code: |
1) Create a button with the display value of: 1) %item(@stringvar, 1)
2) #additem stringvar one
3) You should see the button update with 'one'
4) #var stringvar %null
5) The text in the button of 'one' still remains.
|
|
|
|
|
Taz GURU
Joined: 28 Sep 2000 Posts: 1395 Location: United Kingdom
|
Posted: Thu May 08, 2008 1:13 pm |
Confirmed, using #var stringvar "" and #var stringvar {} has exactly the same effect.
|
|
_________________ Taz :) |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Thu May 08, 2008 5:17 pm |
OK, found it. The problem was that setting a database variable to null wasn't causing the internal event to fire to indicate a changed variable. So button captions would not update, nor would status bar items or expression triggers.
The problem, once again, was the hash table cache. CMUD avoids converting the hash table into a string value whenever possible. So using #ADDITEM was adding a value to the hash table, but the internal string value of the variable is still null. So setting the variable back to null didn't look like the variable was changing. Anything that is done to cause the hash table to be converted to a string, like doing a #SHOW @stringvar would fix this. But since the button only used the %item function, which is optimized to use the hash table and doesn't need the full string value, the full string value was never computed.
Anyway, this is fixed now. CMUD checks to see when the hash table is being changed and flags that so that CMUD will later trigger the "variable is changing" event internally. |
|
|
|
Taz GURU
Joined: 28 Sep 2000 Posts: 1395 Location: United Kingdom
|
Posted: Thu May 08, 2008 6:38 pm |
Are you still releasing as 2.24 by overwriting or are you doing a 2.25?
|
|
_________________ Taz :) |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Thu May 08, 2008 6:42 pm |
Too many fixes to overwrite 2.24, so it will be 2.25 :(
|
|
|
|
ReedN Wizard
Joined: 04 Jan 2006 Posts: 1279 Location: Portland, Oregon
|
Posted: Sun May 11, 2008 11:52 pm |
This is very strange. When the variable is cleared from the command prompt the button updates properly. But if you put the code to set it to %null in an alias/#oninput it doesn't work.
|
|
|
|
Tech GURU
Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: Tue May 13, 2008 7:34 am |
Confirming that this is fixed in 2.25.
|
|
_________________ Asati di tempari! |
|
|
|
Taz GURU
Joined: 28 Sep 2000 Posts: 1395 Location: United Kingdom
|
Posted: Tue May 13, 2008 1:06 pm |
Tech wrote: |
Confirming that this is fixed in 2.25. |
I would suggest this isn't entirely correct, yes for the procedure given but no considering the following:
ReedN wrote: |
This is very strange. When the variable is cleared from the command prompt the button updates properly. But if you put the code to set it to %null in an alias/#oninput it doesn't work. |
|
|
_________________ Taz :) |
|
|
|
ReedN Wizard
Joined: 04 Jan 2006 Posts: 1279 Location: Portland, Oregon
|
Posted: Tue May 13, 2008 3:20 pm |
Taz is correct. The procedure I posted is fixed, but the issue still remains if it cannot be done from a trigger/alias.
|
|
|
|
ReedN Wizard
Joined: 04 Jan 2006 Posts: 1279 Location: Portland, Oregon
|
Posted: Wed May 21, 2008 11:40 pm |
Can anyone else confirm whether you can do this from an alias/trigger?
|
|
|
|
Taz GURU
Joined: 28 Sep 2000 Posts: 1395 Location: United Kingdom
|
Posted: Thu May 22, 2008 10:34 am |
I just confirmed that it does change when using an alias or trigger. Are you unable to do so using both?
|
|
_________________ Taz :) |
|
|
|
ReedN Wizard
Joined: 04 Jan 2006 Posts: 1279 Location: Portland, Oregon
|
Posted: Fri May 23, 2008 2:33 am |
Only updates properly for me when I execute the change through the command line. So it appears we see the same exact thing. This is probably just an oversight on Zugg's part when he made the change.
|
|
|
|
Taz GURU
Joined: 28 Sep 2000 Posts: 1395 Location: United Kingdom
|
Posted: Fri May 23, 2008 11:33 pm |
I said DOES not doesn't so we're not seeing the same behaviour.
|
|
_________________ Taz :) |
|
|
|
ReedN Wizard
Joined: 04 Jan 2006 Posts: 1279 Location: Portland, Oregon
|
Posted: Fri May 23, 2008 11:57 pm |
Oh whoops, misread.
|
|
|
|
ReedN Wizard
Joined: 04 Jan 2006 Posts: 1279 Location: Portland, Oregon
|
Posted: Tue Jun 03, 2008 12:33 am |
This is odd. Observed the following:
In my current session:
- Works in everything except for an oninput trigger I have, which is where I saw this issue originally. This is always why it appeared unfixed to me.
In a new session:
- It works all the time.
So I'm guessing this is some issue with oninput triggers and I'll need to do a bit more work to isolate this. |
|
|
|
Larkin Wizard
Joined: 25 Mar 2003 Posts: 1113 Location: USA
|
Posted: Tue Jun 03, 2008 11:33 am |
I have similar issues with my status bar items not updating when I null out a variable that's being used on the status bar. Not sure if the two things are related or not.
|
|
|
|
ReedN Wizard
Joined: 04 Jan 2006 Posts: 1279 Location: Portland, Oregon
|
Posted: Tue Jun 03, 2008 1:56 pm |
There have already been various cases of cached values not being handled right in Cmud, and I expect this to be another one of these when I finally get to its root.
|
|
|
|
ReedN Wizard
Joined: 04 Jan 2006 Posts: 1279 Location: Portland, Oregon
|
Posted: Tue Jun 03, 2008 2:02 pm |
Zugg: Before I kill myself trying to figure out what's causing this. Is there any reason a variable assigned %null in an oninput trigger would differ from one being assigned the same thing through the command prompt?
I can actually print out the value that I've assigned null and it is indeed null, but will not change in the button text until something else modifies the variable. Seems a classic case of the cache not updating, but I'm not sure why it only occurs sometimes. |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Tue Jun 03, 2008 4:45 pm |
Nope, there shouldn't be any difference doing it in an oninput trigger or doing it on the command line.
|
|
|
|
ReedN Wizard
Joined: 04 Jan 2006 Posts: 1279 Location: Portland, Oregon
|
Posted: Wed Jun 04, 2008 12:32 am |
I took my settings and imported them to a new session. I then proceeded to slim it down until only the code necessary to demonstrate was left.
Procedure:
Quote: |
1) Import the below code into a new session
2) Connect to Achaea (IRE Mud)
3) Type 'test1' to setup the button variables with values. You should see 'one', 'two', and 'three' appear in the buttons.
4) Type 'test2' to execute 'info here' which will trigger the 'info here' oninput trigger.
5) At this point you'll see the line from the oninput trigger print out:
#say Reset - shortTargets: @shortTargets
Since @shortTargets was just set to null before this line it will look like this:
Reset - shortTargets:
6) Take a look at the buttons, they should still show 'one', 'two', 'three'. Which means they didn't update.
7) Optionally you can type #var shortTargets %null at the command line and it will clear the buttons correctly. It's just when performed with the oninput trigger that it isn't working. |
Code: |
<class name="Test" id="3407">
<trigger name="infohere_trigger" type="Command Input" priority="39070" case="true" regex="true" id="3414">
<pattern>^(?:ih|info here)\s*$</pattern>
<value>#var shortTargets %null
#say Reset - shortTargets: @shortTargets</value>
<trigger type="Duration" param="2500" case="true" regex="true">
<pattern>^(?:([^0-9 ]+)\d+\s+([^0-9]+)|(Number of objects: \d+))$</pattern>
<value>#say Triggered</value>
</trigger>
</trigger>
<button name="btn_TargetShort1" autosize="false" width="100" height="20" autopos="false" left="451" transparent="false" color="silver" gaugelowcol="red" gaugebackcol="silver" priority="161" id="3429">
<caption>1) %item(@shortTargets, 1)</caption>
</button>
<button name="btn_TargetShort2" autosize="false" width="100" height="20" autopos="false" left="451" top="21" transparent="false" color="silver" gaugelowcol="red" gaugebackcol="silver" priority="163" id="3430">
<caption>2) %item(@shortTargets, 2)</caption>
</button>
<button name="btn_TargetShort3" autosize="false" width="100" height="20" autopos="false" left="451" top="41" transparent="false" color="silver" gaugelowcol="red" gaugebackcol="silver" priority="164" id="3431">
<caption>3) %item(@shortTargets, 3)</caption>
</button>
<var name="shortTargets" usedef="true" id="3438"/>
<alias name="test1" id="3460">
<value>#additem shortTargets one
#additem shortTargets two
#additem shortTargets three</value>
</alias>
<alias name="test2" id="3461">
<value>info here</value>
</alias>
</class>
|
|
|
|
|
|
|