ID:2762414
 
Resolved
Regression: Static vars defined in procs didn't compile correctly if their default value was a string.
BYOND Version:514
Operating System:Windows 10 Home
Web Browser:Firefox 96.0
Applies to:Dream Maker
Status: Resolved (514.1577)

This issue has been resolved.
Descriptive Problem Summary:
on 514.1576 static string variables will only ever have the value ""
any string value you try to initialize it as will be reduced to that. assigning an already existing static variable a string value will work as expected it seems, and will get the value you expect it to.

assigning lists and numbers and datums to static variables at compile time works as expected
Numbered Steps to Reproduce Problem:
1. assign a static/global variable a string value at compile time
2. try to access a character in that string
3. get a bad index runtime because the variable is actually ""
Code Snippet (if applicable) to Reproduce Problem:
var/static/static_string = "this will runtime every time if its not changed"
var/non_static_string = "this doesnt runtime"

world.log << static_string[1] //gives a bad index runtime because the string is ""
world.log << non_static_string[1] //outputs "t"

static_string = "this will no longer runtime since its a non empty string"

world.log << static_string[1] // outputs "t"


Expected Results:
static strings defined at compile time to have the value defined
Actual Results:
static strings defined at compile time have the value ""
Does the problem occur:
Every time? Or how often?
every time you use a static string, at least one defined in a proc on the latest 514 version

When does the problem NOT occur?

Did the problem NOT occur in any earlier versions? If so, what was the last version that worked? (Visit http://www.byond.com/download/build to download old versions for testing.)
didnt seem to occur before 514.1576 but i dont remember what version i had before. probably 514.1557 or a bit later

Workarounds:
giving the static variable the value you want at runtime

test case: https://github.com/Kylerace/basic-test-project
i just worked on a test case sample it should show the log output of the runtime on the right
Lummox JR resolved issue with message:
Regression: Static vars defined in procs didn't compile correctly if their default value was a string.