Feature suggestion: Add ability to mak coordinates using the visual editor

Started by artium, Tue 19/12/2017 19:27:25

Previous topic - Next topic

artium

If I want a character to walk to a specific location in the room using script, I need to use the mouse pointer to find the coordinates, then I can write a script command similar to:

Code: ags

cEgo.Walk(14, 22);


or better:

Code: ags

int ladderX = 14;
int ladderY = 22;
cEgo.Walk(ladderX, ladderY);


To demonstrate that this is not just my noobish ignorance of a better way, here is an example from Dave Gilbert's Unavowed devstream #4 - Doors doors doors doors doors:



(the culprit is "player.placeAt(382,294);" )

I think that it would be nice if one could mark a coordinate on the screen, give it a name and use the name in script, similar to how regions, walk able areas etc. work.



This will be more intuitive, more maintainable and possibly prevent some mistakes.

Code: ags

cEgo.Walk(coordLadder.x, coordLadder.y);


or even

Code: ags

cEgo.Walk(coordLadder);

Crimson Wizard

Quote from: artium on Tue 19/12/2017 19:27:25
To demonstrate that this is not just my noobish ignorance of a better way, here is an example from Dave Gilbert's Unavowed devstream #4 - Doors doors doors doors doors

Dave Gilbert is a n00b, it was noticed on several occasions that he is not aware of some features from AGS that make things easier :D

Seriously, though, this is a valid feature suggestion, and frankly pretty old one. I may be mistaken, but I think someone even did an Editor plugin for Points. Or maybe that was special Editor version... I cannot find it on forums though.


In the meanwhile, ways to make life tad simplier:
1. Middle mouse button click in the room editor brings context menu with "Copy coordinates" command, which copies coordinates in "X, Y" format, ready to be pasted into Walk function.
2. Expanding the "int ladderX, ladderY" example, since AGS 3.4.0 it is possible to write managed Point class, declare your own Point objects in room script and use these. The remaining inconvenience will be that you won't be able to see and manipulate them in room editor, but at least you will have named points.

Dummy example:
Code: ags

// in the script module:
managed struct Point
{
  int x;
  int y;
};

// in room script
Point *WhereToGo;

function Room_Load()
{
    WhereToGo = new Point;
    WhereToGo.x = ...;
    WhereToGo.y = ...;
}

function SomeInteraction()
{
    player.Walk(WhereToGo.x, WhereToGo.y);
}

eri0o

I like this idea, please don't destroy the points if the background is replaced by one that is 2 pixels bigger.

Crimson Wizard

Quote from: eri0o on Tue 19/12/2017 20:34:42
please don't destroy the points if the background is replaced by one that is 2 pixels bigger.
This sounds like a separate suggestion for hotspots and walkable areas :).


SMF spam blocked by CleanTalk