Page 1 of 1

passing selected rooms on map to a script?

Posted: Fri Aug 08, 2014 7:19 pm
by reyl
I was wondering - is there any way to access the list of rooms that have been selected visually on the map screen from our own scripts? Like, so I can drag-select some rooms with the mouse then use an alias to walk to each of the selected rooms, for example?

Re: passing selected rooms on map to a script?

Posted: Wed Aug 13, 2014 1:49 am
by SlySven
I don't think you can currently capture that list, but I agree it would be a useful thing to have.

From a coder's viewpoint I think you would need to add a map context menu (right click) item - which can be done by the user and use that to call a, as unwritten yet, built-in lua function that would return the current map room selection widget content. This would only work on the 2D map but then nothing is perfect.

Re: passing selected rooms on map to a script?

Posted: Wed Aug 13, 2014 10:55 pm
by SlySven
I was wrong - you CAN do that, but I don't yet fully understand how. Though it does sort of follow the outline I gave before. Apparently the current list of selected rooms is something that get passed to any user action that is put onto that mapper context menu (right-click) with the addMapEvent() function. I'm trying to put together an outline of how it is done but it seems a function you declare and assign as a UserEventHandler gets called and the fourth and subsequent arguments are the rooms in the list - I don't fully understand enough about Lua to see how such a "vararg" function can be constructed to recover a lua table from that - perhaps someone with more skill in that area would like to comment?

Re: passing selected rooms on map to a script?

Posted: Sun Aug 17, 2014 4:18 pm
by Silvine

Re: passing selected rooms on map to a script?

Posted: Sun Aug 17, 2014 10:11 pm
by SlySven
By Jove, that's it! Somebody give that man(?) a sock filled to the brim with custard...

Re: passing selected rooms on map to a script?

Posted: Mon Aug 18, 2014 8:46 pm
by Silvine
Umm thanks I think, I trust that comes with spotted dick :D
Or at a push jam roly poly.