ID:76501
 
Resolved
Fixed in 446
BYOND Version:445
Operating System:Windows XP Pro
Web Browser:Internet Explorer 8.0
Status: Resolved (446)

This issue has been resolved.
Descriptive Problem Summary:
So what I'm talking about is when you're in the map editor and right-click a turf and go to "Edit..." and pick a variable to edit. I'm pretty sure you used to be able to edit a list variable by putting something like this in for the value -- surronding it in braces and separating each thing with a comma: {"List Object One","List Object Two",3,4,"The Cowness"}

I think in 443 that didn't work at all but that seems to be irrelevant because now that I have 445 it just works incorrectly. If I try to make a list of text strings it just does nothing, and if I make a list of numbers it for some reason replaces them with types -- if I hit OK and edit the instance again it'll say {/obj,/mob,/mob/team} instead of {1,2,3}.

I'll also note that if I hit New Instance and the object has a variable defined such as list("One","Two","Three") the value will appear blank in the New Instance box. I haven't tested the effects this strangeness has once the game is running, but mostly because I'm trying to make text lists and text lists throw errors ("[text value] is an invalid tag or path").

This is pretty hard for me to explain... just try putting {1,2,3} as a value for a list-type variable and then try {"Test","Two","Three"} and hopefully you'll get what I'm getting and understand. I first posted this in "Developer How-to" in case I'd simply forgotten the syntax but Garthor seems to agree that the thing's broken, so it shouldn't just be me~

UPDATE: Tom says I was wrong about the braces and I have no idea where I got them from. Oh well. But anyway, the editor does seem to be broken for lists. If I use the correct notation of list("One","Two","Three") and compile the game, it erases my new values. It also does not display the default list value I set in the code and has the "value" box blank.

Numbered Steps to Reproduce Problem:
Make a .dmm map
Edit any atom on the map with the instance editor
Try to edit a variable like "desc" or something that's actually a list, replacing the value with something surrounded in braces like I showed above
Code Snippet (if applicable) to Reproduce Problem:
obj/var/list/listForTesting = list()
//And then edit any object you have on the map and try changing the value


Expected Results:
It should save my changes to the value
Actual Results:
It does not save my changes, throws errors, or saves something other than what I put in there.
Does the problem occur:
Every time? Or how often?
Every time
In other games?
I've tried two games; the only difference is that inputting numbers into a list changes the types they get replaced by (probably something to do with the order I defined them in; I dunno)
In other user accounts?
untested
On other computers?
untested
When does the problem NOT occur?
Never, I guess.
Workarounds:
Do File->Save to save the map before compiling
I believe you're just using the wrong notation here. The usual shorthand in the instance editor is to assign stuff just as you would a var, eg list(1,2,3). Here is a post from almost ten years ago (sigh) that might help (I suppose we ought to document this somewhere):

Instance editor notation

I won't mark this as "resolved" just yet because I want to ensure that nothing has changed (I did test under 440 and the behavior seemed the same as in the latest 445). It would also be good to know if this stuff still works ok.
Well I updated the post because I tried it your way and it still didn't work. This is what I added even though it's obviously flagged up there:

The editor does seem to be broken for lists. If I use the correct notation of list("One","Two","Three") and compile the game, it erases my new values. It also does not display the default list value I set in the code and has the "value" box blank.

So yeah, in the editor the "value" field starts out blank instead of showing the default value. Then if I put something in with the correct syntax you described I get no errors, and if I hit OK and edit the tile again it has the list in the "value" field like it should. However, if I compile and edit the tile again, the "value" field is blank again, and if I run the game it uses the default list value.
I tried this out and while I did see the blank value, I did not see the list being reset after compiling and running. The map still has the correct data, whether I used a list of numbers or a list of strings.

On a side note I recommend not using obj/var/something=list() in general, because you're allocating a list for every obj in the game, when you may only need it for certain objs. I suggest you leave your lists null until you need them, and then create them when you need to add a value to them.
Well I've tried it in three different environments, including my Tesht.dme that just has a bunch of verbs and procs defined, and got the same effect, just with this code:
turf/spawnerturf/var/list/spawnThese = list("Blah One","Blah Two")
and then I go to the map editor and try to edit the "spawnThese" variable of a spawnerturf in the map editor.
Ah, I think I found the issue. It appears to be related to that deletion bug we fixed yesterday. The map isn't being marked as modified, so unless you do a hard save your change is not recorded.

In the meantime a workaround is a hard save before compiling.
I edited the workaround section in the post since that seems to work.