|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: Sun Nov 04, 2007 1:57 am
[2.10] #ADD is appending |
This is causing a few sections of my scripts to become useless.
Procedure
1. Launch CMud
2. Close Sessions window (ESC)
3. Enter at the command line
Code: |
#VAR a 1;#ALIAS b {#ADD a 1;#SHOW @a} |
4. Enter at the command line b
You will see add works perfectly 2 is displayed
5. Close CMud
6. Navigate to an rename the untitled.pkg to ntitled.pkg
7. Launch CMud
8. Close Sessions window (ESC)
9. Open Package Editor (CTRL-G)
10. Select File|Open from the PE menu
11. Navigate to an open the ntitled.pkg
12. Click the second untitled window tab
13. Enter at the command line
|
|
_________________ The only good questions are the ones we have never answered before.
Search the Forums |
|
|
|
Arde Enchanter
Joined: 09 Sep 2007 Posts: 605
|
Posted: Sun Nov 04, 2007 9:37 am |
This procedure works for me as it should work: after step 13 I see 3,4,5,6... values.
|
|
_________________ My personal bug|wish list:
-Wrong Priority when copy-paste setting
-1 prompt trigger for Mapper, Session and General Options, not 3 different!
-#SECTION can terminate threads
-Buttons can't start threads |
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: Sun Nov 04, 2007 3:08 pm |
I retested this procedure a few times and had it work once too. I actually can't find any specific difference to the one time it worked. I do know I have this problem with one of my packages, and the only step it has in common with this procedure is that the file was renamed (step 6).
|
|
_________________ The only good questions are the ones we have never answered before.
Search the Forums |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Mon Nov 05, 2007 6:05 pm |
This will happen if the @a variable is initialized to a blank string, or is uninitialized. Remember that you can add string values in CMUD (causes concat). So, if @a is set to a blank value or any other string value, then #ADD is going to concat. You must initialize @a to zero as you did in your first step.
So somehow when you load the package again, the value of @a isn't being set.
This is also why you want to initialize numeric variables with:
#VAR varname 0
and *not* this:
#VAR varname {}
like some people did in zMUD. |
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: Mon Nov 05, 2007 6:22 pm |
I guess this part is the bug then
Quote: |
So somehow when you load the package again, the value of @a isn't being set. |
I had it happen where the outputs showed 1, 11, 111, 1111, 11111, and 111111 on 9 of my 10 tests.
Perhaps the renaming is not the problem, but it was the only thing in common between another package I was testing with and my main package. Also just to note, the variables I saw this with in my main package have Use Default and default value of 0. The bug with default values not working could be the culprit there. |
|
_________________ The only good questions are the ones we have never answered before.
Search the Forums |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Mon Nov 05, 2007 6:31 pm |
Quote: |
The bug with default values not working could be the culprit there. |
That's definitely a possibility. |
|
|
|
|
|