Character Position Help

Videogamez Boy
It is possible to make player, for example sit down or lying on particular object, or on the floor? Also, how to create a new commands, for example sleep? And how to override some existing commands, like for direction commands (east, west, north, south) with custom messages?

Silver
Have you done the tutorial yet?

http://docs.textadventures.co.uk/quest/tutorial/

That's the best place to start and answers most of those questions.

The Pixie
Videogamez Boy wrote:It is possible to make player, for example sit down or lying on particular object, or on the floor? Also, how to create a new commands, for example sleep?

See here:

http://docs.textadventures.co.uk/quest/ ... mands.html

For a position, I would set an attribute on the player object:

player.position = "sitting"


To sit on something specific is a bit more involved; you need to check it is there and can be sat on, and then flag what is being sat on.

And how to override some existing commands, like for direction commands (east, west, north, south) with custom messages?


The best way to do custom messages is to override the templates the command uses. See here:

http://docs.textadventures.co.uk/quest/ ... lates.html

For direction commands, that will not work as it does not use templates for some reason, so you will need to override the command. It is actually just one command, called "Go". You can view library elements by clicking the Filter button at the bottom of the editor tree, and selecting "Show Library Elements". Look in the commands section. Once you have it, you can click the "Copy" button, at the top right to get a copy in your game that you can edit.

Then you can modify it to check if the player is sitting:

if (player.position = "sitting") {
msg("You stand up.")
player.position = null
}


I appreciate this is kind of an overview of what you need to do, but it should get you going in the right direction. If you have more questions, just ask.

Silver
I really should start getting to grips with attributes. I'd have gone the flag direction which achieves the same but is more code. Plus you can use attributes with the text processor where as you can't with flags; or it isn't in the documentation if you can.

HegemonKhan
@Silver:

in quest, 'flags', are specifically Boolean Attributes, so they can certainly be used in the text processor (though I've yet to learn it myself, so can't help on its syntax yet).

to understand Attributes:

think of being a kid and having a fort, you have a secret password, that must be said exactly to gain entrance into the fort.

that 'fort with a secret password' is an Attribute in essence.

Boolean (quest specific: Flag) Attributes:

orc.dead = false_or_true

'orc.dead' is the 'fort' and the secret password is: (either, you decide on what it is: true or false)

if, this is the fort 'orc.dead', what is the secret password? 'true', that is the right password, you may loot its corpse!
else if, this is the fort 'orc.dead', what is the secret password? 'false', that is the wrong password, fight it out!

String Attributes:

if, this fort is 'player.condition', what is the secret password? "normal", that is the correct password, nothing bad happens to you.
else if, this fort is 'player.condition', what is the secret password? "poisoned", that is the wrong password, you lose 50 hp every turn, until cured or dead.
else if, this fort is 'player.condition', what is the secret password? "paralyzed", that is the wrong password, you may not do anything until cured.
etc etc etc 'else ifs'

Integer Attributes:

if, this fort is 'player.strength', what is the secret password? '100', that is the correct password, you are strong.
else if, this fort is 'player.strength', what is the secret password? '50', that is the wrong password, you are average in strength.
else if, this fort is 'player.strength', what is the secret password? '0', that is the wrong password, you are weak.

etc etc etc Attribute Types

----------

you understand algebra, right?

y = x

in coding:

y -> player.strength
x -> 100

player.strength = 100

msg (player.strength)
outputs: 100

---------

the String Attribute is the foundational Attribute

player.alias = "HK"
player.condition = "poisoned"
etc etc etc

A String Attribute's Value (or its textual parts within an Expression) must be within quotes

a Boolean Attribute is just a String Attribute with a specific (special) Value (no quotes): (true or false)

an Integer Attribute is just a String Attribute with a specific (special) Value (no quotes): (numeric only)

an Object Attribute is just a String Attribute's who's Value is not within quotes

etc etc etc

Silver
The penny is slowly starting to drop, HK. I'll answer you in code and if the code works, we're getting there.

topic.explained = "understood"

if (topic.explained = "understood") {
msg("Tell HK you're beginning to understand.")
else {
msg("Tell HK you're close but not quite there yet.")
}
}


HegemonKhan
Silver.coolness_level = "AWESOME!"

(now, maybe I'll begin to be of help to you finally, let me know if my posts are making sense, or let me know if I'm not explaining the code well, too)

hehe :D
(you know JS, in a way, you already probably know coding better than me, as I don't know JS nor html~webpages + window~pane~GUI coding, especially soon as you get used to quest's code language)

Silver
I don't know any of those things really. Slowly picking things up from others' suggestions in terms of understanding it but I wouldn't be able to hard code a web page with tables and css etc.

Videogamez Boy
woah. it may complicated, but anyway, thanks for everyone's help. gotta try to figure it out.

Silver
Making a complicated game is complicated. Who knew?

This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums