POV Changes.

Anonynn
I was wondering if someone could help me with changing a characters appearance when typing "look at me."

The idea is a static appearance when you start the game, for example:

You have a "human" face with "thin" lips, with "blue" eyes. Your hair is "long" and "brown", and you stand at "5'7" feet/inches tall. You have "narrow" hips, "human" hands and "human feet" with "no" tail. You have a "modest" "A-cup" chest, and feel ready to take on the world.


So my question is when a player types "look at me" -------^ I want their choices throughout the game to reflect their current appearance. Like for example, taking a potion that turns your hair blonde instead of the original brown. So instead of the "look at me" saying Your hair is "long" and "brown", it would say, Your hair is "long" and "blonde."

Here are the codes of transformation I'm using for one creature.

I did a global_data_object and for a potion called "Cat Nip" ...I made this on the object itself..
ScriptDictionaryItem(global_data_object.neko_scriptdictionary_attribute,ToString(GetRandomInt(1,DictionaryCount(global_data_object.neko_scriptdictionary_attribute))))

and this in the global data.

if (HasString(player,"tail_type_string_attribute") and not player.tail_type_string_attribute = "cat") {
old_tail_type_variable = player.tail_type_string_attribute
player.tail_type_string_attribute = "neko"
msg (" Your " + old_tail_type_variable + " tail remains and gently swishes around behind you.")
}
else if (HasString(player,"tail_type_string_attribute") and player.tail_type_string_attribute = "cat") {
msg ("You feel the potion trying to do something else to you, but it seems specifically aimed at your tail. You already have a cat tail --- so nothing happens this time.")
}
else {
set (player, "tail_type_string_attribute", "neko")
msg ("Suddenly, you feel an itching pressure at the base of your spine just above your butt. As you pull down your garmets, you notice a small protrusion growing longer and longer. To your horror, after about three feet, your cat tail sprouts fur and begins moving around on its own. As you tentatively touch it, you feel a certain relaxation spreading throughout your body. It is then that you realize that your tail is somehow connected to your emotions. ")
}

But I have no idea how to apply that to the POV "look at me" and reflect those changes. Can anyone help?

Thank you in advance.

Also, I'm a coding noob so you'll have to speak real clearly and slow.

The Pixie
The place to do that is on the Player tab of the player object. At the bottom is the "look at" description. Change that to "Run script", and put your script in there. The way I would approach the coding is to build up a string, s, adding to it depending on the current state of the player.
s = "Your hair is " + player.haircolour + " and " + player.hairlength + ". "
if (HasString(player,"tail_type_string_attribute")) {
s = s + "You have a " + player,"tail_type_string_attribute + "-like tail."
}
msg(s)

Anonynn
The Pixie wrote:The place to do that is on the Player tab of the player object. At the bottom is the "look at" description. Change that to "Run script", and put your script in there. The way I would approach the coding is to build up a string, s, adding to it depending on the current state of the player.
s = "Your hair is " + player.haircolour + " and " + player.hairlength + ". "
if (HasString(player,"tail_type_string_attribute")) {
s = s + "You have a " + player,"tail_type_string_attribute + "-like tail."
}
msg(s)




I'm sorry. I understand where to put it, but that particular line of code comes up with an error.

How would I go about creating the string for it? I'm sorry to bother you, and what would the string look like for...

You have a "human" face with "thin" lips, with "blue" eyes. Your hair is "long" and "brown", and you stand at "5'7" feet/inches tall. You have "narrow" hips, "human" hands and "human feet" with "no" tail. You have a "modest" "A-cup" chest, and feel ready to take on the world.

^ that?

I generally know how to do scriptdictionaries (I think) at least I was able to do it once.

HegemonKhan
okay... wow this was a lot of work... I HOPE IT WORKS PERFECTLY (hah) !!!!!!!!!
(since I never was able to help you before, I owe'd you, so here's the payment: if~when this code works you for, laughs)

-------------

create a new game, open the game file itself up with a text software (notepad, wordpad, notepad++, apple: text editor, etc), highlight and delete the entire code, highlight+copy+paste in my code below to your game file, save your game file, and see if it will play without any errors... HK crosses his fingers, and have fun play testing and studying this, hehe. Ask if you got any questions. Or, let me know of the (hopefully not too numerous) errors.

if you're using quest version '560', than you just need to change the very top code line below in the code box, from this:

<asl version="550">

to this:

<asl version="560">

------

If~Once you understand all this ~ what I've done in my test game~code (lol), you can replace my labels with your own. Remember, that your labels (such as the 'name' of your things: Objects, Attributes, and etc) must all match up and be actually created too within your own game.

for example:

you're using my labels of 'hair_color_string_attribute', whereas Pixie's code uses 'haircolour', these 'name' Attributes are the 'IDs' for quest, so they must be unique ~ no two 'name' Attributes for the Elements (Objects, Exits, Functions, Commands, Verbs, Attributes, Turnscripts, Timers, Object Types, and etc) can be the same, so you must match them up correctly (and be sure that you actually created them too). Use my labels, use Pixie's labels, or use your own labels, but whichever you use, they must be uniform throughout your code, else you get an error:

ERROR: 'hair_color_string_attribute' does not match (=) up with 'haircolour'

------------------------------------------

<asl version="550">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="Testing Game Stuff">
<gameid>d2b3cb55-fe14-4743a5bafb1e7056e656</gameid>
<version>1.0</version>
<firstpublished>2015</firstpublished>
<pov type="object">player</pov>
<author>HegemonKhan</author>
<start type="script">
msg ("Note: You can type 'info' without the single quotes, to see your character stat~info screen too, aside from seeing it on the right side's pane during game play, and there's a few other things for you to find and try out too.")
wait {
ClearScreen
change_playable_character_function
on ready {
character_creation_function (game.pov)
}
}
</start>
</game>
<object name="room">
<inherit name="editor_room" />
<object name="player">
<inherit name="editor_object" />
<inherit name="editor_player" />
<inherit name="human_object_type" />
<inherit name="playable_character_object_type" />
</object>
<object name="player2">
<inherit name="editor_object" />
<inherit name="editor_player" />
<inherit name="human_object_type" />
<inherit name="playable_character_object_type" />
</object>
<object name="player3">
<inherit name="editor_object" />
<inherit name="editor_player" />
<inherit name="neko_object_type" />
<inherit name="playable_character_object_type" />
</object>
</object>
<object name="character_menu_object">
<inherit name="editor_object"
<alias>character</alias>
<parent type="object">game.pov</parent>
<drop type="boolean">false</attr>
<info type="script">
playable_character_information_screen_function
</info>
<look type="script">
// using text processor commands for the expression:
msg ("You have a {game.pov.face_type_string_attribute} face with {game.pov.lip_size_string_attribute} lips, with {game.pov.eye_color_string_attribute} eyes. Your hair is {game.pov.hair_length_string_attribute} and {game.pov.hair_color_string_attribute}.")
//
// or, using non-text processor (normal) for the expression:
// msg ("You have a " + game.pov.face_type_string_attribute + " face with " + game.pov.lip_size_string_attribute + " lips, with " + game.pov.eye_color_string_attribute + " eyes. Your hair is " + game.pov.hair_length_string_attribute + " and " + game.pov.hair_color_string_attribute + ".")
</look>
<inventoryerbs type="simplestringlist">look;info</inventoryverbs>
</object>
<object name="change playable_character_attribute_object">
<inherit name="editor_object"
<alias>change character attributes</alias>
<parent type="object">game.pov</parent>
<drop type="boolean">false</attr>
<click_to_change type="script">
game.pov.face_type_string_attribute = StringListItem (global_data_object.face_type_stringlist_attribute, GetRandomInt (0,ListCount (global_data_object.face_type_stringlist_attribute) - 1))
game.pov.lip_size_string_attribute = StringListItem (global_data_object.lip_size_stringlist_attribute, GetRandomInt (0,ListCount (global_data_object.lip_size_stringlist_attribute) - 1))
game.pov.eye_color_string_attribute = StringListItem (global_data_object.eye_color_stringlist_attribute, GetRandomInt (0,ListCount (global_data_object.eye_color_stringlist_attribute) - 1))
game.pov.hair_length_string_attribute = StringListItem (global_data_object.hair_length_stringlist_attribute, GetRandomInt (0,ListCount (global_data_object.hair_length_stringlist_attribute) - 1))
game.pov.hair_color_string_attribute = StringListItem (global_data_object.hair_color_stringlist_attribute, GetRandomInt (0,ListCount (global_data_object.hair_color_stringlist_attribute) - 1))
</click_to_change>
<inventoryerbs type="simplestringlist">click_to_change</inventoryverbs>
</object>
<object name="global_data_object">
<attr name="playable_character_objectlist_attribute" type="objectlist">player;player2;player3</attr>
<attr name="sex_type_stringlist_attribute" type="simplestringlist">male;female</attr>
<attr name="human_eye_color_stringlist_attribute" type="simplestringlist">light blue;medium blue;dark blue;light green;medium green;dark green;light brown;medium brown;dark brown;blue green;hazel;amber;yellow;grey</attr>
<attr name="human_hair_color_stringlist_attribute" type="simplestringlist">white;black;light grey;medium grey;dark grey;light brown;medium brown;dark brown;red;orange;light yellow;medium yellow;dark yellow;golden yellow;red yellow;strawberry blond;blond;platinum blond;dirty blond;brunette;raven-haired;redhead</attr>
<attr name="hair_length_stringlist_attribute" type="simplestringlist">none;short;medium;long;very long</attr>
<attr name="lip_size_stringlist_attribute" type="simplestringlist">thin;average;thick</attr>
<attr name="hip_size_stringlist_attribute" type="simplestringlist">boyish;thin;medium;wide;round;curvy</attr>
<attr name="breast_size_stringlist_attribute" type="simplestringlist">none;A cup;AA cup;B cup;BB cup;C cup;CC cup;D cup;DD cup</attr>
</object>
<type name="human_object_type">
<inherit name="character_object_type" />
<attr name="face_type_string_attribute" type="string">human</attr>
<attr name="hand_type_string_attribute" type="string">human</attr>
<attr name="foot_type_string_attribute" type="string">human</attr>
<attr name="tail_type_string_attribute" type="string">none</attr>
</type>
<type name="neko_object_type">
<inherit name="character_object_type" />
<attr name="face_type_string_attribute" type="string">neko</attr>
<attr name="hand_type_string_attribute" type="string">neko</attr>
<attr name="foot_type_string_attribute" type="string">neko</attr>
<attr name="tail_type_string_attribute" type="string">neko</attr>
</type>
<type name="character_object_type">
<attr name="face_type_string_attribute" type="string">unknown</attr>
<attr name="hand_type_string_attribute" type="string">unknown</attr>
<attr name="foot_type_string_attribute" type="string">unknown</attr>
<attr name="tail_type_string_attribute" type="string">unknown</attr>
<attr name="lip_size_string_attribute" type="string">unknown</attr>
<attr name="eye_color_string_attribute" type="string">unknown</attr>
<attr name="hair_length_string_attribute" type="string">unknown</attr>
<attr name="natural_hair_color_string_attribute" type="string">unknown</attr>
<attr name="hair_color_string_attribute" type="string">unknown</attr>
<attr name="hip_size_string_attribute" type="string">unknown</attr>
<attr name="breast_size_string_attribute" type="string">unknown</attr>
</type>
<type name="playable_character_object_type">
<statusattributes type="simplestringdictionary">alias = Name: !;age_integer_attribute = Age: !;height_integer_attribute = Height: ! inches;sex_type_string_attribute = Sex Type: !;eye_color_string_attribute = Eye Color: !;natural_hair_color_string_attribute = Natural Hair Color: !;hair_color_string_attribute = Hair Color: !;hair_length_string_attribute = Hair Length: !;lip_size_string_attribute = Lip Size: !;hip_size_string_attribute = Hip Size: !;breast_size_string_attribute = Breast Size: !</statusattributes>
<look type="script">
playable_character_look_script_function
</look>
<pov_look type="script">
playable_character_look_script_function
</pov>
</type>
<function name="character_creation_function" parameters="character_parameter">
msg ("Name?")
get input {
character_parameter.alias = ToString (result)
msg ("Age?")
get input {
character_parameter.age_integer_attribute = ToInt (result)
show menu ("Sex?", global_data_object.sex_type_stringlist_attribute, false) {
character_parameter.sex_type_string_attribute = ToString (result)
msg ("Height?")
get input {
character_parameter.height_integer_attribute = ToInt (result)
show menu ("Eye Color?", global_data_object.human_eye_color_stringlist_attribute, false) {
character_parameter.eye_color_string_attribute = ToString (result)
show menu ("Hair Color?", global_data_object.human_hair_color_stringlist_attribute, false) {
character_parameter.natural_hair_color_string_attribute = ToString (result)
character_parameter.hair_color_string_attribute = ToString (result)
show menu ("Hair Length?", global_data_object.hair_length_stringlist_attribute, false) {
character_parameter.hair_length_string_attribute = ToString (result)
show menu ("Lip Size?", global_data_object.lip_size_stringlist_attribute, false) {
character_parameter.lip_size_string_attribute = ToString (result)
show menu ("Hip Size?", global_data_object.hip_size_stringlist_attribute, false) {
character_parameter.hip_size_string_attribute = ToString (result)
show menu ("Breast Size?", global_data_object.breast_size_stringlist_attribute, false) {
character_parameter.breast_size_string_attribute = ToString (result)
}
}
}
}
}
}
}
}
}
}
</function>
<function name="change_playable_character_function">
show menu ("Character?", global_data_object.playable_character_objectlist_attribute, false) {
ChangePov (result)
// or instead of the 'ChangePov (Player Object)', you can do this too: game.pov = result
}
</function>
<function name="playable_character_information_screen_function">
ClearScreen
msg ("Name: " + game.pov.alias)
msg ("Age: " + game.pov.age_integer_attribute)
msg ("Sex Type: " + game.pov.sex_type_string_attribute)
msg ("Height: " + game.pov.height_integer_attribute)
msg ("Eye Color: " + game.pov.eye_color_string_attribute)
msg ("Natural Hair Color: " + game.pov.natural_hair_color_string_attribute)
msg ("Hair Color: " + game.pov.hair_color_string_attribute)
msg ("Hair Length: " + game.pov.hair_length_string_attribute)
msg ("Lip Size: " + game.pov.lip_size_string_attribute)
msg ("Hip Size: " + game.pov.hip_size_string_attribute)
msg ("Breast Size: " + game.pov.breast_size_attribute)
wait {
ClearScreen
}
</function>
<function name="playable_character_look_script_function">
// using text processor commands for the expression:
msg ("You have a {this.face_type_string_attribute} face with {this.lip_size_string_attribute} lips, with {this.eye_color_string_attribute} eyes. Your hair is {this.hair_length_string_attribute} and {this.hair_color_string_attribute}.")
//
// or, using non-text processor (normal) for the expression:
// msg ("You have a " + this.face_type_string_attribute + " face with " + this.lip_size_string_attribute + " lips, with " + this.eye_color_string_attribute + " eyes. Your hair is " + this.hair_length_string_attribute + " and " + this.hair_color_string_attribute + ".")
</function>
<command name="playable_character_information_screen_command">
<pattern>info</pattern>
<script>
playable_character_information_screen_function
</script>
</command>
<verb>
<property>info</property>
<pattern>info</pattern>
<defaultexpression>"You can't 'info' that."</defaultexpression>
</verb>
<verb>
<property>look</property>
<pattern>look</pattern>
<defaultexpression>"You can't 'look' at that."</defaultexpression>
</verb>
<verb>
<property>pov_look</property>
<pattern>pov_look</pattern>
<defaultexpression>"You can't 'look' at that."</defaultexpression>
</verb>
<verb>
<property>click_to_change</property>
<pattern>click_to_change</pattern>
<defaultexpression>"You can't 'click_to_change' that."</defaultexpression>
</verb>
</asl>


---------

P.S.

codecademy.com ( http://www.codecademy.com/ ) is really is really helpful to learn to code, they got very nice lessons to go through, to help people who've never coded before, if you're interested, it'll help you, in-turn, with understand quest coding better too.

I finally just completed the entire python lesson, it took me about a month (I think), and it says it should only take ~ 13 hrs... sighs... well, I'm slow at learning to code then... though I was a bit lazy (and it does get quite boring too, sighs).

Anonynn
Actually, you didn't fail me before or anything. Your coding help improved my understanding by a ton. I feel a lot more confident in the coding aspects now and can understand why you guys would rather work on that aspect than the GUI editor.

There's ONE small problem with the code you provided though!

I already have a good portion of the game already made (49 coding pages in word) so I'll have to know where exactly to implement it and if it will affect other libraries I'm using.

Let me know how I can make your life easier. I actually owe YOU.

Also, thank you for the code-academy thing. That's really neat! I was wondering what type of coding I should learn for Quest type stuff. Is it Python? I know it's XML but I have no idea, which of the choices on the website is closest to that. Also, I appreciate all your help so far.

HegemonKhan
Pixie's post are trying to help you directly with that, of where+how to put~do it with the code. His~her help is very focused and concise, so look at his~her posts and see if you can understand and follow his~her instructions in them.

whereas my posts are a leviathon ( http://en.wikipedia.org/wiki/Leviathan ) and~or jurgungmund (can't spell~remember. Norse mythos, giant snake that coils the entire world or something like that: http://en.wikipedia.org/wiki/Jörmungandr ), laughs.

jurgungmund ...... Jormungander, I tried... laughs...

Jor-mun-gan-der, not jur-gung-mund, lol

------------

well, I've only done python so far, as it's one of the main coding languages first taught in CS (computer science: programming) school classes, so i decided to start with learning it (I'm now going to do JS: JavaScript, next), so I'm not really sure if there's any coding language on codecademy that is similiar to quest's XML (eXtensible Markup Language), as I just learned the basics of my first real~common language, python. Python's syntax and structure is a bit different, but the universal constructs are quite familiar to those with some knowledge of quest's XML (and more so too, but quest does a lot of that in its underlying code, for us, too).

python is quite different from quest's xml, but the lessons it gives on doing python, will definately help you with quest, but the syntaxes and formats are different (though, it's pretty quick to pick up, and recognize it matching up with how quest's xml does it, and python's syntax is nice once you learn it, a lot less typing, laughs).

though, I'm sure any coding language will help you understand quest's XML, as while the syntax, format, and design methods are different, theres a lot of universal constructs. I would've had a lot tougher time with python had I not learned what I've learned from quest's XML (as the one bad thing about the codecademy, there's not much help with troubleshooting exactly how they want you to code the stuff in aside from their Q&A help forum, as they leave it a bit vague and nebulous, though the Q&A has all the help you need, so don't worry).

-----------

the point of my sample test game~code (if it works...), is that you can take it and see the parts of it that you need, in both how it's done~looks in the GUI~Editor and in-code, and then hopefully be able to implement it for your own game. if you need any help with any of it, let me know. Though, first, I need to know if my code actually works (unlikely) or not, laughs. I have to transfer my code from this apple computer to my pc computer with quest on it, which is a bit of a pain to do, though I can do it ~ check to see if it works myself (I'm just lazy, aka a typical male, laughs). I also give you a few different ways to do the various things that you want, so if it works, take a look at it (look at it in GUI~Editor mode to make sense of it, as the code is still a bit murky for you, and~or play the game, seeing what~how is done, and if you like it or not).

The Pixie
Sorry, try this code instead.
s = "Your hair is " + player.haircolour + " and " + player.hairlength + ". "
if (HasString(player,"tail_type_string_attribute")) {
s = s + "You have a " + player.tail_type_string_attribute + "-like tail."
}
msg(s)


An alternative approach would be to use the text processor
http://docs.textadventures.co.uk/quest/ ... essor.html

It is not as flexible, but is easier to use. Type this in the same box, but set it to "Text" instead of "Run script". Note that if the player has a tail, you would need to set a flag (player.has_tail) as well as setting the type in player.tail_type_string_attribute.
You have a {player.face_type_string_attribute} face with {player.lips_type_string_attribute} lips, with {player.eyes_type_string_attribute} eyes. Your hair is {player.hair_length_type_string_attribute} and {player.hair+_colour_type_string_attribute}. {if player.has_tail:You have a {player.tail_type_string_attribute} tail.} You feel ready to take on the world.

XanMag
I am toying around with a game about a girl getting ready for the 'big school dance' after she wakes up late. And, of course, mom has encrypted the wi-fi code. Each chore that gets finished reveals one more symbol in the code. Moms (and dads) can be cruel that way! It's solely intended for my 12 year old daughter to play, but I'll make it public once it's finished just for giggles!

Anyway, I am the black sheep of this 'Quest Family'. I use the GUI almost entirely and have worked a few ugly, yet effective ways to code for some things - like changing the 'x me' description! When an event happens, say, 'use cat nip', I simply threw up a flag that changed the 'x me' output. If the effect wore off, I dropped the flag again. Like I said, it is probably the UGLIEST code ever, but it works for me. After more changes, I may find this to be obsolete but so far so good. Below is the code I have under a 'look at me' game command.

msg ("You are Alaina, a twelve year old girl.")
if (GetBoolean(player, "unshowered")) {
msg ("You have dirt on your right elbow and down your right leg. Must have been from last night's soccer game? Regardless, it certainly isn't very attractive!")
}
else {
msg ("After your shower, your skin is a glowing beacon of cleanliness!")
}
if (GetBoolean(player, "unbrushed")) {
msg ("It feels and smells like a bird lived in your head last night and your mouth is the bottom of the birdcage! ICK!!")
}
else {
msg ("Your breath is fresh and minty.")
}
if (GetBoolean(player, "badhair")) {
msg ("Your mousy brown hair looks like a poorly thatched birds nest. Tangles here, kinks there. Quite an unpleasant image.")
}
else {
msg ("Your hair is impeccably neat and lying gently on your shoulders.")
}
if (GetBoolean(player, "stinky")) {
msg ("You haven't cleaned up since last night's soccer game and your are... well... quite ripe.")
}
else {
msg ("You are freshly deodorized and smelling like a clean spring day!")
}
if (GetBoolean(player, "jammies")) {
msg ("You are wearing your favorites jammies. They are not very cute, but they are SUPER comfy!")
}
if (GetBoolean(player, "dressed1")) {
msg ("You are proud of yourself and they way you look, but there is no reason to describe what you look like in your undergarments!")
}
if (GetBoolean(player, "dressed2")) {
msg ("You have decided to wear your comfy clothes - a pair of athletic shorts, ankle socks, and tennis shoes, and a tee-shirt with \"Wake Up and Be Awesome\" written on the front. Certainly not what you would choose to wear on a date, but nothing to be embarassed about either!")
}
if (GetBoolean(player, "dressed3")) {
msg ("You are wearing your cutest outfit! The boys will certainly not be able to look away!")
}


Also, it is obviously not finished yet, so don't judge me until it is complete. Just thought I'd give you my work-around "solution". I've also got a similar situation going on with 'Xanadu - In the Compound - Revenge' and it is working just fine. Sadly, that, too is incomplete!! Arghh!! =/

Good luck and Happy Gaming!

XanMag

Anonynn
The Pixie wrote:Sorry, try this code instead.
s = "Your hair is " + player.haircolour + " and " + player.hairlength + ". "
if (HasString(player,"tail_type_string_attribute")) {
s = s + "You have a " + player.tail_type_string_attribute + "-like tail."
}
msg(s)


An alternative approach would be to use the text processor
http://docs.textadventures.co.uk/quest/ ... essor.html

It is not as flexible, but is easier to use. Type this in the same box, but set it to "Text" instead of "Run script". Note that if the player has a tail, you would need to set a flag (player.has_tail) as well as setting the type in player.tail_type_string_attribute.
You have a {player.face_type_string_attribute} face with {player.lips_type_string_attribute} lips, with {player.eyes_type_string_attribute} eyes. Your hair is {player.hair_length_type_string_attribute} and {player.hair+_colour_type_string_attribute}. {if player.has_tail:You have a {player.tail_type_string_attribute} tail.} You feel ready to take on the world.



So if I wanted to use...

s = "Your hair is " + player.haircolour + " and " + player.hairlength + ". "
if (HasString(player,"tail_type_string_attribute")) {
s = s + "You have a " + player.tail_type_string_attribute + "-like tail."
}
msg(s)


I would have to create a string_dictionary of those specific attributes on the player tab under "Attributes" or would I have to put that in the global_data_object?

For example a string dictionary with...

player.haircolor
player.hairlength
player.tail etc?

I'm not sure how that would look as a string_dictionary if that's what I'm supposed to use for that specific way. That text processor is also very handy too! I didn't know about it.

Also, XanMag thank you very much. I'll definitely take a look at your method too. Appreciate the feedback.

The Pixie
Neonayon wrote:So if I wanted to use...

s = "Your hair is " + player.haircolour + " and " + player.hairlength + ". "
if (HasString(player,"tail_type_string_attribute")) {
s = s + "You have a " + player.tail_type_string_attribute + "-like tail."
}
msg(s)


I would have to create a string_dictionary of those specific attributes on the player tab under "Attributes" or would I have to put that in the global_data_object?

For example a string dictionary with...

player.haircolor
player.hairlength
player.tail etc?

I'm not sure how that would look as a string_dictionary if that's what I'm supposed to use for that specific way. That text processor is also very handy too! I didn't know about it.

They are just string attributes, not a string dictionary. You might be over-thinking this. Attributes default to strings when you add them on the Attribute tab, just type in the value.

You can set a value like this:

player.haircolor = "blonde"

Are you getting confused with status attributes? Status attributes are held in a string dictionary, and do feature on the Attributes tab, but they are only used to tell Quest to display another attribute in the Status pane. Attributes are the bottom part of that part.

Anonynn
The Pixie wrote:They are just string attributes, not a string dictionary. You might be over-thinking this. Attributes default to strings when you add them on the Attribute tab, just type in the value.

You can set a value like this:

player.haircolor = "blonde"

Are you getting confused with status attributes? Status attributes are held in a string dictionary, and do feature on the Attributes tab, but they are only used to tell Quest to display another attribute in the Status pane. Attributes are the bottom part of that part.


Oh! I think I understand now. So, I go to the player object, Attributes, Add, and type "name for new attribute" as haircolor --- and then make the "value", player.haircolor = "blonde." ? ---- If it's like that, do I just type it like this.... player.haircolor = "blonde, brunette, red." in the same attribute string...or do I create a new attribute for each haircolor?

Thanks again for your patience, Pixie.

The Pixie
So you type "haircolour" for the name of the attribute (not the status attribute), and say "blonde" as the initial value (without quotes in both cases).

When something happens to change the hair colour (player drinks a potion or whatever), you have to set it to the new value. In the GUI it will look like this (this time with quotes):
[Set variable] player.haircolour = [expression] "brunette"

In code it looks like this:
player.haircolour = "brunette"

HegemonKhan
in the GUI~Editor:

first create your Object's Attribute (set it up with a unique name of your own and an initial value):

(for this example only we'll use 'haircolor' as the Attribute's unique name,but you can use whatever you want for the name)

'player' Player Object -> 'Attributes' Tab -> Attributes (NOT status attributes) -> Add -> (see below)

(Object Name: player)
Attribute Name: haircolor
Attribute Type: string
Attribute Value: black

so now the 'player' Player Object has the 'haircolor' String Attribute with its Value of 'black'. aka: You have black hair color currently.

we'll ignore changing your hair color for now, so we get to setting up your dynamic 'pov_look' Verb for your 'player' Player Object:

-------

Some quick notes:

the GUI~Editor's Object's 'Verbs' are actually Script Attributes given to those Objects, but you can ignore this technicality, as it deals with the coding.

non-Player Objects, only have a single 'look' Verb, but Player Objects such as the default 'player' Player Object, have two 'look' Verbs, the normal one (the 'look' Script Attribute ~ Verb) like your non-Player Objects have, which is displayed when you're not controlling your Player Object, and the extra one (the 'pov_look' Script Attribute ~ Verb) which is displayed when you are controlling your Player object. So, if you set up the normal one, you won't see it, as you're controlling your Player Object, a very common isssue we get on the forums, as it is very confusing for new people to quest.

path for the normal 'look' Verb:

'whatever' Object -> 'Setup' Tab -> 'look~description' box

path for the extra 'pov_look' Verb:

'whatever' Player Object -> 'Player' Tab -> 'look~description' box

-------

anyways, so to set up the 'pov_look' Verb:

'player' Player Object -> 'Player' Tab -> 'look' box -> [run as script] -> add a~new script -> output -> print a message -> [EXPRESSION] -> (see below)

"You have {player.haircolor} hair."

this will output whatever your 'haircolor' Attribute's value is, during game play when called on via 'look at me' command, which it currently is, black:

You have black hair.

the 'name' is the 'ID' for quest, so if you did this:

"You have {player.hair_color} hair."

it wouldn't work, as it doesn't match up with the name we've used of 'haircolor'.

thnk of it this, let's say you and me were standing next to each other, and someone else wanted to call us over, if they call upon 'HegemonKhan' to come over, you wouldn't come over, as your name is 'Neonayon', not 'HegemonKhan'.

so, if you created~use 'haircolor' as the 'player' Object's Attribute's name:

(Object Name: player)
Attribute Name: haircolor
Attribute Type: string
Attribute Value: black

than you must call upon~use that:

player.haircolor

if you created~use 'hair_color_string_attribute' as the Attribute's name:

(Object Name: player)
Attribute Name: hair_color_string_attribute
Attribute Type: string
Attribute Value: black

than you must call upon~use that

player.hair_color_string_attribute

if you use 'hair_color' :

(Object Name: player)
Attribute Name: hair_color
Attribute Type: string
Attribute Value: black

then you must use that:

player.hair_color

if you use 'HairColor' :

(Object Name: player)
Attribute Name: HairColor
Attribute Type: string
Attribute Value: black

then you must use that:

player.HairColor

if you use 'hairColor' :

(Object Name: player)
Attribute Name: hairColor
Attribute Type: string
Attribute Value: black

then you must use that:

player.hairColor

all of these examples, are various different labeling systems~conventions people use, choose or create your own, as it really helps with you with your organization and etc, if you develop a system~convention of your own, and is more helpful if you move onto more advanced coding.

------

now, this won't help for game play, but just to see that it works dynamically, let's change your 'haircolor' to 'white', via changing the Attribute in the GUI~Editor:

'player' Player Object -> 'Attributes' Tab -> Attributes (NOT status attributes) -> find your 'haircolor' Attribute in the scroll box and click on it so it is highlighted, so we can edit it, to this:

(Object Name: player)
Attribute Name: haircolor
Attribute Type: string
Attribute Value: white

now, play your game, does the 'look at me', display this to you? :

You have white hair.

------

alright, now we need an actual means of changing our hair color during game play, which can be done many ways...

but first, let's see if you can follow the above and understand it.

Anonynn
HegemonKhan wrote:
alright, now we need an actual means of changing our hair color during game play, which can be done many ways...

but first, let's see if you can follow the above and understand it.


Got it so far. Thank you, Hegemon and Pixie! What's the next step?

HegemonKhan
well, one way is to create an 'item' Object that does it:

'room' Object -> 'Object' Tab -> Add -> Name: pink_hair_dye

'pink_hair_dye' Object -> 'Verb' Tab -> Add -> Name: consume (or you can use a built-in Verb, I think 'drink' is a built-in Verb, follow the same steps below regardless of whether you create your own Verb or use a built-in Verb)

run as script -> add new script -> scripts -> 'if' Script -> [EXPRESSION] -> (see below)

if (not player.haircolor = "pink")

-> then, -> add a script -> variables -> 'set a variable or attribute' -> [EXPRESSION] -> (see below)

player.haircolor = "pink"

-> add a script -> output -> print a message -> [expression] -> "By consuming the pink hair dye, your {player.haircolor} hair turns pink."

else,

-> add a script -> output -> print a message -> [message] -> "Your hair is already pink."

---------

you can then type 'look at me' and it'll display:

You have pink hair.

---------

this (using a simple 'haircolor to pink item' Object via its Verb) is just one of the simpliest examples, you need decide upon how you want to do it and how simple or complex you want it too. There's really no limit on what~how and simple~complex implementation of changing Attributes within your game. You got to decide that, what do you want to do as your game design for it?

you could use a Timer, and every 30 seconds that goes by (in essence an 'event effect' within your game play), your 'player.haircolor' gets its color (value) randomly changed. this is just another example. the only limit to the number of designs~examples~implementations, is one's imagination.

you could have a quiz of questions (scripts~verbs) which determine~re-set what hair color you will have.

The Pixie
Here is a quick example game with three items that will change the player. If you are using the off-line editor, create a new game, go to the code view from the toolbar, and replace all the code already there with the code below. Then you can play the game, and then in the GUI look at how the three items were implemented to change the appearance.
<!--Saved by Quest 5.6.5621.18142-->
<asl version="550">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="Transform!">
<gameid>84a6db03-b332-4491-ab24-abf532c21066</gameid>
<version>1.0</version>
<firstpublished>2015</firstpublished>
<autodisplayverbs type="boolean">false</autodisplayverbs>
<author>The Pixie</author>
</game>
<object name="room">
<inherit name="editor_room" />
<object name="player">
<inherit name="editor_object" />
<inherit name="editor_player" />
<attr name="pov_look">You are a {player.sex} with {player.hair_colour} hair{if player.has_tail: and a {player.tail_type} tail}.</attr>
<sex>man</sex>
<attr name="hair_colour">brunette</attr>
<attr name="has_tail" type="boolean">false</attr>
</object>
<object name="belt">
<inherit name="editor_object" />
<wear type="script">
if (not belt.parent = player) {
msg ("You need to pick up the belt before putting it on.")
}
else if (player.sex = "woman") {
msg ("You are already wearing the belt.")
}
else {
msg ("You put on the belt, and suddenly feel different...")
player.sex = "woman"
this.drop = false
}
</wear>
<remove type="script">
if (player.sex = "man") {
msg ("You are not wearing the belt.")
}
else {
msg ("You take off the belt, and suddenly feel normal again...")
player.sex = "man"
this.drop = true
}
</remove>
<inventoryverbs type="stringlist">
<value>Look at</value>
<value>Wear</value>
<value>Remove</value>
</inventoryverbs>
<take />
<drop />
</object>
<object name="bottle">
<inherit name="editor_object" />
<alias>bottle of peroxide</alias>
<feature_usegive />
<use type="script">
msg ("You use the bottle of peroxide on your hair, and it goes blonde.")
player.hair_colour = "blonde"
this.parent = game
</use>
<take />
</object>
<object name="potion">
<inherit name="editor_object" />
<drink type="script">
if (this.empty) {
msg ("You want to drink more of the potion (why stop at one tail?), but the bottle is empty.")
}
else {
msg ("You drink the potion, and suddenly you have a tail!")
player.has_tail = true
player.tail_type = "cat"
this.empty = true
}
</drink>
<empty type="boolean">false</empty>
<take />
<inventoryverbs type="stringlist">
<value>Look at</value>
<value>Drop</value>
<value>Drink</value>
</inventoryverbs>
</object>
</object>
<verb>
<property>remove</property>
<pattern>remove</pattern>
<defaultexpression>"You can't remove " + object.article + "."</defaultexpression>
</verb>
</asl>

Anonynn
HegemonKhan wrote:room' Object -> 'Object' Tab -> Add -> Name: pink_hair_dye

'pink_hair_dye' Object -> 'Verb' Tab -> Add -> Name: consume (or you can use a built-in Verb, I think 'drink' is a built-in Verb, follow the same steps below regardless of whether you create your own Verb or use a built-in Verb)

run as script -> add new script -> scripts -> 'if' Script -> [EXPRESSION] -> (see below)

if (not player.haircolor = "pink")

-> then, -> add a script -> variables -> 'set a variable or attribute' -> [EXPRESSION] -> (see below)

player.haircolor = "pink"

-> add a script -> output -> print a message -> [expression] -> "By consuming the pink hair dye, your {player.haircolor} hair turns pink."

else,

-> add a script -> output -> print a message -> [message] -> "Your hair is already pink."



^---- I tried that. Here is the code.

if (if (not player.haircolor = "black")) {
player.haircolor = "black"
msg ("You pop off the cork of the dye and then swish it around in the bottle a couple of times. Here goes nothing. You close your {player.eyecolor} eyes next, and lift the opening to your {player.lips} lips. Within moments, the cool liquid, which surprisingly tastes like liquorice is filling your mouth and flowing down your throat. You chug it until its finished and then set the bottle aside. Within moments, the black dye flows out from the roots of your {player.haircolor} hair to the tips giving you {player.hairlength} {player.haircolor} hair! Wow! That's pretty cool. You run your {player.hands} hands through your locks a couple of times.")
}
else {
msg ("\"Your hair is already black --- you don't think it can get any darker than this.\"")
}


and it has this error in the game.

Error running script: Error compiling expression 'if (not player.haircolor = "black")': SyntaxError: Unexpected token ")"; expected one of ","Line: 1, Column: 43

The Pixie
You have two "if"s on that first line. Should be:
if (not player.haircolor = "black") {

HegemonKhan
oops, that was my fault for neon doing the two 'ifs', as can be seen (I wasn't paying attention to what I was writing, for neon to do):

HK wrote:run as script -> add new script -> scripts -> [1]~'if' Script -> [EXPRESSION] -> (see below)

[2]~if (not player.haircolor = "pink")

producing the erroneous syntax of: [1] if ( [2] if (not player.haircolor="black") [1] ) {


I was suppose to write this:

run as script -> add new script -> scripts -> 'if' Script -> [EXPRESSION] -> (see below)

not player.haircolor = "pink"


---------

and as Pixie has been showing in his~her prior posts, for dealing with conditional Attributes in your 'pov_look' Verb:

(using text processor commands as it is easier to do and understand probably than the building upon scripts method, for neon)

(the text processor commands are much more covenient than the concatenating script writing, I'm getting converted, laughs)

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

let's say you created these Attributes:

'player' Player Object -> 'Attributes' Tab -> Attributes -> Add -> (see below, repeat for each Attribute)

(Object Name: player)
// I'm just using the underscore below so you can read it, as you may not recognize 'hastail' as being: 'has tail' ~ conceptually: 'do you has~have at least 1 tail? true or false'
Attribute Name: has_tail
Attribute Type: boolean
Attribute Value: false // for this example, you start out as human, so you don't have a tail, hence we setting this to initially have the Value of false
// in code: player.has_tail = false

(Object Name: player)
Attribute Name: tailtype
Attribute Type: string
Attribute Value: none

(Object Name: player)
Attribute Name: tailcolor
Attribute Type: string
Attribute Value: none

we then would need actual way of changing these Attributes' initially set'ted Values during game play too

if (not player.haircolor = "black") {
player.haircolor = "black"
msg ("You pop off the cork of the dye and then swish it around in the bottle a couple of times. Here goes nothing. You close your {player.eyecolor} eyes next, and lift the opening to your {player.lips} lips. Within moments, the cool liquid, which surprisingly tastes like liquorice is filling your mouth and flowing down your throat. You chug it until its finished and then set the bottle aside. Within moments, the black dye flows out from the roots of your {player.haircolor} hair to the tips giving you {player.hairlength} {player.haircolor} hair! Wow! That's pretty cool. You run your {player.hands} hands through your locks a couple of times.

msg ( " { if player.has_tail: You have a {player.tailcolor} {player.tailtype} tail.} { if not player.has_tail: You don't have a tail, if you want one, there may be a way to get one, and different types and colors of tails, at that too.} " )

else {
msg ("\"Your hair is already black --- you don't think it can get any darker than this.\"")
}


--------------

@ Pixie:

can (or how would you ~ syntax ~ format) you change an Attribute within (or along) with a text processor command?

a 'within' :

msg ( " { if not player.has_tail : " + set (player, "has_tail", true) + " You now have a tail. } " )


or... (I have no idea how an 'along' would work~look, lol):

msg ( " { if not player.has_tail : You now have a tail. } " )
// I know this doesn't work, lol
player.has_tail=true

HegemonKhan
oops, I spotted another mistake in the code of mine too:

-> add a script -> output -> print a message -> [expression] -> "By consuming the pink hair dye, your {player.haircolor} hair turns pink."

this would output wrongly:

// initially: player.haircolor="black"
// afterwards: player.haircolor="pink"

By consuming the pink hair dye, your pink hair turns pink.

instead of the correct output of:

By consuming the pink hair dye, your black hair turns pink.

--------

initially: player.haircolor = "black"
new attribute: player.old_haircolor = player.haircolor // conceptually: player.old_haircolor = player.haircolor = "black"

we then change the 'haircolor' Attribute's Value now to being "pink".

afterwards, so now we got:

player.haircolor = "pink"
player.old_haircolor = "black"

--------------

-> add a script -> output -> print a message -> [expression] -> "By consuming the pink hair dye, your {player.haircolor} hair turns pink."

I forgot that I'd have to set~create a new Attribute 'player.old_haircolor' to save~retain the old hair color (black), so that I can use it in the line above, seen fixed up below:

run as script -> add new script -> scripts -> 'if' Script -> [EXPRESSION] -> not player.haircolor = "pink"
-> then, -> add a script -> variables -> 'set a variable or attribute' -> [EXPRESSION] -> player.old_haircolor = player.haircolor
-> add a script -> variables -> 'set a variable or attribute' -> [EXPRESSION] -> player.haircolor = "pink"
-> add a script -> output -> print a message -> [expression] -> "By consuming the pink hair dye, your {player.old_haircolor} hair turns {player.haircolor}."

which outputs correctly as:

By Consuming the pink hair dye, your black hair turns pink.

--------------

here's the corrected code in full:

HK wrote:room' Object -> 'Object' Tab -> Add -> Name: pink_hair_dye

'pink_hair_dye' Object -> 'Verb' Tab -> Add -> Name: consume (or you can use a built-in Verb, I think 'drink' is a built-in Verb, follow the same steps below regardless of whether you create your own Verb or use a built-in Verb)

run as script -> add new script -> scripts -> 'if' Script -> [EXPRESSION] -> not player.haircolor = "pink"

-> then, -> add a script -> variables -> 'set a variable or attribute' -> [EXPRESSION] -> player.old_haircolor = player.haircolor

-> add a script -> variables -> 'set a variable or attribute' -> [EXPRESSION] -> player.haircolor = "pink"

-> add a script -> output -> print a message -> [expression] -> "By consuming the pink hair dye, your {player.old_haircolor} hair turns {player.haircolor}."

else,

-> add a script -> output -> print a message -> [expression] -> "Your hair is already {player.haircolor}."

Anonynn
HegemonKhan wrote:oops, that was my fault for neon doing the two 'ifs', as can be seen (I wasn't paying attention to what I was writing, for neon to do):

"HK"

run as script -> add new script -> scripts -> [1]~'if' Script -> [EXPRESSION] -> (see below)

[2]~if (not player.haircolor = "pink")

producing the erroneous syntax of: [1] if ( [2] if (not player.haircolor="black") [1] ) {



I was suppose to write this:

run as script -> add new script -> scripts -> 'if' Script -> [EXPRESSION] -> (see below)

not player.haircolor = "pink"



You two are great, thank you. I have another question to ask but if the code works out how I wish, then I'll do all that first and then start a new thread. I hope this stuff is helping other players too.

Also, I don't mind the coding langauge/scripting since I'll have to learn it sooner or later, but it's nice to have the text processor shortcuts nevertheless. They've both been a great help so far.

The Pixie
HegemonKhan wrote:@ Pixie:

can (or how would you ~ syntax ~ format) you change an Attribute within (or along) with a text processor command?

a 'within' :

msg ( " { if not player.has_tail : " + set (player, "has_tail", true) + " You now have a tail. } " )


or... (I have no idea how an 'along' would work~look, lol):

msg ( " { if not player.has_tail : You now have a tail. } " )
// I know this doesn't work, lol
player.has_tail=true

You cannot do it within a text processor thing, you would have to along side, as in your second example, which should work, if you remove the space before the "if".

HegemonKhan
@ neonayon:

just beware of the confusion in the syntaxes between in-code and the GUI~Editor, as the GUI~Editor adds in a lot of the syntax symbols for you, for example:

GUI~Editor:

run as script -> add a~new script -> output -> print a message -> [message] -> Hi, how are you?
// outputs: Hi, how are you?

~OR if you want quoted text (like to show what someone is thinking or saying directly in your displayment) ~

run as script -> add a~new script -> output -> print a message -> [message] -> "Hi, how are you?"
// outputs: "Hi, how are you?"

in code:

msg ("Hi, how are you?")
// outputs: Hi, how are you?")

~OR if you want quoted text (like to show what someone is thinking or saying directly in your displayment) ~

msg (" /"Hi, how are you?/" ")
// outputs: "Hi, how are you?"

-------

in-code <---> GUI~Editor

msg (xxx) <--> print a message
msg ("xxx") <---> print a message [message]
msg ("textual parts" + Object_name.Attribute_name) <---> print a message [expression]

----------

or... like the mistake I made that caused the 'having two if' (causing incorrect syntax'ing) errors for you:

GUI~Editor:

run as script -> add a~new script -> scripts -> 'if' script -> (this creates already for you: see below)

if (xxx) { then, -> add a script }

and then the text box for your 'ifs' condition:

run as script -> add a~new script -> scripts -> 'if' script -> [expression] -> if (not player.haircolor="pink") -> (which wrongly creates: see below)

// xxx = if (not player.haircolor="pink")

if ( if (not player.haircolor="pink") ) { then, -> add a script }

as I wasn't paying attention that selecting the 'if' script for the 'add a script', alread added in the 'if' script, and thus I messed up in writing in the 'if' script, thus causing the production of two 'if' scripts (an if script inside of an if script, which can be done by the way in code when done correctly, but this way of doing it is the incorrect~improper way of doing), which caused the syntaxing error.

and thus I should have correctly done~writen this:

run as script -> add a~new script -> scripts -> 'if' script -> [expression] -> not player.haircolor="pink" -> (which correctly creates: see below)

// xxx = not player.haircolor="pink"

if (not player.haircolor="pink") { then, -> add a script }

HegemonKhan
@ Pixie:

(I was~am just putting in the spacing to help neon in reading it, though didn't realize it would create an error, which would~will be worse for neon, doh! oopsy!)

but wouldn't this not work, as can be seen with this:

(err... well I think it works... but it's poor in terms of logic in coding... not the best example, but I think it makes my point?)

msg ( " { if not player.has_tail : You now have a tail. } " )
player.has_tail=true

msg ( " { if player.has_tail : You already have a tail, silly. } " )

}

Anonynn
if (not player.haircolor = "black") {
player.haircolor = "black"
msg ("You pop off the cork of the dye and then swish it around in the bottle a couple of times. Here goes nothing. You close your {player.eyecolor} eyes next, and lift the opening to your {player.lips} lips. Within moments, the cool liquid, which surprisingly tastes like liquorice is filling your mouth and flowing down your throat. You chug it until its finished and then set the bottle aside. Within moments, the black dye flows out from the roots of your {player.haircolor} hair to the tips giving you {player.hairlength} {player.haircolor} hair! Wow! That's pretty cool. You run your {player.hands} hands through your locks a couple of times.")
}
else if (not player.furcolor = "black") {
player.furcolor = "black"
msg ("You pop off the cork of the dye and then swish it around in the bottle a couple of times. Here goes nothing. You close your {player.eyecolor} eyes next, and lift the opening to your {player.lips} lips. Within moments, the cool liquid, which surprisingly tastes like liquorice is filling your mouth and flowing down your throat. You chug it until its finished and then set the bottle aside. Within moments, the black dye flows out from the roots of your {player.furcolor} hair to the tips giving you {player.furcolor} hair! Wow! That's pretty cool.")
}
else {
msg ("\"Your hair is already black --- you don't think it can get any darker than this.\"")
}


^ so I have this. Does it look correct? For some reason it's repeating the "else if" right after the initial use --- so instead of going straight to the "else", it goes, If not blah blah, else if, then else.

Also, would I have to set up an attribute for "has fur" and include that in this too, like we did with the tail?


Although, I'm wondering if it would just be easier somehow since I already have "skin" as an player_object_attribute.

HegemonKhan
choosing the correct 'add a script' circle button (in-code: proper indenting ~ 'nesting' of code lines) is very difficult... one of the reasons I went over to the code, laughs.

oh, nvm, the use of 'else if' is because you're giving~using a specific condition:

not player.furcolor="black"

which thus makes the 'else if' to be required, instead of the 'else'.

--------

let me try to explain the difference between 'else if' and 'else', this way in code:

<function name="sex_function">
msg ("Sex? (Type in the number of your choice)")
msg ("(1) male")
msg ("(2) female")
get input {
if (result = 1) {
player.sex = "male"
} else if (result = 2) {
player.sex = "female"
} else {
msg ("You must type in either '1' or 2'. Try again.")
sex_function
}
}
</function>


the 'else' is for anything that isn't specified by the 'if' and the 'if else~s'.

the 'if else~s' are for additional specific conditions.

-------

let's get into a bit more depth~complexity on this:

msg ("Are you a male?")
msg ("Type in 1 if you are a male, otherwise type in anything else if you are a female.")
if (result = 1) {
player.sex = "male"
} else {
player.sex = "female"
}
// we are ignoring hermaphrodites~transsexuals and asexuals 'else if' conditions, for this example.


is the same thing as this:

msg ("Are you a male?")
msg ("Type in 1 if you are a male, otherwise type in anything else if you are a female.")
if (result = 1) {
player.sex = "male"
} else if (not result = 1) {
player.sex = "female"
}
// we are ignoring hermaphrodites~transsexuals and asexuals 'else if' conditions, for this example.

Anonynn
HegemonKhan wrote:choosing the correct 'add a script' circle button (in-code: proper indenting ~ 'nesting' of code lines) is very difficult... one of the reasons I went over to the code, laughs.

oh, nvm, the use of 'else if' is because you're giving~using a specific condition:

not player.furcolor="black"

which thus makes the 'else if' to be required, instead of the 'else'.

--------

let me try to explain the difference between 'else if' and 'else', this way in code:

<function name="sex_function">
msg ("Sex? (Type in the number of your choice)")
msg ("(1) male")
msg ("(2) female")
get input {
if (result = 1) {
player.sex = "male"
} else if (result) = 2) {
player.sex = "female"
} else {
msg ("You must type in either '1' or 2'. Try again.")
sex_function
}
}
</function>


the 'else' is for anything that isn't specified by the 'if' and the 'if else~s'.

the 'if else~s' are for additional specific conditions.

-------

let's get into a bit more depth~complexity on this:

msg ("Are you a male?")
msg ("Type in 1 if you are a male, otherwise type in anything else if you are a female.")
if (result = 1) {
player.sex = "male"
} else {
player.sex = "female"
}
// we are ignoring hermaphrodites~transsexuals and asexuals 'else if' conditions, for this example.


is the same thing as this:

msg ("Are you a male?")
msg ("Type in 1 if you are a male, otherwise type in anything else if you are a female.")
if (result = 1) {
player.sex = "male"
} else if (not result = 1) {
player.sex = "female"
}
// we are ignoring hermaphrodites~transsexuals and asexuals 'else if' conditions, for this example.



Oh...so should I add it to the "else" then? Instead of the "else if"? I understand the difference now I think.

HegemonKhan
err... actually... for your code, it's a bit more complex with the 'else if', dealing with code 'order of operations'.... and thus which 'add a script' circle button you're clicking on in the GUI~Editor...

how to explain this simply... hmm...

you should have your code look like this (you need to click on the 'add a script' circle button that is further down and left):

(I also added in the code needed for saving~retaining, and loading~recalling~using, your Attributes' old Values)

if (not player.haircolor = "black") {
player.old_haircolor = player.haircolor
// we saved the old 'haircolor' Attribute's Value as a new Attribute named 'player.old_haircolor' above, BEFORE we then change the 'player.haircolor' Attribute to its new Value of 'black' seen below
player.haircolor = "black"
msg ("You pop off the cork of the dye and then swish it around in the bottle a couple of times. Here goes nothing. You close your {player.eyecolor} eyes next, and lift the opening to your {player.lips} lips. Within moments, the cool liquid, which surprisingly tastes like liquorice is filling your mouth and flowing down your throat. You chug it until its finished and then set the bottle aside. Within moments, the black dye flows out from the roots of your {player.old_haircolor} hair to the tips giving you {player.hairlength} {player.haircolor} hair! Wow! That's pretty cool. You run your {player.hands} hands through your locks a couple of times.")
}

if (not player.furcolor = "black") {
player.old_furcolor = player.furcolor
// we saved the old 'furcolor' Attribute's Value as a new Attribute named 'player.old_furcolor' above, BEFORE we then change the 'player.furcolor' Attribute to its new Value of 'black' seen below
player.furcolor = "black"
msg ("You pop off the cork of the dye and then swish it around in the bottle a couple of times. Here goes nothing. You close your {player.eyecolor} eyes next, and lift the opening to your {player.lips} lips. Within moments, the cool liquid, which surprisingly tastes like liquorice is filling your mouth and flowing down your throat. You chug it until its finished and then set the bottle aside. Within moments, the black dye flows out from the roots of your {player.old_furcolor} hair to the tips giving you {player.furcolor} hair! Wow! That's pretty cool.")
}
else {
msg ("\"Your hair is already black --- you don't think it can get any darker than this.\"")
}


explaning why you should do this... will be a bit difficult... hmm...

the 'if~else if~else' is one entire conditional block (pseodo-code):

result = 5

if (result = 1) -> then do script1 ~ nope, move onto the line below
else if (result = 2 -> then do script2 ~ nope, move onto the line below
else -> then do script3 ~ ah, yes, do script3

I'm having trouble showing a way of explaning this... so let's just ignore it for now (unless Pixie wants to elegantly~clearly explain it for me, unlike my difficulties in doing so, lol).

-------

P.S.

yes your code is fine, and yes, you'll have to actually create~set all those Attributes that you're using (remember the Attributes' 'names' must match up).

there's two ways to create Attributes:

before the game begins, via the GUI~Editor's:

'whatever' Object -> 'Attributes' Tab -> Attributes -> Add -> (see below)

(Object Name: whatever)
Attribute Name: whatever
Attribute Type: (string, integer, double, boolean, script, list, dictionary, etc)
Attribute Value: (whatever, but depends upon your Attribute Type choosen, of course)

or in code as a creation tag (using an Object as the source Element ~ or you can see further below with my example of using a Function as the source Element):

<object name="player">
<attr name="haircolor" type="string">pink</attr>
</object">


or during the game: via scripting:

scripting, unlike the the GUI~Editor's 'add attribute' or an in-code creation tag, can do: create~set, re-set ~ re-create, and~or alter~change any Attribute, not just merely create~set an Attribute.

via in the GUI~Editor:

(whatever source Element, such as an Object's Verb~Script Attribute, Command, Function, Turnscript, Timer, Object Type, etc) -> run as script -> add a script -> variables -> 'set a variable or attribute' Script -> (set it up, I think you can figure it out)

in code scripting (example using a Function as the source Element):

scripting (are the action~event code lines which do NOT have the '<xxx>xxx</xxx>' syntax, whereas the the 'creation tag' code lines do have the '<xxx>xxx</xxx>' syntax, and in this case we're altering ~ re-setting an Attribute, and also displaying a message additionally too): player.haircolor="black" // and more scripting: msg ("Whatever your hair color was, it is now black.")

<function name="function_1">
player.haircolor="black"
msg ("Whatever your hair color was, it is now black.")
</function>


-------

P.S.S.

the only other thing that is wrong with your code is that you might want to read my prior post's section on the 'old_haircolor' new Attribute creation, and apply that implementation logic your code. if you need help with it (doing and~or understanding), ask.

HegemonKhan
I edited in some stuff to my prior posts, so refresh and re-look at them.

--------

neonayon wrote:Oh...so should I add it to the "else" then? Instead of the "else if"? I understand the difference now I think.


-----------------

for having only 2 choices, you can use either method (pseudo-code):

(this is better to use, okum's razor: simpliest is best ~ actually this is not always true in my opinion but that gets into a big philosophical debate, laughs):

if
else

or (not as good to use, and only if you are NOT dealing with any non-opposing 'example: black vs red' conditional choices, differing from opposing choices, example 'true vs false ~ on vs off ~ binary 0 vs 1 ~ up vs down ~ in vs out ~ physics positive charge vs negative charge ~ etc etc etc' conditional chocies):

if
else if

--------------------

if you got 3 or more choices, then it must be:

if
else if
// as many additional 'else ifs' as you need, or no additional 'else ifs'

or

if
else if
// as many additional 'else ifs' as you need, no additional 'else ifs'
else

-------------

and for multiple conditionals (pseudo-code):

you code: [HK edit: my bad, this is missing the 'r' and you thus probably thought I was saying to use~code it in, but it should have been this: 'your code', as in trying to poorly~unclearly say that you are using multiple conditionals in your code, so you should seperate them to their own 'if~else if~else' script blocks, and them use pseudo-code below to just show the concept of it, but not as the actual code for you to use, so, my apologies]

conditional 1: 'if~else if~else' script block 1: haircolor

conditional 2: 'if~else if~else' script block 2: furcolor

if (not player.haircolor = "black") {
-> player.haircolor = "black"
} else {
-> msg ("Your hair is already black, silly.")
}
if (not player.furcolor = "black") {
-> player.furcolor = "black"
} else {
-> msg ("Your fur is already black, silly.")
}

script block 1:

if (not player.haircolor = "black") {
-> player.haircolor = "black"
} else {
-> msg ("Your hair is already black, silly.")
}

script block 2:

if (not player.furcolor = "black") {
-> player.furcolor = "black"
} else {
-> msg ("Your fur is already black, silly.")

Anonynn
[quote="HegemonKhan"]
if (not player.haircolor = "black") {
-> player.haircolor = "black"
} else {
-> msg ("Your hair is already black, silly.")
}
if (not player.furcolor = "black") {
-> player.furcolor = "black"
} else {
-> msg ("Your fur is already black, silly.")
}

script block 1:

if (not player.haircolor = "black") {
-> player.haircolor = "black"
} else {
-> msg ("Your hair is already black, silly.")
}

script block 2:

if (not player.furcolor = "black") {
-> player.furcolor = "black"
} else {
-> msg ("Your fur is already black, silly.")
}[/quote]


There were some major errors with these. I put them in the "add new script" like so...

Code View

if (not player.haircolor = "black") {
-> player.haircolor = "black"
} else {
-> msg ("Your hair is already black, silly.")
}
if (not player.furcolor = "black") {
-> player.furcolor = "black"
} else {
-> msg ("Your fur is already black, silly.")
}

if (not player.haircolor = "black") {
-> player.haircolor = "black"
} else {
-> msg ("Your hair is already black, silly.")
}

if (not player.furcolor = "black") {
-> player.furcolor = "black"
} else {
-> msg ("Your fur is already black, silly.")
}

Was that wrong? I thought that's what you meant by "script block" as in "add new script"

Sorry, I'm still trying to get the hang of this. If it means anything though, at the moment the black dye is working in the POV thing.

HegemonKhan
sorry, that was pseudo (fake-pretend) code (just to give example of concept of the coding logic ~ I'm lazy), and not actual code syntax, my bad.

--------------

here use this (from my middle'ish, ~2nd prior, post):

if (not player.haircolor = "black") {
player.old_haircolor = player.haircolor
// we saved the old 'haircolor' Attribute's Value as a new Attribute named 'player.old_haircolor' above, BEFORE we then change the 'player.haircolor' Attribute to its new Value of 'black' seen below
player.haircolor = "black"
msg ("You pop off the cork of the dye and then swish it around in the bottle a couple of times. Here goes nothing. You close your {player.eyecolor} eyes next, and lift the opening to your {player.lips} lips. Within moments, the cool liquid, which surprisingly tastes like liquorice is filling your mouth and flowing down your throat. You chug it until its finished and then set the bottle aside. Within moments, the black dye flows out from the roots of your {player.old_haircolor} hair to the tips giving you {player.hairlength} {player.haircolor} hair! Wow! That's pretty cool. You run your {player.hands} hands through your locks a couple of times.")
}
else {
msg ("\"Your hair is already black --- you don't think it can get any darker than this.\"")
}

if (not player.furcolor = "black") {
player.old_furcolor = player.furcolor
// we saved the old 'furcolor' Attribute's Value as a new Attribute named 'player.old_furcolor' above, BEFORE we then change the 'player.furcolor' Attribute to its new Value of 'black' seen below
player.furcolor = "black"
msg ("You pop off the cork of the dye and then swish it around in the bottle a couple of times. Here goes nothing. You close your {player.eyecolor} eyes next, and lift the opening to your {player.lips} lips. Within moments, the cool liquid, which surprisingly tastes like liquorice is filling your mouth and flowing down your throat. You chug it until its finished and then set the bottle aside. Within moments, the black dye flows out from the roots of your {player.old_furcolor} hair to the tips giving you {player.furcolor} hair! Wow! That's pretty cool.")
}
else {
msg ("\"Your fur is already black --- you don't think it can get any darker than this.\"")
}

HegemonKhan
I just edited in missing a line (tiny tweaks), so refresh and use the new code above.

HegemonKhan
neonayon wrote: I thought that's what you meant by "script block" as in "add new script"

Sorry, I'm still trying to get the hang of this. If it means anything though, at the moment the black dye is working in the POV thing.


you had it all as one 'if~else if~else' script block (due to what 'add a script' circle buttons you clicked on), producing this in code view:

if (not player.haircolor = "black") {
player.old_haircolor = player.haircolor
// we saved the old 'haircolor' Attribute's Value as a new Attribute named 'player.old_haircolor' above, BEFORE we then change the 'player.haircolor' Attribute to its new Value of 'black' seen below
player.haircolor = "black"
msg ("You pop off the cork of the dye and then swish it around in the bottle a couple of times. Here goes nothing. You close your {player.eyecolor} eyes next, and lift the opening to your {player.lips} lips. Within moments, the cool liquid, which surprisingly tastes like liquorice is filling your mouth and flowing down your throat. You chug it until its finished and then set the bottle aside. Within moments, the black dye flows out from the roots of your {player.old_haircolor} hair to the tips giving you {player.hairlength} {player.haircolor} hair! Wow! That's pretty cool. You run your {player.hands} hands through your locks a couple of times.")
} else if (not player.furcolor = "black") {
player.old_furcolor = player.furcolor
// we saved the old 'furcolor' Attribute's Value as a new Attribute named 'player.old_furcolor' above, BEFORE we then change the 'player.furcolor' Attribute to its new Value of 'black' seen below
player.furcolor = "black"
msg ("You pop off the cork of the dye and then swish it around in the bottle a couple of times. Here goes nothing. You close your {player.eyecolor} eyes next, and lift the opening to your {player.lips} lips. Within moments, the cool liquid, which surprisingly tastes like liquorice is filling your mouth and flowing down your throat. You chug it until its finished and then set the bottle aside. Within moments, the black dye flows out from the roots of your {player.old_furcolor} hair to the tips giving you {player.furcolor} hair! Wow! That's pretty cool.")
}
else {
msg ("\"Your 'hair_and_or_fur' is already black --- you don't think it can get any darker than this.\"")
}


whereas, you should have it (good luck figuring out what 'add a script' circle buttons to click on in the GUI~Editor, it's not easy!) as two separate 'if~else if~else' script blocks, which looks like this in code:

if (not player.haircolor = "black") {
player.old_haircolor = player.haircolor
// we saved the old 'haircolor' Attribute's Value as a new Attribute named 'player.old_haircolor' above, BEFORE we then change the 'player.haircolor' Attribute to its new Value of 'black' seen below
player.haircolor = "black"
msg ("You pop off the cork of the dye and then swish it around in the bottle a couple of times. Here goes nothing. You close your {player.eyecolor} eyes next, and lift the opening to your {player.lips} lips. Within moments, the cool liquid, which surprisingly tastes like liquorice is filling your mouth and flowing down your throat. You chug it until its finished and then set the bottle aside. Within moments, the black dye flows out from the roots of your {player.old_haircolor} hair to the tips giving you {player.hairlength} {player.haircolor} hair! Wow! That's pretty cool. You run your {player.hands} hands through your locks a couple of times.")
}
else {
msg ("\"Your hair is already black --- you don't think it can get any darker than this.\"")
}

if (not player.furcolor = "black") {
player.old_furcolor = player.furcolor
// we saved the old 'furcolor' Attribute's Value as a new Attribute named 'player.old_furcolor' above, BEFORE we then change the 'player.furcolor' Attribute to its new Value of 'black' seen below
player.furcolor = "black"
msg ("You pop off the cork of the dye and then swish it around in the bottle a couple of times. Here goes nothing. You close your {player.eyecolor} eyes next, and lift the opening to your {player.lips} lips. Within moments, the cool liquid, which surprisingly tastes like liquorice is filling your mouth and flowing down your throat. You chug it until its finished and then set the bottle aside. Within moments, the black dye flows out from the roots of your {player.old_furcolor} hair to the tips giving you {player.furcolor} hair! Wow! That's pretty cool.")
}
else {
msg ("\"Your fur is already black --- you don't think it can get any darker than this.\"")
}

The Pixie
HegemonKhan wrote:@ Pixie:

(I was~am just putting in the spacing to help neon in reading it, though didn't realize it would create an error, which would~will be worse for neon, doh! oopsy!)

but wouldn't this not work, as can be seen with this:

(err... well I think it works... but it's poor in terms of logic in coding... not the best example, but I think it makes my point?)

msg ( " { if not player.has_tail : You now have a tail. } " )
player.has_tail=true

msg ( " { if player.has_tail : You already have a tail, silly. } " )

}

Think about what happens if player.has_tail is false. Line 1, the player sees "You now have a tail." In line 2, player.has_tail is set to true. Now we get to line 3, and now player.has_tail is true, so the player also sees "You already have a tail, silly.".

Better:
msg ( "{ if not player.has_tail : You now have a tail. } {if player.has_tail : You already have a tail, silly. }  " )
player.has_tail=true

The Pixie
The way I approach the if/else thing is to go through all the conditions that will prevent the character doing what the player wants to in turn.
// Each if tests a condition for failure, and gives an appropriate message if necessary
if (not player.parent = right_room) {
msg("You cannot do that here")
}
else if (not player.has_tail) {
msg("You cannot do that without a tail.")
}
else if (not scredriver.parent = player) {
msg("You need a screwdriver to do that.")
}
// If we get to here, we know the character can do it!
// Give a message, then update the game world.
else {
msg("Holdingthe screwdrive in your tail, you prize out the dilithium crystal.")
dilithium.parent = player
}

Anonynn
Hah, that was an ordeal. Thank you both so much!


With that taken care of though, I have another dilemma.

Is there a feasible way for a "potion" to have a duration period? Like after drinking it you steadily gain a lot of weight over a period of time, for example and once the duration ends it leaves the player slightly different from when they started. Weight-wise in this example.

HegemonKhan
I'll let Pixie handle it, as he~she can do fancy stuff with spells (duration, canceling, different types of spells~effects, and etc), whereas I'm still learning.

So he~she can help you very well with any duration stuff you want.

-------

though for a basic start with it:

take a look into Turnscripts (internal turns) and~or Timers (real time: seconds)

http://docs.textadventures.co.uk/quest/ ... ripts.html (Tutorial: GUI~Editor usage guide)

http://docs.textadventures.co.uk/quest/ ... cript.html (code usage info)
http://docs.textadventures.co.uk/quest/ ... timer.html (code usage info)

Turnscripts and Timers are ~exactly like your GUI~Editor's Object's Verbs and the Functions, in that you just 'add a script' to them.

I don't like working with Timers, as real time usage is very messy~difficult to work with ...

A Turnscript's usage of the internal turns, probably has you wondering what the internal turns are, Jay (~jaynnabonne) found them in the underlying ~ quest engine code, I wish I could find that post of his... but as far as I understood ~ can remember, basically~generally they are any action and~or clicking that you do while playing quest, advances the internal turns or counts as an internal turn.

What makes Turnscripts and Timers so useful is that they're like constantly (based on the internal turns for Turnscripts and for Timers, your selected interval of every X seconds, your Timer's scripts are run~executed~fired~activated) running~executing~activating~firing Functions (and Functions at their most basic usage is simply a container~basket for holding scripting: action~event code lines, which can then be used~call upon anywhere in your game's code). This goes very well for checking 'if' coding, for example: checking if you're dead (player.current_life <= 0) and if you are, the game ends:

(scroll down to the Turnscript tag block)

<asl version="550">
// blah library file code lines
<game name=xxx">
// blah code lines
</game>
// blah code stuff

<turnscript name="global_turnscript">
<enabled />
<script><![CDATA[
if (player.current_life <= 0) {
msg ("You died or were killed.")
msg ("GAME OVER")
finish
}
]]></script>
</turnscript>

// blah code stuff
</asl>


------------

or, for what you're asking for with a 'duration' effect (as an Integer Attribute to do the increasing~decreasing, aka the duration itself):

A Turnscript and~or Timer is great for checking and acting upon a 'duration' Integer Attribute.

---------

using a Timer is more direct~simple (it will do the duration for you, so in using a timer, you will *NOT* need a 'duration' Integer Attribute), but it comes with its own issues

using a Turnscript is a bit more work, but hopefully has less issues (poor XanMag, he~she really hates Turnscripts, winks)

and there's also the special 'changedAttribute_name' Script Attribute, but this isn't as well known for new people, though it's not too difficult to learn how to use it (maybe easier than Timers~Turnscripts), but it could cause issues with how internally the 'order of operations' of all the code~scripting works... whereas Turnscripts, especially, can work better you using for dealing with the internal 'order of operations' of all the code~scripting of your game.

http://docs.textadventures.co.uk/quest/ ... anges.html (the special 'changed' Script Attribute)

--------

the 'duration' Attribute creation:

'potion_1' Object -> 'Attributes' Tab -> Attributes -> Add -> (see below)

(Object Name: potion_1)
Attribute Name: duration
Attribute Type: int (int is short for integer)
Attribute Value: (either start at 0 and increase upwards, or start at say 50 for example, and decrease down to 0. the increasing or decreasing we'll get to later though, that doesn't happen right here, lol)

in code: potion_1.duration=0

and

(Object Name: potion_1)
Attribute Name: has_consumed
Attribute Type: boolean
Attribute Value: false

then in~for your Turnscript (scroll down to the Turnscript tag block):

<asl version="550">
// blah library file code lines
<game name=xxx">
// blah code lines
</game>
// blah code stuff

<object name="room">
</object>

<object name="player">
<alias>HK</alias>
<parent type="object">room</parent>
<attr name="weight" type="int">180</attr> // I wish I was young again and only 180 lbs, lol.
</object>

<object name="potion_1">
<alias>potion</alias>
<parent type="object">room</parent>
<attr name="duration" type="int">0</attr>
</object>

<turnscript name="global_turnscript">
<enabled />
<script><![CDATA[
if (potion_1.duration = 50) {
msg ("finally the weight gain from drinking that blasted potion, has stopped, but poor HK is 50 more lbs heavier than he already was, dangit!")
// we also probably want to reset the potion's duration back to zero (as HK is stupid, and will likely drink it again... hey, it tasted so good!, lol), and also change the potion's 'has_consumed' Boolean Attribute back to 'false' again:
potion_1.duration = 0
potion_1.has_consumed = false
} else {
if (potion_1.has_consumed = true) {
// this is how we increase Attributes, and we want to increase both the potion's duration and the player's weight:
potion_1.duration = potion_1.duration + 1
player.weight = player.weight + 1
msg ("HK thinks that delicious tasting potion is making him heavier... nah it's just his imagination... no way something that good tasting can be bad for his health! Never!")
}
}
]]></script>
</turnscript>

// blah code stuff
</asl>


------

lastly, in the GUI~Editor, I don't know why but the 'Turnscript' is missing from the left side's 'tree of stuff', when its 'twin' Timer is there. So, to find the Turnscript, you can either go to the bar at the top of the screen, under 'add', and choose Turnscript, but this will create it in whatever you got highlighted on the left side's 'tree of stuff', so if you want the Turnscript to be local (it only works in a specific Room), then click on that specific Room in the 'tree of stuff' so it is highlighted and then at the top bar under 'add' select the 'turnscript', or if you want the Turnscript to be global (it works no matter where you are in your game), then click on the upper left most 'object' in your 'tree of stuff' so it is highlighted, as this ensures that when you then go to the top bar, under 'add', and choose 'Turnscript' that it becomes a global Turnscript. Also, I think you can right-click on the left side's 'tree of stuff' to get the option of 'add turnscript' also, instead of using the bar at the top, under its 'add' button.

------

@neonayon:

did you get your 'haircolor and etc' game stuff that you wanted to work? or, you still are trying to troubleshoot~get it to work?

-------------

@Pixie:

thanks for that post, as I totally forgot that you can put all the conditionals on one 'msg' code line via the text processor commands (I'm still getting used to it, still too used to the vertical order of operations of not using the text processor commands).

Anonynn
I'll check out the turn-scripts then, and yes, I believe they are working, although, I'll have to go back to the Cat Nip item and make sure that it matches all the attributes that the player object has, so that it works in the POV as well when someone uses it.

Thank you again so far!

XanMag
Hye. Neonayon. Can I send you a PM? Let me know where to send it if that is okay. You can PM me or post here. Thanks!

Anonynn
XanMag wrote:Hye. Neonayon. Can I send you a PM? Let me know where to send it if that is okay. You can PM me or post here. Thanks!


Of course you can.

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

Support

Forums