Please login or register.

Login with username, password and session length
Advanced search  

News:

Forum rules - please read before posting, it can save you a lot of time.

Author Topic: Events in attached scripts  (Read 2929 times)

0 Members and 1 Guest are viewing this topic.

robot

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 38
    • View Profile
Events in attached scripts
« 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?
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Events in attached scripts
« Reply #1 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.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

robot

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 38
    • View Profile
Re: Events in attached scripts
« Reply #2 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  ???
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Events in attached scripts
« Reply #3 on: November 14, 2008, 03:39:26 PM »

You're attaching the script to Game. It should be:

this.AttachScript("blah blah");
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

robot

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 38
    • View Profile
Re: Events in attached scripts
« Reply #4 on: November 14, 2008, 04:34:24 PM »

oh thanks a lot. i think i'm working to long on it...
Logged
 

Page created in 0.046 seconds with 23 queries.