msg ("Are you a male?")
(you type in: "yes" or "no" ~ or you select from the popup menu window ~ not sure how it runs, lol)
// the "ask" function automatically sets: result = (user's typed in input or selected choice from the popup menu window)
// "yes" = true
// "no" = false
if (result=true) {
-> msg ("indeed, you're a male.")
-> msg ("as a male, you have an extra amount of strength")
-> player.strength = player.strength + 1
} else if (result=false) {
-> msg ("No, you're not a male. You're a female instead.")
-> msg ("as a female, you have an extra amount of agility")
-> player.agility = player.agility + 1
}Code: Select all<!--Saved by Quest 5.3.4762.29157-->
<asl version="530">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="Testing Game Stuff">
<gameid>d83ba5bb-2e3c-4f31-80c9-3e88a2dc082c</gameid>
<version>1.0</version>
<turns type="int">0</turns>
<statusattributes type="stringdictionary">turns = </statusattributes>
<hint_list type="list">null_hint</hint_list>
<autodisplayverbs type="boolean">false</autodisplayverbs>
<pov type="object">player</pov>
<start type="script">
character_creation
</start>
<hint_dict type="scriptdictionary">
<item key="doormat_hint">
msg ("Try to pull the doormat. Type in: pull doormat")
</item>
</hint_dict>
</game>
<object name="homeyard">
<inherit name="editor_room" />
<object name="player">
<inherit name="defaultplayer" />
<inherit name="editor_player" />
<drop type="boolean">false</drop>
<displayverbs>Look at</displayverbs>
<inventoryverbs>Look at; Use; Drop</inventoryverbs>
</object>
<object name="guide">
<inherit name="editor_object" />
<drop type="boolean">false</drop>
<displayverbs>Look at; Hint</displayverbs>
<inventoryverbs>Look at; Use; Drop</inventoryverbs>
<hint type="script">
show menu ("Hint about what?", game.hint_list, false) {
switch (result) {
case ("null_hint") {
msg ("No hints are available")
}
case ("doormat_hint") {
msg (ScriptDictionaryItem (game.hint_dict,"doormat_hint"))
}
}
}
</hint>
</object>
<exit name="to_frontyard" to="frontyard" />
</object>
<object name="frontyard">
<inherit name="editor_room" />
<object name="doormat">
<inherit name="editor_object" />
<drop type="boolean">false</drop>
<displayverbs>Look at</displayverbs>
<pull type="script">
MakeObjectVisible (frontdoorkey)
msg ("You found a key under the doormat")
</pull>
<look type="script">
list add (game.hint_list, "doormat_hint")
msg ("Your guide has a new hint for you now")
</look>
</object>
<object name="frontdoorkey">
<inherit name="editor_object" />
<alias>key</alias>
<drop />
<take />
<visible type="boolean">false</visible>
</object>
<exit name="to_homeyard" to="homeyard" />
</object>
<turnscript name="game_turns">
<enabled />
<script>
if (frontdoorkey.parent = player) {
msg ("You've won the game!")
finish
}
game.turns = game.turns + 1
</script>
</turnscript>
<verb>
<property>hint</property>
<pattern>hint</pattern>
<defaultexpression>"You can't hint " + object.article + "."</defaultexpression>
</verb>
<function name="character_creation">
msg ("What is your name?")
get input {
player.alias = result
msg (" - " + player.alias)
show menu ("What is your gender?", split ("male;female",";"), false) {
player.gender = result
show menu ("What is your race?", split ("american;european;african;asian",";"), false) {
player.race = result
show menu ("What is your eye color?", split ("blue;green;hazel;amber;brown",";"), false) {
player.eye_color = result
show menu ("What is your hair color?", split ("yellow;orange;red;brown;black;grey;white",";"), false) {
player.hair_color = result
show menu ("What is your skin color?", split ("white;light;tan;dark;red;brown;black",";"), false) {
player.skin_color = result
show menu ("What is your maturity?", split ("adult;teen;child",";"), false) {
player.maturity = result
msg ("What is your age?")
get input {
player.age = result
msg (" - " + player.age)
msg (player.alias + " is a " + player.age + " year old " + player.gender + " " + player.race + " " + player.maturity + " with " + player.eye_color + " eyes, " + player.hair_color + " hair, and " + player.skin_color +" skin.")
wait {
ClearScreen
}
}
}
}
}
}
}
}
}
</function>
</asl>Code: Select all<asl version="530">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="StringDicTest">
<gameid>490059fa-4154-4263-afa3-33dab1095527</gameid>
<version>1.0</version>
<firstpublished>2013</firstpublished>
</game>
<object name="room">
<inherit name="editor_room" />
<object name="player">
<inherit name="editor_object" />
<inherit name="editor_player" />
</object>
<object name="npc">
<inherit name="editor_object" />
<conversation type="stringdictionary">1 = A;2 = B;3 = C</conversation>
<speak type="script">
msg (StringDictionaryItem (this.conversation , ToString (GetRandomInt (1,3))))
</speak>
</object>
</object>
</asl>Code: Select all<!--Saved by Quest 5.2.4515.34846-->
<asl version="520">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="Testing Game Stuff">
<gameid>cd102f9d-370a-4bda-b6ea-ca42288f619c</gameid>
<version>1.0</version>
<start type="script">
question1
</start>
</game>
<object name="room">
<inherit name="editor_room" />
<object name="player">
<inherit name="defaultplayer" />
<answer1>HK</answer1>
</object>
</object>
<function name="question1">
msg ("To proceed, you must answer the question correctly")
msg ("What is my name? Answer: HK")
get input {
msg (result)
if (player.answer1 = result) {
msg ("You got the answer right, you may proceed")
}
else {
msg ("Wrong answer, try again")
question1
}
}
</function>
</asl>Code: Select all<asl version="540">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="Testing Game Stuff">
<gameid>eef801a1-4e6b-4b0a-bdbf-8f3ecfa8389c</gameid>
<version>1.0</version>
<firstpublished>2013</firstpublished>
<turns type="int">0</turns>
<statusattributes type="simplestringdictionary">turns=</statusattributes>
<start type="script">
msg ("Important Note:")
msg ("Type in: help")
</start>
</game>
<object name="homeland">
<inherit name="editor_room" />
<object name="player">
<inherit name="editor_object" />
<inherit name="editor_player" />
</object>
</object>
<object name="grassland">
<inherit name="editor_room" />
</object>
<object name="plains">
<inherit name="editor_room" />
</object>
<object name="desert">
<inherit name="editor_room" />
</object>
<object name="tundra">
<inherit name="editor_room" />
</object>
<object name="swampland">
<inherit name="editor_room" />
</object>
<object name="mountains">
<inherit name="editor_room" />
</object>
<object name="forest">
<inherit name="editor_room" />
</object>
<object name="wasteland">
<inherit name="editor_room" />
</object>
<object name="coastland">
<inherit name="editor_room" />
</object>
<object name="hills">
<inherit name="editor_room" />
</object>
<command name="help_command">
<pattern>help</pattern>
<script>
help_function
</script>
</command>
<command name="explore_command">
<pattern>explore</pattern>
<script>
explore_function
</script>
</command>
<command name="travel_command">
<pattern>travel</pattern>
<script>
travel_function
</script>
</command>
<object name="data_object">
<inherit name="editor_object" />
<travel_string_list type="simplestringlist">homeland</travel_string_list>
<homeland_events_string_list type="simplestringlist">grassland_discovery;plains_discovery;desert_discovery;tundra_discovery;swampland_discovery;forest_discovery;mountains_discovery;hills_discovery;wasteland_discovery;coastland_discovery</homeland_events_string_list>
<homeland_events_script_dictionary type="scriptdictionary">
<item key="grassland_discovery">
list add (data_object.travel_string_list, "grassland")
msg ("You've discovered the grassland! Now, you can travel to the grassland and explore it!")
</item>
<item key="plains_discovery">
list add (data_object.travel_string_list, "plains")
msg ("You've discovered the plains! Now, you can travel to the plains and explore it!")
</item>
<item key="desert_discovery">
list add (data_object.travel_string_list, "desert")
msg ("You've discovered the desert! Now, you can travel to the desert and explore it!")
</item>
<item key="tundra_discovery">
list add (data_object.travel_string_list, "tundra")
msg ("You've discovered the tundra! Now, you can travel to the tundra and explore it!")
</item>
<item key="swampland_discovery">
list add (data_object.travel_string_list, "swampland")
msg ("You've discovered the swampland! Now, you can travel to the swampland and explore it!")
</item>
<item key="forest_discovery">
list add (data_object.travel_string_list, "forest")
msg ("You've discovered the forest! Now, you can travel to the forest and explore it!")
</item>
<item key="mountains_discovery">
list add (data_object.travel_string_list, "mountains")
msg ("You've discovered the mountains! Now, you can travel to the mountains and explore it!")
</item>
<item key="hills_discovery">
list add (data_object.travel_string_list, "hills")
msg ("You've discovered the hills! Now, you can travel to the hills and explore it!")
</item>
<item key="wasteland_discovery">
list add (data_object.travel_string_list, "wasteland")
msg ("You've discovered the wasteland! Now, you can travel to the wasteland and explore it!")
</item>
<item key="coastland_discovery">
list add (data_object.travel_string_list, "coastland")
msg ("You've discovered the coastland! Now, you can travel to the coastland and explore it!")
</item>
</homeland_events_script_dictionary>
</object>
<turnscript name="global_turnscript">
<enabled />
<script>
game.turns = game.turns + 1
</script>
</turnscript>
<function name="help_function">
msg ("Type 'explore' to explore your area.")
msg ("Type 'travel' to travel to different areas.")
</function>
<function name="explore_function"><![CDATA[
switch (game.pov.parent) {
case (homeland) {
result_1 = ListCount (data_object.homeland_events_string_list) - 1
if (result_1 >= 0) {
result_2 = StringListItem (data_object.homeland_events_string_list,GetRandomInt(0,result_1))
invoke (ScriptDictionaryItem (data_object.homeland_events_script_dictionary,result_2))
on ready {
foreach (item_x, split ("grassland_discovery;plains_discovery;desert_discovery;tundra_discovery;swampland_discovery;forest_discovery;mountains_discovery;hills_discovery;wasteland_discovery;coastland_discovery",";")) {
if (result_2 = item_x) {
list remove (data_object.homeland_events_string_list, result_2)
}
}
}
} else {
msg ("There seemingly is nothing left to explore in this area.")
}
}
}
]]></function>
<function name="travel_function">
show menu ("Where do you wish to travel?",data_object.travel_string_list,false) {
if (not game.pov.parent = GetObject (result)) {
game.pov.parent = GetObject (result)
} else {
msg ("You are already at this area.")
ask ("Try again?") {
if (result=true) {
travel_function
} else {
msg ("You realize that you need to discover a new area to travel to first, before you can travel to that place.")
}
}
}
}
</function>
</asl>HegemonKhan Posts: 569Joined: Thu Dec 06, 2012 2:11 am
Code: Select all<asl version="540">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="Testing Game Stuff">
<gameid>d67ec73f-f879-4911-9d88-c02ea527c534</gameid>
<version>1.0</version>
<firstpublished>2013</firstpublished>
</game>
<object name="room">
<inherit name="editor_room" />
<object name="player">
<inherit name="editor_object" />
<inherit name="editor_player" />
</object>
<object name="wise_owl_npc">
<inherit name="editor_object" />
<alias>Wise Owl</alias>
<displayverbs type="stringlist">
<value>Inquire</value>
</displayverbs>
<inquire type="script">
show menu ("What do you wish to inquire about?", global_data_object.inquire_topics_string_list, false) {
invoke (ScriptDictionaryItem (global_data_object.inquire_topics_script_dictionary, result))
}
</inquire>
</object>
</object>
<object name="global_data_object">
<inherit name="editor_object" />
<inquire_topics_string_list type="stringlist">
<value>princess</value>
<value>sword</value>
<value>dragon</value>
</inquire_topics_string_list>
<dragon_topics_string_list type="stringlist">
<value>weakness</value>
<value>location</value>
</dragon_topics_string_list>
<inquire_topics_script_dictionary type="scriptdictionary">
<item key="princess">
msg ("The princess has been captured by the dragon. Rescue her, and the King will wed thee to her, as his heir to his throne and kingdom! You'll become the new king of this land!")
</item>
<item key="sword">
msg ("Ah the legendary dragon slayer sword, magically forged... and guarded by a powerful sorcerer...")
</item>
<item key="dragon">
show menu ("What about the dragon do you wish to know?", global_data_object.dragon_topics_string_list, false) {
invoke (ScriptDictionaryItem (global_data_object.inquire_topics_script_dictionary, result))
}
</item>
<item key="weakness">
msg ("Only the legendary dragon slayer sword can pierce its adamantium scales and thus kill it")
</item>
<item key="location">
msg ("within the volcano in the lava scorched wasteland far to the eastern edge of this world")
</item>
</inquire_topics_script_dictionary>
</object>
<verb name="inquire">
<property>inquire</property>
<pattern>Inquire</pattern>
</verb>
</asl>Code: Select all<asl version="540">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="Testing Game Stuff">
<gameid>eef801a1-4e6b-4b0a-bdbf-8f3ecfa8389c</gameid>
<version>1.0</version>
<firstpublished>2013</firstpublished>
<turns type="int">0</turns>
<statusattributes type="simplestringdictionary">turns=</statusattributes>
<start type="script">
msg ("Important Note:")
msg ("Type in: help")
</start>
</game>
<ob
switch (game.pov.radiation_level) {
-> case ("25") {
->-> msg ("you're just mildly sun-burned, it's not that big of a deal.")
-> }
-> case ("75") {
->-> msg ("your skin has been mutated into mud, sliding right off your body on its own, or when you itch~rub yourself, taking your skin right off your body")
-> }
}if (HasInt (game.pov.radiation_level) = true) { // I tried to make this as code viable as possible, lol
-> if (game.pov.radiation_level=25) {
->-> msg ("you're just mildly sun-burned, it's not that big of a deal.")
-> } else if (game.pov.radiation_level=75) {
->-> msg ("your skin has been mutated into mud, sliding right off your body on its own, or when you itch~rub yourself, taking your skin right off your body")
-> }
}-
if (enemy=null) {
msg ("There seemingly is no " + text + " here.")
} else if (not check_reachable_function (enemy) = true) {
msg ("There seemingly is no " + enemy.alias + " here.")
} else if (not DoesInherit (enemy,"character_object_type")) {
msg (enemy.alias + "is seemingly not something that you can battle.")
} else if (GetBoolean (enemy,"hostile") = false) {
msg (enemy.alias + " is seemingly not something that you can battle.")
} else if (GetBoolean (enemy,"dead") = true) {
msg (enemy.alias + " is already dead.")
} else {
battle_sequence_function (self,enemy)
}
case ("Attack") {
self_attack_failed = false
if (RandomChance (GetInt (enemy,"agility") - GetInt (self,"speed")) = true) {
msg (enemy.alias + "evaded your attack!")
self_attack_failed = true
self.defending = false
} else if (RandomChance (GetInt (enemy,"dexterity") - GetInt (self,"agility")) = true) {
msg (enemy.alias + "parried your attack!")
if (RandomChance (75)=true) {
// you got a 75% or 3/4 chance of your "card" being a six
-> msg ("the card is a six")
}
if (RandomChance (75)=false) {
// you got a 25% or 1/4 chance of your "card" being a six
-> msg ("the card is a six")
}
if (RandomChance (25)=true) {
// you got a 25% or 1/4 chance of your "card" being a six
-> msg ("the card is a six")
}
if (RandomChance (25)=false) {
// you got a 75% or 3/4 chance of your "card" being a six
-> msg ("the card is a six")
}
... )
result = GetRandomInt (1,5) // quest game engine will "randomly" select amongst: 1, 2, 3, 4, or 5
-> switch (result) {
->-> case ("1") {
->->-> // whatever script you want, for example: msg ("about the dragon")
->-> }
->-> case ("2") {
->->-> // whatever script you want, for example: msg ("about the princess")
->-> }
->-> case ("3") {
->->-> // whatever script you want, for example: msg ("about the treasure")
->-> }
->-> case ("4") {
->->-> // whatever script you want, for example: msg ("about the dragon slayer sword")
->-> }
->-> case ("5") {
->->-> // whatever script you want, for example: msg ("about the etc...")
->-> }
-> }
}
this is the code boxHK wrote:this is a quote box
Code: Select all<game name="blah">
// blah scripts ~ code lines
<start type="script">
character_creation_function
</start>
</game>
<function name="character_creation_function">
alias_character_creation_function
on ready {
age_character_creation_function
on ready {
gender_character_creation_function
on ready {
// etc functions
}
}
}
</function>
<function name="alias_character_creation_function">
msg ("What is your name?")
get input {
game.pov.alias=result
}
</function>
<function name="age_integer_character_creation_function">
msg ("What is your age?")
get input {
if (IsInt (result) = true) {
game.pov.age_integer = ToInt (result)
on ready {
age_string_character_creation_function
}
} else if (IsInt (result) = false) {
msg ("Please type in a number for your age.")
age_integer_character_creation_function
}
}
</function>
<function name="age_string_character_creation_function"><![CDATA[
if (game.pov.age_integer < 0) {
game.pov.age_integer = 0
}
if (game.pov.age_integer >= 0 and game.pov.age_integer < 4) {
game.pov.age_string = "baby"
} else if (game.pov.age_integer >= 4 and game.pov.age_integer < 13) {
game.pov.age_string = "child"
} else if (game.pov.age_integer >= 13 and game.pov.age_integer < 20) {
game.pov.age_string = "teen"
} else if (game.pov.age_integer >= 20) {
game.pov.age_string = "adult"
}
]]></function>
<function name="gender_character_creation_function">
show menu ("What is your gender?", split ("male;female",";"), false) {
game.pov.gender_string = result
}
</function>
// etc *.character_creation_functions functions
<command name="character_attributes_command">
<pattern>show char</pattern>
<script>
character_attributes_function
</script>
</command>
<function name="character_attributes_function">
msg (game.pov.alias)
msg (game.pov.age_integer)
msg (game.pov.age_string)
msg (game.pov.gender_string)
msg (game.pov.race_string)
msg (game.pov.class_string)
msg (game.pov.level_integer)
msg (game.pov.experience_integer)
msg (game.pov.cash_integer)
msg (game.pov.hit_points_integer)
msg (game.pov.mana_points_integer)
msg (game.pov.strength_integer)
msg (game.pov.endurance_integer)
// etc attributes
</function>
HegemonKhan wrote:
charge your father-in-law for the IT support
(just joking)
if (IsSwitchedOn(A)) {
msg ("</br><1> \"Some text\"")
}
if (IsSwitchedOn(B)) {
msg (" </br><2> \"Some text\"")
}
if (IsSwitchedOn(C)) {
msg ("</br><3> \"Some text\"")
}
get input {
switch (result) {
case (1) {
msg ("</br>\"text\"</br><br/><6> \"text.\"</br>")
SwitchOff (A)
}
case (2) {
msg ("</br>\"text.\"</br><br/><4> \"text\"</br><br/><5> \"text\"")
SwitchOff (B)
}
case (3) {
msg ("</br>\"text.\"</br><br/><4> \"text\"</br><br/><5> \"text\"")
SwitchOff (C) }
}
get input {
switch (result) {
case (4) {
msg ("</br>\"text"</br><br/><8> \"text\"</br>")
}
case (5) {
msg ("</br>\Itext\"</br><br/><8> \"text\"</br>")
}
case (6) {
msg ("</br>\"text</br><br/>\"text\"</br><br/><10> text")
}
}
get input {
switch (result) {
case (8) {
msg ("</br>\"text?\"</br><br/> \"text\"</br><br/><15> text")
}
case (10) {
msg ("</br><11> \"text\"</br><br/><12> \"text\"</br><br/><13> \"text\"</br><br/><14> \"text\"</br>")
}
}
get input {
switch (result) {
case (11) {
msg ("</br>\"text\" </br><br/><20> \"text"")
}
case (12) {
msg ("</br>\"text.\"</br><br/><29> \"text\"")
}
case (13) {
msg ("</br>\"text\"</br><br/><33> \"text\"</br><br/><34> \"text\"")
}
case (14) {
msg ("</text\"</br><br/><35> \"text\"</br><br/><36> \"text\"")
}
case (15) {
msg ("</br><16> \"text\"</br><br/><17> \"text\"</br><br/><18> \"text\"</br><br/><19> \"text\"</br>")
}
}<function name="age_integer_function">
msg ("What is your age?")
get input {
if (IsInt (result) = true) {
game.pov.age_integer = ToInt (result)
} else if (IsInt (result) = false) {
age_integer_function
}
}
</function>
if (game.pov.age_integer < 0) {
game.pov.age_integer = 0
}
<function name="day_of_birth_integer_function"><![CDATA[
msg ("What is your day of birth?")
get input {
if (IsInt (result) = false) {
day_of_birth_integer_function
} else if (IsInt (result) = true) {
// result may need to be converted into an integer
if (game.pov.month_string = "january" or game.pov.month_string = "march" or game.pov.month_string = "may" or game.pov.month_string = "july" or game.pov.month_string = "august" or game.pov.month_string = "october" or game.pov.month_string = "december") {
if (result > 0 and result < 32) {
game.pov.day_integer = ToInt (result)
} else if (result < 1 or result > 31) {
day_of_birth_integer_function
}
} else if (game.pov.month_string = "april" or game.pov.month_string = "june" or game.pov.month_string = "september" or game.pov.month_string = "november") {
if (result > 0 and result < 31) {
game.pov.day_integer = ToInt (result)
} else if (result < 1 or result > 30) {
day_of_birth_integer_function
}
} else if (game.pov.month_string = "february") {
if (global_data_object.year_integer = global.data_object.old_leap_year_integer) {
if (result > 0 and result < 30) {
game.pov.day_integer = ToInt (result)
} else if (result < 1 or result > 29) {
day_of_birth_integer_function
}
} else if (global_data_object.year_integer <> global.data_object.old_leap_year_integer) {
if (result > 0 and result < 29) {
game.pov.day_integer = ToInt (result)
} else if (result < 1 or result > 28) {
day_of_birth_integer_function
}
}
}
}
}
]]></function>
<function name="year_of_birth_integer_function"><![CDATA[
msg ("What is your year of birth?")
msg ("Please type in 4 numbers")
get input {
if (IsInt (result) = false) {
year_of_birth_integer_function
} else if (IsInt (result) = true) {
// result may need to be converted into an integer
if (LengthOf (result) <> 4) {
year_of_birth_integer_function
} else if (LengthOf (result) = 4) {
if (result < 1900) {
year_of_birth_integer_function
} else if {result >= 1900) {
game.pov.year_integer = ToInt (result)
}
}
}
}
]]></function>