PDA

View Full Version : making a /look command?



JFK
January 27th, 2013, 20:42
How much work is it to make stuff like this? I'm sorta interested in MUDing up FGII a bit, potentially. How hard is it to make a simple(?) command, such as /look, that will display a block of descriptive text (such as a room description), and based on a parameter if one exists (/look altar)?

Trenloe
January 28th, 2013, 17:54
The main challenge here would be how each individual description was stored and how the /look command would get each piece of data. For example, what happens if there are 2 altars within the dungeon, and (as an extreme example) one PC was in a room with altar 1 and another PC was in a room with altar 2. You'd need some way of determining which altar description to show to each player... There isn't an automatic way to determine which "room" a player's token is in on the map, so you'd have to come up with a way of doing this...

Then, would you display to the GM what the PCs had all "looked" at?

Would a GM really want people wandering around looking at stuff without their control? Or, would you put some control in that lets the GM approve displaying text to the PC? It would also result in a lot of extra preparation on the GM side to provide all of the main areas for a PC to look at... At this point, is it really that different from the GM having prepared text and dragging it to the chat window, or a specific PC portrait if they just want that PC to see the text?

Just some things to think about - it all depends how you want it to work... :)

JFK
January 30th, 2013, 18:23
All good questions.
The main idea I had was for descriptions of surroundings, so a player wouldn't have to scroll way back up (and possibly not even still have the 'room' description) to 're-get' where they are.
Example: The PCs are in a corridor beneath a ruined castle. They open a locked door on the right and I tell them "You see a darkened room, a circle of dim light from your torch casting flickering shadows everywhere."
They enter, and I send this prepared text (dragging it, as you say):

The ceiling of this room is low, around six feet from the wet stone floor, and heavy beams of some dark wood, festooned with hanging roots and white mushrooms are cracked and sagging. Water drips from several places overhead, splashing into ponds and puddles on the mossy paving stones. There is a musty, earthy smell, and the air is close and damp. You cannot see beyond the limits of your torchlight, so this room must be quite large."

Then a bunch of stuff happens; they discover something; etc. At any time, a character might want to see that description again. Typing /look would send it to that PC as a whisper, so it wouldn't spam others. DM doesn't need to know they're looking around again, but they might wanna say it.

Meh, maybe it'd be a waste of time. PC could just say, "I look around again." and I could drag it again, I suppose.

lol

Trenloe
January 30th, 2013, 19:07
Oh right, I was thinking you were going to split separate descriptions within a room.

Soooo, from what you're saying, you could:

Store the last box text dragged by the GM to the chat window as a global variable.
When a player types /look it would redisplay that text just for the player.

The only real gotcha here is if the GM has dragged some other text to the chat window since the original room description.

To do this, you'd need to write an extension, more info here https://www.fantasygrounds.com/modguide/extensions.xcp

I'm not sure what ruleset you're using, the following refers to the 3.5E ruleset (the one I use the most), but it should be similar in other rulesets. Areas to look at:

Store the last box text entered in the chat window by the GM as a global variable. This will be done in the onDrop code in the chat window. I'm not 100% sure where the best place to do this is.
manager_chat.lua - onInit function to add a registerSlashHandler on the client side for "look"
Add the handler function in a new script that is called by the registerSlashHandler in step 2. This function will check for the presence of the global variable data in step 1 and if there is some present display it to just the player.

JFK
January 31st, 2013, 15:16
Thanks for the info. :)

Perhaps it's possible to store a local variable on the stored text that identifies it as a 'room' description? Then a simple check for this variable would decide whether dragged text was stored for retrieval or not. That way, only 'room' text last entered would be shown to a player with /look...

Trenloe
January 31st, 2013, 18:46
You could do that, yes. It would require changes to the underlying FG Story XML and scripts but it could be done.