Please login or register.

Login with username, password and session length
Advanced search  

News:

This forum provides RSS feed. To query recent posts use this url. More...


Author Topic: Reading the target coordinates  (Read 5618 times)

0 Members and 1 Guest are viewing this topic.

Amo

  • Supporter
  • Regular poster
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 206
    • View Profile
    • Sunrise The Game
Reading the target coordinates
« on: July 09, 2007, 10:05:30 PM »

Hi Folks,

is there any way to get out of WME the following information:
When clicking somewhere in the scene, WME does know, if the actor needs to walk, or not.
When he needs to walk, he needs the correct target coordinates, right?
Is it possible to catch these coordinates?

metamorphium

  • Global Moderator
  • Addicted to WME forum
  • *
  • Karma: 12
  • Offline Offline
  • Gender: Male
  • Posts: 1511
  • Vampires!
    • View Profile
    • CBE  software s.r.o.
Re: Reading the target coordinates
« Reply #1 on: July 09, 2007, 10:42:05 PM »

of course. Actually it's not hidden information. If you click in the scene, the scene.script gets called, which contains

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

so to make long story short, Scene.MouseX and Scene.MouseY is what you're looking for.
Logged
J.U.L.I.A. Enhanced Edition, Vampires!, J.U.L.I.A., J.U.L.I.A. Untold, Ghost in the Sheet

Amo

  • Supporter
  • Regular poster
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 206
    • View Profile
    • Sunrise The Game
Re: Reading the target coordinates
« Reply #2 on: July 09, 2007, 10:48:52 PM »

Hi Meta,

thats a starting point, but not really what I am looking for. Hm, hard to describe for me...

When clicking somewhere, lets say 800, 400
and the script starts, as it recognizes, that the actor has to move now, we need the information, that
the leftclick method is running and directing the actor to 800, 400.
In short: We need the values, in this case 800, 400

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Reading the target coordinates
« Reply #3 on: July 10, 2007, 07:44:28 AM »

That's what meta said. Those are the mouse coordinates at the time of the click, i.e. the target point.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

metamorphium

  • Global Moderator
  • Addicted to WME forum
  • *
  • Karma: 12
  • Offline Offline
  • Gender: Male
  • Posts: 1511
  • Vampires!
    • View Profile
    • CBE  software s.r.o.
Re: Reading the target coordinates
« Reply #4 on: July 10, 2007, 08:12:11 AM »

Amo: it's very easy and that's why I've directed you to that file. In scripts/scene.script you modify this LeftClick method so it will also make the task you requested. So this is the point where you'll get the coordinates

In your case Scene.MouseX will return 800 and Scene.MouseY will return 400 and you know that the scene was clicked and actor is going there
There are two ways how to approach the solution - Either modify this method to your liking which as a trap - if you click on region, this won't get triggered, or make a daemon script and use global variable for determining if this particular LeftClick was pressed.

Logged
J.U.L.I.A. Enhanced Edition, Vampires!, J.U.L.I.A., J.U.L.I.A. Untold, Ghost in the Sheet

Amo

  • Supporter
  • Regular poster
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 206
    • View Profile
    • Sunrise The Game
Re: Reading the target coordinates
« Reply #5 on: July 10, 2007, 09:46:33 AM »

So it is possible e.g. to print then 800, 400 on the screen via Game message?
And the next thing: Is this working also with goto.object this?

regards

Martin

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Reading the target coordinates
« Reply #6 on: July 10, 2007, 09:54:53 AM »

What exactly do you need it for anyway? If you need to trap all GoTo calls, you can as well write your own GoTo() method.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

Amo

  • Supporter
  • Regular poster
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 206
    • View Profile
    • Sunrise The Game
Re: Reading the target coordinates
« Reply #7 on: July 10, 2007, 10:06:39 AM »

Yes of course we can, but the raw scripting of all game scenes is complete, means the actor can interact with all objects. Changing all these methods to new would take days.

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Reading the target coordinates
« Reply #8 on: July 10, 2007, 10:28:27 AM »

Well... no, not really. The point of overriding built-in methods is to be able to only do it in one place only.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

Amo

  • Supporter
  • Regular poster
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 206
    • View Profile
    • Sunrise The Game
Re: Reading the target coordinates
« Reply #9 on: July 10, 2007, 10:40:49 AM »

Which means if we want to override the goto.this method, we would have to change it in all scenes vor every object? Damn, what a pity, so the idea behind all this stuff is useless, as we do not have the time...

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Reading the target coordinates
« Reply #10 on: July 10, 2007, 10:52:34 AM »

If you override the built-in GoTo method by writing your own implementation in actor's script, then ALL the GoTo calls in the entire game will be routed to this overridden method.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

Amo

  • Supporter
  • Regular poster
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 206
    • View Profile
    • Sunrise The Game
Re: Reading the target coordinates
« Reply #11 on: July 10, 2007, 11:10:16 AM »

So... there must be one implementation in the actorscript? Never thought about it, as there is no goto method in that script.

metamorphium

  • Global Moderator
  • Addicted to WME forum
  • *
  • Karma: 12
  • Offline Offline
  • Gender: Male
  • Posts: 1511
  • Vampires!
    • View Profile
    • CBE  software s.r.o.
Re: Reading the target coordinates
« Reply #12 on: July 10, 2007, 11:22:42 AM »

because it's not overriden yet. :)

your actor.script could look like this:

#include "base.inc"

method GoTo(x,y)
{
  //   Do whatever you want with those coordinates.
   this.GoTo(x,y); //and call the original method
}

very similar would be GoToObject logic.

Logged
J.U.L.I.A. Enhanced Edition, Vampires!, J.U.L.I.A., J.U.L.I.A. Untold, Ghost in the Sheet

Amo

  • Supporter
  • Regular poster
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 206
    • View Profile
    • Sunrise The Game
Re: Reading the target coordinates
« Reply #13 on: July 10, 2007, 11:38:59 AM »

OK, that overriding sounds interesting.

thanks for the answers.
 

Page created in 0.038 seconds with 20 queries.