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)
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)
<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>
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)
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.
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!")
}
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.
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)
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.
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.
[Set variable] player.haircolour = [expression] "brunette"
player.haircolour = "brunette"
<!--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>
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."
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.\"")
}
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] ) {
run as script -> add new script -> scripts -> 'if' Script -> [EXPRESSION] -> (see below)
not player.haircolor = "pink"
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.\"")
}
msg ( " { if not player.has_tail : " + set (player, "has_tail", true) + " You now have a tail. } " )
msg ( " { if not player.has_tail : You now have a tail. } " )
// I know this doesn't work, lol
player.has_tail=true
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}."
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] ) {
run as script -> add new script -> scripts -> 'if' Script -> [EXPRESSION] -> (see below)
not player.haircolor = "pink"
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
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. } " )
}
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.\"")
}
<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>
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.
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.
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.
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.\"")
}
<object name="player">
<attr name="haircolor" type="string">pink</attr>
</object">
<function name="function_1">
player.haircolor="black"
msg ("Whatever your hair color was, it is now black.")
</function>
neonayon wrote:Oh...so should I add it to the "else" then? Instead of the "else if"? I understand the difference now I think.
[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]
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.\"")
}
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.
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.\"")
}
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 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. } " )
}
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
// 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
}
<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>
<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>