Page 1 of 1

Just a question

PostPosted: Thu Jan 27, 2011 1:05 pm
by akr
Why does the following not work when its put into a global code function:

strcpy(someactor.text,"debug output");

or

someactor.textNumber=1000;

Any ideas?

thx

Re: Just a question

PostPosted: Thu Jan 27, 2011 1:16 pm
by Game A Gogo
I guess global code gets run before the game starts?
So all actors are reseted afterwards, containing the values you have in the ged

Re: Just a question

PostPosted: Thu Jan 27, 2011 1:53 pm
by akr
I cant get this to work. The global function does nothing but

test()
{
someactor.textNumber=1000;

}

And I call it from another actor's Draw() event. But cant get it to work.


I wanted to have some handy debug printf() functions.

Re: Just a question

PostPosted: Thu Jan 27, 2011 1:56 pm
by Hblade
I have also had the same bug, akr.

I'm thinking it's a glitch within the global code it's self. Try looking at the source code of GE and modding it a bit to get it to work.

My theory:
The global code doesnt "get the text actors" of the game. From what I udnerstand, text actors are far different than normal actors right? Just change the code a bit to get it to work with Text actors too.

Theory 2:
Or perhaps, it's a bug within the string handling.

Re: Just a question

PostPosted: Thu Jan 27, 2011 3:00 pm
by Game A Gogo
you can always use
Code: Select all
void testf(int num)
{
    sprintf(someactor.text,"%d",num);
}

Re: Just a question

PostPosted: Thu Jan 27, 2011 5:22 pm
by akr
Game A Gogo wrote:you can always use
Code: Select all
void testf(int num)
{
    sprintf(someactor.text,"%d",num);
}

Does not work too.

I tried

strcpy(someactor.text, "Hello");

So how do you debug global code? I want to have some debug printf.

Re: Just a question

PostPosted: Thu Jan 27, 2011 5:34 pm
by Game A Gogo
Oh, I didn't test it running on a different actor... here's another way then, I tested it and it works
Code: Select all
void testf(int num)
{
    Actor*tact;
    tact=getclone("someactor");
    tact->textNumber=num;
}

pretty much taking a longer course of action because of the bug...

Re: Just a question

PostPosted: Thu Jan 27, 2011 6:39 pm
by akr
Game A Gogo, thank you very much! This seems to be a great workaround. Will test it soon.

Re: Just a question

PostPosted: Thu Jan 27, 2011 6:51 pm
by Game A Gogo
no problem, I'm sure you would of though about it after a while too :)

Re: Just a question

PostPosted: Thu Jan 27, 2011 7:10 pm
by Hblade
Wow, game! Exelent idead dude! :D