string loses value between create actor and draw actor
Posted: Thu Jan 24, 2008 6:01 pm
Is this a bug with the version I'm using, or am I doing something wrong?
When the game is run, an actor is created when a certain event happens.
1) I make a string variable with the scope of actor instead of global. Lets call it "boogers". I've made two text actors to show text for debugging purposes, named "debugtext" and "debugtext2". The default text for these actors is "| ".
2) In create actor script, I initialize it with the string "lalalalala":
boogers = "lalalalala";
3) To double check things, I go ahead and display the contents of "boogers" in a text actor, still in create actor script:
strcpy(debugtext.text, boogers);
4) Now in the draw actor script, I have the same line as in 3), with the exception that boogers is now going to a second text actor:
strcpy(debugtext2.text, boogers);
When the game is run, both text actors show the default "| ". When the actor is created, "lalalalala" shows up on the text actor "debugtext", so I know that "boogers" does in fact contain the correct string. However on the text actor "debugtext2", the output is null, or spaces, or something else that dosn't show up at all - the default message has dissapeared.
I should note that there is no other code that touches these variables in my scripts.
What is going on?
When the game is run, an actor is created when a certain event happens.
1) I make a string variable with the scope of actor instead of global. Lets call it "boogers". I've made two text actors to show text for debugging purposes, named "debugtext" and "debugtext2". The default text for these actors is "| ".
2) In create actor script, I initialize it with the string "lalalalala":
boogers = "lalalalala";
3) To double check things, I go ahead and display the contents of "boogers" in a text actor, still in create actor script:
strcpy(debugtext.text, boogers);
4) Now in the draw actor script, I have the same line as in 3), with the exception that boogers is now going to a second text actor:
strcpy(debugtext2.text, boogers);
When the game is run, both text actors show the default "| ". When the actor is created, "lalalalala" shows up on the text actor "debugtext", so I know that "boogers" does in fact contain the correct string. However on the text actor "debugtext2", the output is null, or spaces, or something else that dosn't show up at all - the default message has dissapeared.
I should note that there is no other code that touches these variables in my scripts.
What is going on?