Wintermute Engine Forum

Wintermute Engine => Technical forum => Topic started by: robot on November 14, 2008, 02:39:35 PM

Title: Events in attached scripts
Post by: robot on November 14, 2008, 02:39:35 PM
i have a question and i don't know if this is a bug or not:

ok, there is a script attached to an object in the scene editor.
in this script there is another script attached (with the attachScript method). i have implemented a on "talk" event there.

now my problem is that ....this.CanHandleEvent("Talk").... in the first script gives me false.
i thought wme is script multitasking or is it only possible to handle the events in only one script (which is applied in the scene editor)
you know what i mean?
Title: Re: Events in attached scripts
Post by: Mnemonic on November 14, 2008, 03:01:33 PM
If you call CanHandleEvent before attaching the other script, it will return false. But once the other script is attached, it should return true.
Title: Re: Events in attached scripts
Post by: robot on November 14, 2008, 03:24:06 PM
this is the code for the first script:

Code: [Select]
#include "scripts\base.inc"

Game.AttachScript("scenes\04_wegweiser\scr\zelt_talk.script");
Game.Msg(this.CanHandleEvent("Talk"));

on "LookAt"
{
 ...


the second one (zelt_talk.script)

Code: [Select]
#include "scripts\base.inc"


////////////////////////////////////////////////////////////////////////////////

on "Talk"
{
  ...
}


the CanHandleEvent gives me still false  ???
Title: Re: Events in attached scripts
Post by: Mnemonic on November 14, 2008, 03:39:26 PM
You're attaching the script to Game. It should be:

this.AttachScript("blah blah");
Title: Re: Events in attached scripts
Post by: robot on November 14, 2008, 04:34:24 PM
oh thanks a lot. i think i'm working to long on it...