Wintermute Engine Forum

Wintermute Engine => Technical forum => Topic started by: Unmasked on February 24, 2006, 12:45:18 AM

Title: Problem with actor.GoTo
Post by: Unmasked on February 24, 2006, 12:45:18 AM
Hello!
Standart way to walk actor to point in scene is

on "LeftClick"
{
  actor.GoTo(Scene.MouseX, Scene.MouseY);
}

It's work nice.

Look at this code:

global last_mouse_click_x;
global last_mouse_click_y;

on "LeftClick"
{
  last_mouse_click_x=Scene.MouseX;
  last_mouse_click_y=Scene.Mousey;

  actor.GoTo(last_mouse_click_x, last_mouse_click_y);
}

Why it's not working? Please help me.
Title: Re: Problem with actor.GoTo
Post by: Columbo on February 24, 2006, 05:13:10 AM

global last_mouse_click_x;
global last_mouse_click_y;

on "LeftClick"
{
  last_mouse_click_x=Scene.MouseX;
  last_mouse_click_y=Scene.Mousey;

  actor.GoTo(last_mouse_click_x, last_mouse_click_y);
}

Why it's not working? Please help me.


I'm not a great scripter, but the only thing I can see that is maybe wrong is that the Scene.MouseY has the Y in lowecase, whereas the Scene.MouseX is in uppercase. Since your original code worked fine, I would say try just making Scene.MouseY with an uppercase Y. I don't know if this will help or even if the methods are case sensitive, but it's always worth a try. Maybe someone else knows why it's not working?  ???

The best way to troubleshoot this sort of thing is to write the values of the variables out in game.msg and see what is in each variable. If X is ok, but Y is not, then you know the Y variable is not being given a value, which is usually attributed to a typographical error. Good luck.
Title: Re: Problem with actor.GoTo
Post by: Mnemonic on February 24, 2006, 07:55:09 AM
Yes, Columbo is right. Change Mousey to MouseY and it should work. Method and attribute names in WME are case-sensitive.
Title: Re: Problem with actor.GoTo
Post by: Unmasked on February 24, 2006, 10:03:09 AM
Oh, of course! I'm an idiot! After midnight brain work not correct, so I made this mistake like a schoolboy. Thanks!
Title: Re: Problem with actor.GoTo
Post by: Columbo on February 25, 2006, 03:41:04 AM
I am so smart!  ;D