April 26, 2024, 07:22:07 PM
Welcome,
Guest
Please
login
or
register
.
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
News:
Latest WME version:
WME 1.9.1
(January 1st, 2010) -
download
Home
Help
Search
Calendar
Login
Register
Wintermute Engine Forum
>
Wintermute Engine
>
Technical forum
>
Topic:
Object referencing
« previous
next »
Pages: [
1
]
Print
Author
Topic: Object referencing (Read 3083 times)
0 Members and 1 Guest are viewing this topic.
raychaser
Lurker
Karma: 0
Offline
Posts: 16
Object referencing
«
on:
August 16, 2007, 05:15:40 PM »
Having trouble phrasing my question. Maybe I'll give an example.
An script I have gets passed a string which corresponds to the name of an actor in a particular scene. This may be the main actor or an NPC. I want to take that string and from it find the actor's X and Y coordinates. Sounds simple...
As I see it this involves two problems:
How do I reference an actor object given only a string corresponding to the object name? I believe standard javascript can do something like this[str] or document[str] but I'm not sure if that is possible here.
Is it possible to find actors based on the scene that they are in like scene[actor] or something? The reason I ask is that each scene will have different actors and I don't want to have to declare ALL of them as global variables in every script or in global.inc since there will likely be a lot of them and keeping track of them in multiple places is a pain. The NPCs will be defined in scene_init.script for each scene but the function I'm trying to use is located in the root scripts location.
Does this make any sense?
Logged
Mnemonic
WME developer
Administrator
Addicted to WME forum
Karma: 41
Offline
Gender:
Posts: 5683
Re: Object referencing
«
Reply #1 on:
August 19, 2007, 12:06:26 PM »
You'd need to store the actors in some array, if you want to enumerate them later. You could even store them under their name, something like:
actors_array["joe"] = Game.LoadActor("path\joe.actor");
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum.
Print
Pages: [
1
]
« previous
next »
Wintermute Engine Forum
>
Wintermute Engine
>
Technical forum
>
Topic:
Object referencing