Possible to hook into mapper rightclick menu?

All and any discussion and development of the Mudlet Mapper.
User avatar
chris
Posts: 493
Joined: Fri Jun 17, 2011 5:39 am

Re: Possible to hook into mapper rightclick menu?

Post by chris »

I added user hooks in my latest repo update. If you can compile, you can toy around with custom merges/whatever your heart desires. It can't do things like detect rooms dropped on one another, but it'll let you select individual rooms or many rooms and do fun things with them. As for exit stubs, I explain how they work in my repository post as well.

User avatar
Vadi
Posts: 5035
Joined: Sat Mar 14, 2009 3:13 pm

Re: Possible to hook into mapper rightclick menu?

Post by Vadi »

Works, nice stuff. You call addMapEvent("menu entry name", "event name to be raised"), and when the entry is clicked, it'll raise an event with the selected room / rooms highlighted as a list of arguments.

InTheWorks
Posts: 18
Joined: Sat Sep 10, 2011 7:37 am

Re: Possible to hook into mapper rightclick menu?

Post by InTheWorks »

chris wrote:If you can compile, you can toy around with custom merges/whatever your heart desires. It can't do things like detect rooms dropped on one another, but it'll let you select individual rooms or many rooms and do fun things with them.
I'll take a peek when I have time to compile (might not be for a few days).

Can someone explain though how I would go about selecting the rooms in such a way that I know which is the "room to merge" vs the "room to merge into"? Is the selection order maintained in a list?

User avatar
Vadi
Posts: 5035
Joined: Sat Mar 14, 2009 3:13 pm

Re: Possible to hook into mapper rightclick menu?

Post by Vadi »

You can only select by dragging a rectangle, so there is no set order. I'd recommend dragging rooms into a single location, then merging them.

User avatar
chris
Posts: 493
Joined: Fri Jun 17, 2011 5:39 am

Re: Possible to hook into mapper rightclick menu?

Post by chris »

You can also select via the right click Vadi, it returns the single room you highlighted. Though this is useless for merging :). However, a general drag and drop for merges I think is a bad idea since sometimes you want to stack rooms on top of eachother, at least I have.

User avatar
Vadi
Posts: 5035
Joined: Sat Mar 14, 2009 3:13 pm

Re: Possible to hook into mapper rightclick menu?

Post by Vadi »

I meant for multiple selection, its via a rectangle

InTheWorks
Posts: 18
Joined: Sat Sep 10, 2011 7:37 am

Re: Possible to hook into mapper rightclick menu?

Post by InTheWorks »

chris wrote:However, a general drag and drop for merges I think is a bad idea since sometimes you want to stack rooms on top of eachother, at least I have.
I'm curious, but why would you want to stack rooms on top of each other? If they're occupying the same space, aren't they the same room? Otherwise, how do you:

1. select the room
2. speedwalk to the room

If it's easy to do the drag and drop and the only resistance to making the change is to keep the old behaviour, why not add a switch that users can set via their mapping script? Something settable with setMapVar? Maybe setMapVar("allowRoomMerges", 1)? Set the default to 0 and everyone's happy?

Multiple selections for merging is not helpful unless it's obvious which room to keep and which room to delete. If drag and drop won't happen, then an alternative method could be done using the right click menu and 3 events:

addMapEvent("Merge into this room", "event1")
addMapEvent("Merge this room", "event2")
addMapEvent("Abort merge", "event3")

but then it would be nice to grey out the "Merge into this room" when a room has been selected. And make the "Merge this room" and "Abort merge" inactive until "Merge into this room" has been selected. Is it possible to set an active/inactive property for a menu item via script?

User avatar
Vadi
Posts: 5035
Joined: Sat Mar 14, 2009 3:13 pm

Re: Possible to hook into mapper rightclick menu?

Post by Vadi »

Can't activate/deactivate them yet, it doesn't carry that status. I'm sure that could be added, that that would require scripts to check at runtime as to whenever it should be enabled/disabled?

User avatar
chris
Posts: 493
Joined: Fri Jun 17, 2011 5:39 am

Re: Possible to hook into mapper rightclick menu?

Post by chris »

. I just need to add the remove map event and you can toggle it that way.

InTheWorks
Posts: 18
Joined: Sat Sep 10, 2011 7:37 am

Re: Possible to hook into mapper rightclick menu?

Post by InTheWorks »

Vadi wrote:Works, nice stuff. You call addMapEvent("menu entry name", "event name to be raised"), and when the entry is clicked, it'll raise an event with the selected room / rooms highlighted as a list of arguments.
I've hooked up an event and handler, but how do I access this list of arguments? I've got:
Code: [show] | [select all] lua
function test(event, list)
  echo("\nmyTestEvent\n")
  display(list)
end
but I only ever see one room (the lowest room id) while I'm expecting to see a table. Or perhaps I'm making a bad assumption. Is "list of arguments" more like:

function test(event, room1, room2, ... , roomN)

but then how to get all of the rooms?

Post Reply