string loses value between create actor and draw actor

Game Editor comments and discussion.

string loses value between create actor and draw actor

Postby yttermayn » 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?
yttermayn
 
Posts: 48
Joined: Sun Nov 25, 2007 4:10 pm
Score: 2 Give a positive score

Re: string loses value between create actor and draw actor

Postby makslane » Thu Jan 24, 2008 6:59 pm

This behavior works in the 1.3.9 version.
Please, post a little game with the codes, so I will can see whats happen.
Game Editor is an open source game creator software that's wants to pay it's developers to keep evolving.
If you like Game Editor, make a review!
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Re: string loses value between create actor and draw actor

Postby yttermayn » Thu Jan 24, 2008 10:21 pm

I slapped this together using 1.3.9 demo to see if it was a bug that's been fixed since 1.3.5. It still exhibits the same behavior.
Attachments
test.rar
(236.48 KiB) Downloaded 118 times
yttermayn
 
Posts: 48
Joined: Sun Nov 25, 2007 4:10 pm
Score: 2 Give a positive score

Re: string loses value between create actor and draw actor

Postby Freddy » Thu Jan 24, 2008 10:34 pm

Ive noticed before a bug similar to yours.
In the create actor event I went to script editor and typed:
(somevariable) = 1;
Then I made some events and actions for when the variable equaled one. I pressed game mode and noticed that nothing happened that should of happened when the variable was equal to one. I then made a text actor that showed the value of the variable, and when I pressed game mode it was a completely random number somewhere in the thousands. I tried it again, and it was another random number. It was pretty annoying, but I got around it. :D

P.S. You might want to post that demo as a ged file.
Hola
User avatar
Freddy
 
Posts: 548
Joined: Sat Jun 02, 2007 3:42 pm
Location: Why do you want to know?
Score: 14 Give a positive score

Re: string loses value between create actor and draw actor

Postby makslane » Thu Jan 24, 2008 11:11 pm

In the foo -> Create Actor event:

Use:
Code: Select all
strcpy(booger, "lalalalala");


To copy the text (not boogers = "lalalalala")

And you must create the foo actor in some place or change the option "Create at startup" to yes
Game Editor is an open source game creator software that's wants to pay it's developers to keep evolving.
If you like Game Editor, make a review!
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Re: string loses value between create actor and draw actor

Postby yttermayn » Fri Jan 25, 2008 3:49 am

Ok, that works! Also, the foo actor does get created when you press the spacebar. It's a keydown event in the view actor.
yttermayn
 
Posts: 48
Joined: Sun Nov 25, 2007 4:10 pm
Score: 2 Give a positive score


Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest

cron