Page 1 of 1

how would this work?

PostPosted: Mon Mar 28, 2011 6:46 pm
by sonicfire
hi fellaz! :)

in my actor´s creation event i have "Actor *theleg;" for example.
HOW can i access this pointer in the actor´s draw event?

For example:

Code: Select all
    theleg->x = blabla;




The problem is that the variable "theleg" somehow doesn´t exist in the drawevent.
But i cant make it global using code since i need it for any actor seperately.
Hope my post makes sense. Any help / ideas ? :)

Thanks in advance!

Re: how would this work?

PostPosted: Mon Mar 28, 2011 8:04 pm
by Game A Gogo
put the "Actor *Myactor;" in the global code. Variables declared INSIDE a script will only exist INSIDE the specific script!

Re: how would this work?

PostPosted: Tue Mar 29, 2011 2:51 pm
by sonicfire
Ah :shock: Makes sense! So you mean i would just do a global code script only with e.g. "Actor *xyz;" in it?
What would i need to call it? Do i have to call this script simply in my actor then?

Thanks!

Re: how would this work?

PostPosted: Tue Mar 29, 2011 3:12 pm
by schnellboot
sonicfire wrote:Ah :shock: Makes sense! So you mean i would just do a global code script only with e.g. "Actor *xyz;" in it?
What would i need to call it? Do i have to call this script simply in my actor then?

Thanks!

you don't have to make a single script for that
just paste it somewhere in global code

Re: how would this work?

PostPosted: Wed Mar 30, 2011 6:26 am
by sonicfire
will give it a try , thanks! :)

Re: how would this work?

PostPosted: Wed Mar 30, 2011 6:31 am
by rykein
schnellboot wrote:
sonicfire wrote:Ah :shock: Makes sense! So you mean i would just do a global code script only with e.g. "Actor *xyz;" in it?
What would i need to call it? Do i have to call this script simply in my actor then?

Thanks!

you don't have to make a single script for that
just paste it somewhere in global code

global code is still made up of scripts. but you never call a global script. just functions declared in teh script.

Re: how would this work?

PostPosted: Wed Mar 30, 2011 8:24 am
by schnellboot
in global code you can put in functions or just declarations

Re: how would this work?

PostPosted: Wed Mar 30, 2011 8:32 am
by rykein
yeah...... i know. didnt say anything to disagree with that. the fact of the matter is that you do need to make a script in global code because global code is a place to make a bunch of global scripts. but in this case all it is is a single declaration.

Re: how would this work?

PostPosted: Wed Mar 30, 2011 8:37 am
by schnellboot
ahh alright