I'm slowly building a text MUD, and the way I originally had it set up was to use the arrow keys to move between rooms.
Then I figured that the odds of someone leaning on their keyboard and accidentally shifting rooms when they don't want to is a bit high.
What I would like to have happen would be for the verb to bring up a dialoguebox that displays the direction (north, south, east, west) and name of every available exit, with the option to cancel if you don't want to move.
And no, I've never coded before. >w<; hence the nubby question. Sorry.
ID:272939
![]() Jun 24 2009, 6:47 pm
|
|
![]() Jun 24 2009, 8:35 pm
|
|
Uh, failing that, just learning how to make a popup box would be useful... >w<;
|
Oh look, triple posting just to irk people. >w>;;;;
So, say it's this format being used: mob What I'd like to get it to do is: 1. Display the name of all available exits, and the direction they are in. I.e. North: Lounge, South: Kitchen, etc, as well as displaying a cancel button that will kill the popupbox 2. Move the user to the area that they select. ... and I have no idea how to. ^^; |
For multiple options, it's more useful to use input() than alert, which has a maximum of 3 and looks not as cool.
|
So in that case, would it be possible to use it as
usr.loc = input and if so, how would I go about making it context-sensitive to the room and it's exits? |
You could do something like have each room have a list of exits, and use them as the input, like
var/list/ExitList = list("NORTH","WEST","Cancel") and modify it to your needs |
You could also have an associative list. And to not need a Cancel option and have a Cancel button instead, use "input() as null|anything in ExitList". The null part adds the Cancel button. The anything part lets you choose anything in the list, which it does by default.
//Associative list: In your case, you'd want an associative list containing the direction and description. |
Tch, I need just a little more help... using a combination of ideas here:
Courtyard But I'm not entirely sure how to phrase the 'else' statement so that the usr won't move anywhere. Sorry for the nubbishness. ^^; |
I don't think you even need an else statement to do nothing, also you should make sure you capitalizations match, i see East and east.
|
I thought if statements required an else statement? owo;
And also, thanks, I thought I'd fixed that already but apparently not. It's fixed now alright. XD Ah, hell, the problem was a missing rightparen, which now that it's fixed has given rise to a whole host of problems. Back to adventure >w>;;; |
Okay, I know I'm screwing something up here. What I've tried to do (and failed miserably at xD) is to have a proc that calls the ExitList whenever it's needed. So for example:
area The three else if statements give me this when I try to compile: error: client: expected end of statement And I have no idea why... though I'm pretty sure I've goofed elsewhere, which is part of what's causing this. XD |
area Any time the player enters the bedroom area, they have to exit south or they can't leave. You could do the same thing for entering areas (using Enter()), too. |
Not sure if this is causing the problem, but try changin:
Move to this: Move there was an unneeded indenting starting at var/Decision line |