Verb usage

Slent
22 Sept 2013, 19:15Quick question: I have a verb called "look around" on the player object which prints out something specific to the room the player is currently in. I'm chosing what output to print with if, if elses. But is there another way to do this? These if, if elses would require me to have an if statement for each room in the game and I would like to avoid this if possible 
I know we have the "look at <something>" which would actually solve my problem except I want "look at <something>" to be different than "look around" which is very intentional

I know we have the "look at <something>" which would actually solve my problem except I want "look at <something>" to be different than "look around" which is very intentional


jaynabonne
22 Sept 2013, 19:52You could just have a command like this:
If the current room has a string attribute called "lookaround", then it prints that string. Else if the current room has a script attribute called "lookaround", then it runs the script. Else, it just dumps out the room description (as if you'd done "look").
You might tick people off, though, if "look around" is significantly different from "look" (which might be considered the same thing by many).
<command name="LookAround">
<pattern>look around</pattern>
<script>
room = game.pov.parent
if (HasString(room, "lookaround")) {
msg(room.lookaround)
} else if (HasScript(room, "lookaround")) {
do (room, "lookaround")
} else {
ShowRoomDescription()
}
</script>
</command>
If the current room has a string attribute called "lookaround", then it prints that string. Else if the current room has a script attribute called "lookaround", then it runs the script. Else, it just dumps out the room description (as if you'd done "look").
You might tick people off, though, if "look around" is significantly different from "look" (which might be considered the same thing by many).

Slent
22 Sept 2013, 20:17That is in the right direction, yes
Can I change the pattern to be "look around me" and then you'd have to type "look around me" to get it to run its script?
I'm not that known in the universe of text based games but my plan is to have hints in the look around command and some general description in the look at command. Not using the look around command would not cause you to get stuck but it would reward players who are more curious with more story and objectives. Is that a bad idea?
The reason I wanna use those two commands, "look at <object>" and "look around <player>", is that I find them different. The first you look closely at a specific object, the other you examine the players immediate surroundings. But if people who play lots of text based games see them as the same, I might need another function to give the extra hints and stuff.

I'm not that known in the universe of text based games but my plan is to have hints in the look around command and some general description in the look at command. Not using the look around command would not cause you to get stuck but it would reward players who are more curious with more story and objectives. Is that a bad idea?
The reason I wanna use those two commands, "look at <object>" and "look around <player>", is that I find them different. The first you look closely at a specific object, the other you examine the players immediate surroundings. But if people who play lots of text based games see them as the same, I might need another function to give the extra hints and stuff.

jaynabonne
22 Sept 2013, 20:32You can definitely make it "look around me". Or you can keep it a verb (I didn't realize the "me" part) and just put that same script in your verb.
I didn't mean "look at" in my response - I meant "look" (aka "l"), the command that describes the room you're in, via the room description. I think for most players, "look" means "tell me all about what's visible around me in the current room." ("Look at <object>" is completely different, as you rightly point out.)
I won't dictate design for you - the choice is yours. It sounds like you have a plan.
I just know I was playing a game once where there was "look" and something else really close to that, and they gave different descriptions, and it was disconcerting to type two things that seemed synonymous and have the result be different. It made me wonder what else I was missing.
I didn't mean "look at" in my response - I meant "look" (aka "l"), the command that describes the room you're in, via the room description. I think for most players, "look" means "tell me all about what's visible around me in the current room." ("Look at <object>" is completely different, as you rightly point out.)
I won't dictate design for you - the choice is yours. It sounds like you have a plan.


Slent
22 Sept 2013, 20:41Awesome. I will probably put that script in the verb as that would be an easy solution. It really shortens the code and makes everything be where they are supposed to (ie description of an item on that item) 
Well I'm very interested in hearing what experiences people have with situations like that as that is something I am not familiar with
This is my first attempt at a text based game and I will be honest that I've never played such a game. So any "best practice" is highly appreciated!
But yes, it is not the same as look, which will give the look at description of the room. I certainly have a plan but it would be sad to see that plan being unappreciated due to me using a command "wrong"

Well I'm very interested in hearing what experiences people have with situations like that as that is something I am not familiar with

But yes, it is not the same as look, which will give the look at description of the room. I certainly have a plan but it would be sad to see that plan being unappreciated due to me using a command "wrong"
