[BUG] Step Macro Entering Room

Chris H.'s Ultima / ACS-style game development system!

Moderators: Ice Cream Jonsey, joltcountry

Admiral Ackguh

[BUG] Step Macro Entering Room

Post by Admiral Ackguh »

For a room-type region: The step macro does not fire when entering an overlap zone to a different room. If I have two overlapping rooms, and I enter the overlap zone, I end up in the other room, but the step macro won't fire. It should, because this movement is an action.

I don't know if this is a bug or not, but it's causing me some trouble. My step macro detects entering of a new room (by comparing LOC[RM] with variable R2 then setting R2 to LOC[RM]) and it should work on the exact step when I go to another room, not the step after. (What ACK really needs is a region-level macro that fires on room entrance, hint hint...)

One idea that might work would be for me to go through my room maps, and use terrain objects with pass macros for all overlap areas. This macro could keep track of room changes and do the necessary housekeeping.

- A:A:

User avatar
pinback
Posts: 17672
Joined: Sat Apr 27, 2002 3:00 pm
Contact:

Post by pinback »

I read the title of this thread as [DUB] Step... and was hoping for a sick drop.
I don't have to say anything. I'm a doctor, too.

User avatar
Garth's Equipment Shop
Posts: 638
Joined: Fri Dec 05, 2008 5:55 pm
Location: Festering Foothills
Contact:

Post by Garth's Equipment Shop »

yeah room level options in addition to region level options would make a lot of sense and an extremely powerful new tool!

Admiral Ackguh

Post by Admiral Ackguh »

Pinback: Sick drop? Is that like a death drop? :)

Garth: It doesn't even have to be a separate macro for each room. The region could have a common "Enter Room" macro which can test LOC[RM] for specfic actions per room.

- A:A:

User avatar
Garth's Equipment Shop
Posts: 638
Joined: Fri Dec 05, 2008 5:55 pm
Location: Festering Foothills
Contact:

Post by Garth's Equipment Shop »

pinback wrote:I read the title of this thread as [DUB] Step... and was hoping for a sick drop.
You already got a thread for that Mr.!

rld
Posts: 223
Joined: Sun Jan 25, 2009 2:17 am
Location: Dallas, TX

Re: [BUG] Step Macro Entering Room

Post by rld »

Admiral Ackguh wrote:For a room-type region: The step macro does not fire when entering an overlap zone to a different room. If I have two overlapping rooms, and I enter the overlap zone, I end up in the other room, but the step macro won't fire. It should, because this movement is an action.
I may take a look at this for the next patch, when I have a chance to do another update.

The trick here is that the overlap zone is in both rooms, so for example when does LOC[RM] update? I am guessing that it corresponds to whatever room is currently displayed on the screen, but I'm not 100% sure on that.

From what I remember, if you are in an overlap between two rooms, and you tap the direction keys back and forth, you can switch your 'view' back and forth between the two rooms, and doing so does not count as an action, since you are staying in the same tile location, and just switching your view.

If the step macro fires on a room transition, however, you run into the issue of when should it fire? Because if you are counting the entry to the new room as an action, logically you should count the last 'step' before you leave your existing room as an action too...so should it fire once after you step on the overlap zone (before you leave the old room), and then once after you arrive in the new room?

Another issue (that I have bumped into before) is that if you jump to another room using a portal, the step macro doesn't fire after you land in the room. The player has to take an action in the new room before the step macro will fire.

You might be able to work around this by using the 'queue action' macro command along with the hack I added to 'MOVE PLAYER IN x DIRECTION' to force a turn pass after the player arrives in the new room (having the portal execute a macro before the player leaves).

I am assuming that portal macros execute *before* the player jumps to the other end of the portal, not after; I haven't tested this I think. Similarly, I don't know if you queue actions in a portal macro if they get executed before or after the player arrives in the new room.

One possible solution to all of this is to use spaces as room exits, instead of room edges or portals. If you lay all 16 rooms in your room region out in a 4x4 grid (which to my aggravation means that you cannot make them the maximum 16x11 size unless they overlap - maybe not even then, I can't remember), and they are all the same shape, you could have 'EAST EXIT', 'WEST EXIT', etc. spaces that run macros that 'jump' the player to the next room. You would need to lay out the rooms in the same order each time, like
01 02 03 04
05 06 07 08
09 10 11 12
13 14 15 16

and then, for example, to go one room east, you just do:
LOC[RM] = LOC[RM] + 1
LOC[X] = 2

This way, you can always trigger a 'leaving the room' macro if you want, and if the 'pass a turn' can be triggered on arrival to the new room as noted above, you can use that step macro to compare LOC[RM] and do an 'arriving in new room' macro as well.

Another interesting idea would be to have a macro-configurable 'player attempts to walk off edge of room' macro; instead of making the rooms overlap each other or using portals/macros to transition the player, the 'edge detect' macro would just fire when the player tried to exit the room, and would move the player to a new room accordingly. The 'D' direction variable patch feature could be used to tell the macro which way the player was attempting to go.

The interesting thing about this idea is that you could change around room connections on the fly, or do things like wrap the player around from one edge of the room to the other, if that was useful.

When you 'jump' the player from one room to the other (and don't use overlap zones), you do have the issue of not knowing what the player is 'walking into'. The overlap zones, I think, were designed to solve this issue by loading up the new room and displaying it before allowing the player to step into it, as opposed to a portal which will just happily plop the player down on whatever is at the other end, regardless of whether the player could normally enter that square. Of course, this could be a feature depending on what you are trying to do...

Admiral Ackguh

Re: [BUG] Step Macro Entering Room

Post by Admiral Ackguh »

The trick here is that the overlap zone is in both rooms, so for example when does LOC[RM] update? I am guessing that it corresponds to whatever room is currently displayed on the screen, but I'm not 100% sure on that.
I tested it, and it does just that. LOC[RM] is the room currently on screen.
From what I remember, if you are in an overlap between two rooms, and you tap the direction keys back and forth, you can switch your 'view' back and forth between the two rooms, and doing so does not count as an action, since you are staying in the same tile location, and just switching your view.
This is an entirely different action from what I mentioned.

1) When you enter an overlap zone, you enter the new location, and the system switches view to the new room. It does not fire the step macro, as it should. This is what I mentioned before.

2) When you are already in the overlap zone, and you try to move off-screen, you don't move at all, but the view switches to the new room anyway. As you said, there is no movement, so the step macro shouldn't fire.
If the step macro fires on a room transition, however, you run into the issue of when should it fire? Because if you are counting the entry to the new room as an action, logically you should count the last 'step' before you leave your existing room as an action too...so should it fire once after you step on the overlap zone (before you leave the old room), and then once after you arrive in the new room?
Good point. I tend to see "steps" as user actions. Which comes to my other point of a specific room-change event with its own macro, separate from the step macro.
Another issue (that I have bumped into before) is that if you jump to another room using a portal, the step macro doesn't fire after you land in the room. The player has to take an action in the new room before the step macro will fire.
True as well, though not relevant to my situation.
One possible solution to all of this is to use spaces as room exits, instead of room edges or portals. If you lay all 16 rooms in your room region out in a 4x4 grid ... and they are all the same shape, you could have 'EAST EXIT', 'WEST EXIT', etc. spaces that run macros that 'jump' the player to the next room.
That would work; and provide more programmatic control over the inter-room movements than either portals or overlapping rooms.
The 'D' direction variable patch feature could be used to tell the macro which way the player was attempting to go.
I haven't heard of this feature; i still use basic ACK v3.2. Does this D variable patch work the way LASTMOV is supposed to?

As for my original problem, I have already found a solution. I went through all the relevant regions, and replaced all passable terrain in overlap zones with special terrain objects with passing macros. These are duplicates of normal terrain. I just had to duplicate the following terrain objects, and add pass macros:

WOOD FLOOR, CONCRETE FLOOR, CARPET

Note that I could have just added the macros to the original objects and put it code to fire only if LOC[RM] <> saved RM. That works, but since that terrain is heavily used elsewhere, makes it slow for the user. Any sort of pass macro, no matter how small, takes time to load and execute - making it unsuitable for normal ground terrain. For doors, I simply added the macros. Opening and moving through a door is supposed to take a little time anyway.

In all, it works, and I am (so far) pleased with my solution.

- A:A:

Post Reply