31
Technical forum / Referencing entities within a scene.
« on: August 22, 2006, 08:33:00 AM »
I am currently defining global vars in base.inc which makes them visible in all scripts in the game. These global vars are then set to specific items that need to be turned on and off through the game. For example if I have an apple that can be placed on a desk, and the apple is an item. I can use apple on desk. In the apple script I set some global var that could be named AppleRef to "this', i.e. AppleRef = this; within the apple script. Therefore since the apple is off by default when I am in desk.script and I use the apple, in on "apple" I can do AppleRef.Active = true; and the apple would appear (this is hypothetical and not the actual situation I'm using in game but the example is basically the same).
Is there a better way of doing this rather than tracking everything through global vars? I have not found anything in the documentation to suggest there is an easier way to do this. I imagine I could use paths such as "scenes\testcene\apple.entity" if there was such a thing but I have found nothing to suggest this. Just want to know if this is on the right track or if there is a better way. Thanks again!
Is there a better way of doing this rather than tracking everything through global vars? I have not found anything in the documentation to suggest there is an easier way to do this. I imagine I could use paths such as "scenes\testcene\apple.entity" if there was such a thing but I have found nothing to suggest this. Just want to know if this is on the right track or if there is a better way. Thanks again!