polygone
|
 |
Posted on: February 27, 2011, 08:17:43 pm |
|
|
 Location: England Joined: Mar 2009
Posts: 794
|
inline void action_move_to(double x, double y) { enigma::object_planar* const inst = ((enigma::object_planar*)enigma::instance_event_iterator->inst); if (argument_relative) { inst->x += x; inst->y += y; } else { inst->x = x; inst->y = y; } } How the fuck does relative work? It isn't specified as an argument in gml....
|
|
« Last Edit: March 02, 2011, 12:13:39 am by polygone »
|
Logged
|
I honestly don't know wtf I'm talking about but hopefully I can muddle my way through.
|
|
|
|
|
|
|
polygone
|
 |
Reply #5 Posted on: February 28, 2011, 12:03:54 am |
|
|
 Location: England Joined: Mar 2009
Posts: 794
|
I meant when using action_ functions. In gml the relative argument doesn't seem to be used..
|
|
|
Logged
|
I honestly don't know wtf I'm talking about but hopefully I can muddle my way through.
|
|
|
|
|
polygone
|
 |
Reply #8 Posted on: March 01, 2011, 11:50:28 pm |
|
|
 Location: England Joined: Mar 2009
Posts: 794
|
So I see, you would work relative like so EDL:
argument_relative = true; action_move_to(4, 4); Should use the action relative. This I presume would actually work in gml however it doesn't allow you to set the argument_relative variable.
Calling plain as:
action_move_to(4, 4); Should always use the action not relative. This means that the argument_relative variable should always be set false after an action is called.
|
|
|
Logged
|
I honestly don't know wtf I'm talking about but hopefully I can muddle my way through.
|
|
|
IsmAvatar
|
 |
Reply #9 Posted on: March 02, 2011, 12:21:40 am |
|
|
LateralGM Developer
 Location: Pennsylvania/USA Joined: Apr 2008
Posts: 877
|
Yes, that's exactly the way it works. In fact, at one point I had forgotten to reset argument_relative, so we had a bug, but it has since been fixed. Actually, the way we handle it is to *always* set argument_relative prior to any action that allows relative. Maybe not the most efficient, but I don't think DND users are going to complain about an additional variable set before some DND actions.
However, as TGMG has pointed out, using an IF action before a relative action causes a problem with this conversion method: * If Action * Set Motion Relative
gets converted to:
if (blah) argument_relative = blah; action_set_motion(blah); Even though action_set_motion should belong to the if statement. Solved by either:
if (blah) { argument_relative = blah; action_set_motion(blah); or
if (blah) action_set_motion(blah,argument_relative_value);
|
|
« Last Edit: March 02, 2011, 12:23:16 am by IsmAvatar »
|
Logged
|
|
|
|
|
|
polygone
|
 |
Reply #12 Posted on: March 02, 2011, 11:40:32 am |
|
|
 Location: England Joined: Mar 2009
Posts: 794
|
So it needs to keep track of where to actually close the '{' for action_if's (that have the relatvie checkbox) which is much more complex than passing the value in by the argument. Can't you put the closing brace in then move back up into the statements?
|
|
|
Logged
|
I honestly don't know wtf I'm talking about but hopefully I can muddle my way through.
|
|
|
|
|
|