Please login or register.

Login with username, password and session length
Advanced search  

News:

For WME related articles and tutorials visit WME Resource Center.

Author Topic: newbie question  (Read 4840 times)

0 Members and 1 Guest are viewing this topic.

blmw911

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 7
    • View Profile
newbie question
« on: February 07, 2005, 01:23:50 PM »

Hi,

while reading the help file, I was confused about this part:

Custom methods and objects
"You cannot override the engine defined methods, ..." but also

"You can also override the engine built-in methods, ..."

Which one is right?
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: newbie question
« Reply #1 on: February 07, 2005, 02:09:05 PM »

Ahem, oops. The second one is right, you CAN override the built-in methods. The first sentence is a remnant from an older WME version, which I forgot to remove. I'll fix it for the next release.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

blmw911

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 7
    • View Profile
Re: newbie question
« Reply #2 on: February 07, 2005, 05:33:00 PM »

Ok, thx.

I tried to override the "LoadEntity" method of the game and scene object.
therefore I wrote:
Code: [Select]
method LoadEntity(Filename)
{
Game.LOG("loadentity, game");
var result;
result = this.LoadEntity(Filename);
result.AttachScript("scripts\entity.script");
return result;
}
into the game.script / scene.script.

But I didn't get a LOG entry.

Whats wrong?

Or is there an easier way to attach a script file to all entities?
Logged

blmw911

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 7
    • View Profile
Re: newbie question
« Reply #3 on: February 07, 2005, 09:49:47 PM »

Quote
Or is there an easier way to attach a script file to all entities?

I think that I found the solution myself:
It is easier to use templates instead of attaching a script file to all entities.
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: newbie question
« Reply #4 on: February 08, 2005, 08:55:04 AM »

But I didn't get a LOG entry.

Whats wrong?
You'd get the log only if you called LoadEntity explicitly in your scripts. Scene entities loaded by the engine don't call this method internally.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

blmw911

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 7
    • View Profile
Re: newbie question
« Reply #5 on: February 11, 2005, 03:33:49 AM »

Now, I've another problem.

Is it posible to store a reference of an object in a global variable?

Or is a reference to an object only for the "this" operator available.


Because I'm trying to code some sort of callback function.


And THX for your help, WME is really a great engine.
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: newbie question
« Reply #6 on: February 11, 2005, 08:59:09 AM »

Yes, it's possible. But you should be careful about the objects' lifetime (objects created by scene get destroyed when changing to another scene etc.)
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave
 

Page created in 0.036 seconds with 24 queries.