<command name="saying">
<pattern>say #text_talk# to #object_one#</pattern>
<script>
switch (object_one) {
case (troll) {
msg ("You say: " + text_talk)
msg ("The troll grunts but otherwise ignores you.")
}
case (bob) {
msg ("You say: " + text_talk)
msg ("Bob smiles back at you.")
}
default {
msg ("You say: " + text_talk + " but the " + object_one.name + " says nothing, possible because, you know, it cannot speak.")
}
}
</script>
</command>
HegemonKhan wrote:what, I'd like to understand is why is it also applying the command "saying" ( say #text_talk# to #object_troll# ) to Bob, when shouldn't it be only applying to troll due to the:
#object_troll#
object_troll.parent
object_troll.name
I don't understand why-how it is applying to Bob as well.
(@Pixie, this needs a bit further coding, like with the defibrillator, as Bob is either dead or alive, wink. I'm just enjoying this small teasing of you, on forgetting, or not realizing, due to probably not needing to go through-use the tutorial, as I've been doing and needing, on this problem with Bob, hehe)
what does the "_" (underscore), like in "object_troll" do and-or is for? Is it like the "." (dot) in player.alias or eggs.weight but with a different purpose, or does the "_" (underscore) have no purpose, and it's just to separate the "#text#" from the "#text_talk#" or the "troll" from "object_troll" ??
msg ("You say: " + text_talk)
s = ToString(34)
msg ("You say: " + text_talk)
<start type="stript">
msg ("Let's generate a character...")
msg ("First, what is your name?")
get input {
player.alias = result
msg ("Hi, " + player.alias)
show menu ("Your gender?", game.gender_list, false) {
player.gender = result
show menu ("Your skill set?", game.class_list, false) {
player.class = result
msg (" ")
msg (player.alias + " was a " + LCase (player.gender) + " " + LCase (player.class) + ".")
msg (" ")
msg ("Now press a key to begin...")
wait {
ClearScreen
}
}
}
}
</start>
<start type="script">
// Here "msg" is a script command, what string is sent to it will appear on the screen
msg ("Let's generate a character...")
// And again
msg ("First, what is your name?")
// Another script command, "get input". Waits for the player to type something,
// puts that text into a variable called "result",
// then runs its 'block'. The block is enclosed in curly braces.
get input {
// The "player" object has an attribute "alias" that is
// now set to the text in the "result" variable.
player.alias = result
// Now use "msg" to print to the screen, but this time the text is constructed
// by adding together two parts, using the plus sign.
msg ("Hi, " + player.alias)
// I have broken one line into two for simplicity
// The "Split" function breaks up a string of text into set of smaller strings,
// called a 'string list'.
// Here it will break up "Male;Female", and it will break the string wherever it
// find a semi-colon, as the second paramter is ";".
// The variable "options" will contain the output of the function.
options = Split ("Male;Female", ";")
// The "show menu" scrpt command will display a menu for the player.
// The "Your gender?" part will be the prompt or title.
// Then it will use the variable "options", which we just set. So the player will
// have the choice of "Male" or "Female".
// Finally we have "false", which tells Quest not to let the player cancel the menu
// choice.
// As with "get input", when the player makes a choice, the text goes into "result"
// and the block is run.
show menu ("Your gender?", options, false) {
// The "gender" attribute of "player" is now set to "Male" or "Female",
// as the player chose
player.gender = result
// Another menu, just like before, but here the two lines are combined
// You have the prompt, the string list with the option from the "Split"
// function, and "false" again.
show menu ("Your character class?", Split ("Warrior;Wizard;Priest;Thief", ";"), false) {
// The "class" attribute of "player" is now set.
player.class = result
// Print an empty line.
msg (" ")
// Print a summary to screen
msg (player.alias + " was a " + LCase (player.gender) + " " + LCase (player.class) + ".")
// Print an empty line.
msg (" ")
// Print instructions.
msg ("Now press a key to begin...")
// The "wait" script command is kind of like "get input", but instead of the player
// typing a sentence, the player presses a single key. Once that happens,
// the code in that box runs
wait {
// This function clears the screen, as you probably guessed
ClearScreen
// This is the end of the "wait" block.
}
// This is the end of the second "show menu" block.
}
// This is the end of the first "show menu" block.
}
// This is the end of the "get input" block.
}
</start>
<start type="script">
// Here "msg" is a script command, what string is sent to it will appear on the screen
msg ("Let's generate a character...")
// And again
msg ("First, what is your name?")
// Another script command, "get input". Waits for the player to type something,
// puts that text into a variable called "result",
// then runs its 'block'. The block is enclosed in curly braces.
get input {
// The "player" object has an attribute "alias" that is
// now set to the text in the "result" variable.
player.alias = result
// Now use "msg" to print to the screen, but this time the text is constructed
// by adding together two parts, using the plus sign.
msg ("Hi, " + player.alias)
// I have broken one line into two for simplicity
// The "Split" function breaks up a string of text into set of smaller strings,
// called a 'string list'.
// Here it will break up "Male;Female", and it will break the string wherever it
// find a semi-colon, as the second paramter is ";".
// The variable "options" will contain the output of the function.
[i][b]options = Split ("Male;Female", ";")[/b][/i]
// The "show menu" scrpt command will display a menu for the player.
// The "Your gender?" part will be the prompt or title.
// Then it will use the variable "options", which we just set. So the player will
// have the choice of "Male" or "Female".
// Finally we have "false", which tells Quest not to let the player cancel the menu
// choice.
// As with "get input", when the player makes a choice, the text goes into "result"
// and the block is run.
[b][i]show menu ("Your gender?", options, false) {[/i][/b]
[HK: original is, show menu ("Your gender?", game.gender_list, false) { ]
[HK: I'm guesing that the, options = Split ("Male;Female", ";"), is "I have broken one line into two for simplicity (pixie)", and this was taken out of the original code line, show menu ("Your gender?", game.gender_list, false) { , which internally does what you shown me in your explanation of breaking the one line into two for my simplicity]
// The "gender" attribute of "player" is now set to "Male" or "Female",
// as the player chose
player.gender = result
// Another menu, just like before, but here the two lines are combined
// You have the prompt, the string list with the option from the "Split"
// function, and "false" again.
[b][i]show menu ("Your character class?", Split ("Warrior;Wizard;Priest;Thief", ";"), false) {[/i][/b]
[HK: original is, show menu ("Your skill set?", game.class_list, false) { ]
[HK: I'm guesing that this is the same as with the gender above]
// The "class" attribute of "player" is now set.
player.class = result
// Print an empty line.
msg (" ")
// Print a summary to screen
msg (player.alias + " was a " + LCase (player.gender) + " " + LCase (player.class) + ".")
// Print an empty line.
msg (" ")
// Print instructions.
msg ("Now press a key to begin...")
// The "wait" script command is kind of like "get input", but instead of the player
// typing a sentence, the player presses a single key. Once that happens,
// the code in that box runs
wait {
// This function clears the screen, as you probably guessed
ClearScreen
// This is the end of the "wait" block.
}
// This is the end of the second "show menu" block.
}
// This is the end of the first "show menu" block.
}
// This is the end of the "get input" block.
}
</start>
<start type="stript">
msg ("Let's generate a character...")
msg ("First, what is your name?")
get input {
player.alias = result
msg ("Hi, " + player.alias)
show menu ("Your gender?", game.gender_list, false) {
player.gender = result
show menu ("Your skill set?", game.class_list, false) {
player.class = result
msg (" ")
msg (player.alias + " was a " + LCase (player.gender) + " " + LCase (player.class) + ".")
msg (" ")
msg ("Now press a key to begin...")
wait {
ClearScreen
}
}
}
}
</start>
<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">
msg ("What is your name?")
get input {
player.alias = result
show menu ("What is your gender?", split ("male;female" , ";"), false) {
player.gender = result
show menu ("What is your race?", split ("human;elf;dwarf" , ";"), false) {
player.race = result
show menu ("What is your class?", split ("Warrior;cleric;mage;theif" , ";"), false) {
player.class = result
msg (player.alias "is a" + LCase (player.gender) + " " + LCase (player.race) " + LCase (player.class).")
}
}
}
}
</start>
</game>
<object name="room">
<inherit name="editor_room" />
<object name="player">
<inherit name="defaultplayer" />
</object>
</object>
</asl>
<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">
msg ("Let's generate a character...")
msg ("First, what is your name?")
get input {
player.alias = result
msg ("Hi, " + player.alias)
show menu ("Your gender?", game.gender_list, false) {
player.gender = result
show menu ("Your skill set?", game.class_list, false) {
player.class = result
msg (" ")
msg (player.alias + " was a " + LCase (player.gender) + " " + LCase (player.class) + ".")
msg (" ")
msg ("Now press a key to begin...")
wait {
ClearScreen
}
}
}
}
</start>
<gender_list type="list">male; female</gender_list>
<class_list type="list">warrior; cleric; mage; theif</class_list>
</game>
<object name="room">
<inherit name="editor_room" />
<object name="player">
<inherit name="defaultplayer" />
</object>
</object>
</asl>
do I also need to create any lists (player.gender_list and player.class_list)...
show menu ("Your gender?", player.gender_list, false) {
... or attributes/variables (player.gender=male or female, and player.class=warrior or priest or wizard or thief), under the Object -> Game -> Attributes -> Add New Attributes ???
I just can't figure out how to do the string (message->expression) syntax for it, lol. I'm confused with the +'s and the "s
msg (player.alias "is a" + LCase (player.gender) + " " + LCase (player.race) " + LCase (player.class).")
msg (player.alias + "is a" + LCase (player.gender) + " " + LCase (player.race) + LCase (player.class) + ".")
<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">
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
if (HasAttribute(player, "male")) {
SetObjectFlagOn (player, "male")
}
else {
SetObjectFlagOn (player, "female")
}
show menu ("What is your race?", split ("human;elf;dwarf" , ";"), false) {
player.race = result
switch (player.race) {
case (human) {
SetObjectFlagOn (player, "human")
}
case (elf) {
SetObjectFlagOn (player, "elf")
}
case (dwarf) {
SetObjectFlagOn (player, "dwarf")
}
}
show menu ("What is your class?", split ("warrior;cleric;mage;thief" , ";"), false) {
player.class = result
switch (player.class) {
case (warrior) {
SetObjectFlagOn (player, "warrior")
}
case (cleric) {
SetObjectFlagOn (player, "cleric")
}
case (mage) {
SetObjectFlagOn (player, "mage")
}
case (thief) {
SetObjectFlagOn (player, "thief")
}
}
msg (player.alias + " is a " + LCase (player.gender) + " " + LCase (player.race) + " " + LCase (player.class) + ".")
}
}
}
}
</start>
</game>
<object name="room">
<inherit name="editor_room" />
<object name="player">
<inherit name="defaultplayer" />
<turns type="int">0</turns>
<statusattributes type="stringdictionary">turns = </statusattributes>
</object>
</object>
<turnscript name="turns script">
<enabled />
<script>
player.turns = player.turns + 1
</script>
</turnscript>
</asl>
jaynabonne wrote:I see something running through both of your questions. Let's tackle the first one first.
A word about variables: a simple variable name used in a script, one which is not an object or an attribute of an object, is always a local variable to that script. In other words, it only exists within that script, and it goes away when the script exits. As you discovered, while you remain within the script, the variable exists. Once it exits... poof! And same named variables used in different scripts are actually different, unrelated variables.
What you need is a global place to store your data. You almost (perhaps accidentally) got the answer in your question: "So is there any way to create and add to a list that is remembered by the game?"
The answer is to store the list as an attribute of the global game object (you could also store it as an attribute of the player). Instead of using CombatMenu, use game.CombatMenu. The former is a local variable. The latter is a persistent attribute of the game object.
Keep in mind that if you do "new string list" every time you learn a new skill, then you will wipe out the old list. So you will need to check if the list already exists. If it does, then move onto to setting the new skill. Else create it first.
Your second question seems similar. You want a way to associate a value with the enemy. The answer is the same: use an attribute. You can create an integer attribute (for example) on the enemy, and then decrease it by your "dmg" amount. If the value goes to zero or negative, then move the enemy off to some hidden room (I call mine "Limbo" typically) so the player can no longer see it.
Hope that helps!
HegemonKhan wrote:... but I'm a bit confused in understanding what is and isn't localized...
case (human)
case ("human")
<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">
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
if (HasAttribute(player, "male")) {
SetObjectFlagOn (player, "male")
}
else {
SetObjectFlagOn (player, "female")
}
show menu ("What is your race?", split ("human;elf;dwarf" , ";"), false) {
player.race = result
switch (HasAttribute (player, "!")) {
case ("human") {
SetObjectFlagOn (player, "human")
}
case ("elf") {
SetObjectFlagOn (player, "elf")
}
case ("dwarf") {
SetObjectFlagOn (player, "dwarf")
}
}
show menu ("What is your class?", split ("warrior;cleric;mage;thief" , ";"), false) {
player.class = result
switch (HasAttribute (player, "!")) {
case ("warrior") {
SetObjectFlagOn (player, "warrior")
}
case ("cleric") {
SetObjectFlagOn (player, "cleric")
}
case ("mage") {
SetObjectFlagOn (player, "mage")
}
case ("thief") {
SetObjectFlagOn (player, "thief")
}
}
msg (player.alias + " is a " + LCase (player.gender) + " " + LCase (player.race) + " " + LCase (player.class) + ".")
}
}
}
}
</start>
</game>
<object name="room">
<inherit name="editor_room" />
<object name="player">
<inherit name="defaultplayer" />
<turns type="int">0</turns>
<statusattributes type="stringdictionary">turns = </statusattributes>
</object>
</object>
<turnscript name="turns script">
<enabled />
<script>
player.turns = player.turns + 1
</script>
</turnscript>
</asl>
<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">
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
if (HasAttribute(player, "male")) {
SetObjectFlagOn (player, "male")
}
else {
SetObjectFlagOn (player, "female")
}
show menu ("What is your race?", split ("human;elf;dwarf" , ";"), false) {
player.race = result
switch (player.race) {
case ("human") {
SetObjectFlagOn (player, "human")
}
case ("elf") {
SetObjectFlagOn (player, "elf")
}
case ("dwarf") {
SetObjectFlagOn (player, "dwarf")
}
}
show menu ("What is your class?", split ("warrior;cleric;mage;thief" , ";"), false) {
player.class = result
switch (player.class) {
case ("warrior") {
SetObjectFlagOn (player, "warrior")
}
case ("cleric") {
SetObjectFlagOn (player, "cleric")
}
case ("mage") {
SetObjectFlagOn (player, "mage")
}
case ("thief") {
SetObjectFlagOn (player, "thief")
}
}
msg (player.alias + " is a " + LCase (player.gender) + " " + LCase (player.race) + " " + LCase (player.class) + ".")
}
}
}
}
</start>
</game>
<object name="room">
<inherit name="editor_room" />
<object name="player">
<inherit name="defaultplayer" />
<turns type="int">0</turns>
<statusattributes type="stringdictionary">turns = ;strength = </statusattributes>
<strength type="int">0</strength>
<changedstrength type="script">
firsttime {
switch (GetBoolean (player, "!")) {
case ("human") {
player.strength = player.strength + 5
}
case ("elf") {
player.strength = player.strength + 0
}
case ("dwarf") {
player.strength = player.strength + 10
}
}
}
</changedstrength>
<race type="list">human; elf; dwarf</race>
</object>
</object>
<turnscript name="turns script">
<enabled />
<script>
player.turns = player.turns + 1
</script>
</turnscript>
</asl>
<asl version="520">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="PlayerRace">
<gameid>afc92fdb-8e64-4f7a-9f77-22f005737a40</gameid>
<version>1.0</version>
<start type="script">
show menu ("Choose race", game.race_options, false) {
if (result = "Human") {
msg ("So, you are a human...")
player.strength = 5
player.magic = 2
player.charm = 3
}
if (result = "Elf") {
msg ("So, you are an elf...")
player.strength = 2
player.magic = 5
player.charm = 4
}
if (result = "Pixie") {
msg ("So, you are a pixie...")
player.strength = 4
player.magic = 7
player.charm = 9
}
}
</start>
<race_options type="list">Human; Elf; Pixie</race_options>
</game>
<object name="room">
<inherit name="editor_room" />
<object name="player">
<inherit name="defaultplayer" />
</object>
</object>
</asl>
switch (GetBoolean (player, "!")) {
case ("human") {
...
switch (GetString (player, "race")) {
case ("human") {
....
player.race = result
switch (player.race) {
case ("human") {
SetObjectFlagOn (player, "human")
}
case ("elf") {
SetObjectFlagOn (player, "elf")
}
case ("dwarf") {
SetObjectFlagOn (player, "dwarf")
}
if(GetBoolean(player,"human")){
player.strength=player.strength+10
}
switch(GetString(player,"race")) {
case("human"){
player.strength=player.strength+10
}
HegemonKhan wrote:
what about the player's reference to gender and articles in terms of the text, how do I apply my starting script choices, so that it applies to string-message references using the gender and article for the player? As I can't set the gender and article via the object -> player -> object (or whatever the corresponding tab is called, I can't name it off hand -from my memory- like this, yet), as my starting script is doing the decision on-of what gender my player will be. so how do i get the descriptors of gender and article to match up to what I choosen in the starting script?
<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>
<showscore />
<showhealth />
</game>
<object name="room">
<inherit name="editor_room" />
<object name="player">
<inherit name="defaultplayer" />
<age type="int">0</age>
<height type="int">0</height>
<weight type="int">0</weight>
<strength type="int">0</strength>
<intelligence type="int">0</intelligence>
<agility type="int">0</agility>
<statusattributes type="stringdictionary">age = ;height = ;weight = ;strength = ;intelligence = ;agility = ;level = ;experience = ;cash = ;turns = </statusattributes>
<level type="int">0</level>
<experience type="int">0</experience>
<cash type="int">0</cash>
<turns type="int">0</turns>
</object>
<object name="potion1">
<inherit name="editor_object" />
<alias>experience potion</alias>
<take />
<drink type="script">
msg ("You drink the exp potion, receiving 100 experience.")
player.experience = player.experience + 100
RemoveObject (potion1)
</drink>
<alt>exppot; exp pot; exp potion; potion</alt>
</object>
</object>
<turnscript name="turns lvlup script">
<enabled />
<script>
lvlup
player.turns = player.turns + 1
</script>
</turnscript>
<function name="lvlup"><![CDATA[
if (player.experience = " + " " or " + > + " " + msg ((player.level * 100) + 100) + ".") {
player.level = player.level + 1
player.experience = 0
}
]]></function>
</asl>
<function name="lvlup"><![CDATA[
expneeded = player.level * 100 + 100
if (player.experience >= expneeded) {
player.level = player.level + 1
player.experience = player.experience - expneeded
}
]]></function>
<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>
<showscore />
<showhealth />
<start type="script">
msg ("What is your name?")
get input {
msg (" - " + result)
player.alias = result
show menu ("What is your gender?", split ("male;female" , ";"), false) {
player.gender = result
show menu ("What is your race?", split ("human;elf;dwarf" , ";"), false) {
player.race = result
show menu ("What is your class?", split ("warrior;cleric;mage;thief" , ";"), false) {
player.class = result
msg (player.alias + " is a " + " " + player.gender + " " + player.race + " " + player.class + ".")
}
}
}
}
</start>
</game>
<object name="room">
<inherit name="editor_room" />
<object name="player">
<inherit name="defaultplayer" />
<age type="int">0</age>
<height type="int">0</height>
<weight type="int">0</weight>
<strength type="int">0</strength>
<intelligence type="int">0</intelligence>
<agility type="int">0</agility>
<statusattributes type="stringdictionary">age = ;height = ;weight = ;strength = ;intelligence = ;agility = ;level = ;experience = ;cash = ;turns = </statusattributes>
<level type="int">0</level>
<experience type="int">0</experience>
<cash type="int">0</cash>
<turns type="int">0</turns>
</object>
<object name="potion1">
<inherit name="editor_object" />
<alias>experience potion</alias>
<take />
<alt>exppot; exp pot; exp potion; potion</alt>
<drink type="script">
msg ("You drink the exp potion, receiving 100 experience.")
player.experience = player.experience + 100
</drink>
</object>
</object>
<turnscript name="turns lvlup script">
<enabled />
<script>
lvlup
player.turns = player.turns + 1
</script>
</turnscript>
<function name="lvlup"><![CDATA[
expneeded = player.level * 100 + 100
if (player.experience >= expneeded) {
player.level = player.level + 1
player.experience = player.experience - expneeded
switch (player.gender) {
case ("male") {
player.strength = player.strength + 1
}
case ("female") {
player.agility = player.agility + 1
}
}
switch (player.race) {
case ("dwarf") {
player.strength = player.strength + 2
}
case ("elf") {
player.agility = player.intelligence + 2
}
case ("human") {
player.strength = player.strength + 1
player.agility = player.agility + 1
}
}
switch (player.class) {
case ("warrior") {
player.strength = player.strength + 2
}
case ("cleric") {
player.intelligence = player.intelligence + 1
player.agility = player.agility + 1
}
case ("mage") {
player.intelligence = player.intelligence + 2
}
case ("thief") {
player.strength = player.strength + 1
player.agility = player.agility + 1
}
}
}
]]></function>
</asl>
... also due to my not realizing that I needed to make-set my math equation into a variable / attribute for it to work
<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>
<showscore />
<showhealth />
<start type="script">
msg ("What is your name?")
get input {
msg (" - " + result)
player.alias = result
show menu ("What is your gender?", split ("male;female" , ";"), false) {
player.gender = result
show menu ("What is your race?", split ("human;elf;dwarf" , ";"), false) {
player.race = result
show menu ("What is your class?", split ("warrior;cleric;mage;thief" , ";"), false) {
player.class = result
msg (player.alias + " is a " + " " + player.gender + " " + player.race + " " + player.class + ".")
}
}
}
}
</start>
</game>
<object name="room">
<inherit name="editor_room" />
<object name="player">
<inherit name="defaultplayer" />
<age type="int">0</age>
<height type="int">0</height>
<weight type="int">0</weight>
<strength type="int">0</strength>
<intelligence type="int">0</intelligence>
<agility type="int">0</agility>
<statusattributes type="stringdictionary">age = ;height = ;weight = ;strength = ;intelligence = ;agility = ;level = ;experience = ;cash = ;turns = </statusattributes>
<level type="int">0</level>
<experience type="int">0</experience>
<cash type="int">0</cash>
<turns type="int">0</turns>
</object>
<object name="potion100">
<inherit name="editor_object" />
<alias>100 exp potion</alias>
<take />
<alt type="list"></alt>
<drink type="script">
msg ("You drink the exp potion, receiving 100 experience.")
player.experience = player.experience + 100
</drink>
<displayverbs>Look at; Take; drink</displayverbs>
<inventoryverbs>Look at; Use; Drop; drink</inventoryverbs>
</object>
<object name="potion300">
<inherit name="editor_object" />
<alias>300 exp potion</alias>
<take />
<drink type="script">
msg ("You drink the exp potion, receiving 300 experience.")
player.experience = player.experience + 300
</drink>
<displayverbs>Look at; Take; drink</displayverbs>
<inventoryverbs>Look at; Use; Drop; drink</inventoryverbs>
</object>
</object>
<turnscript name="turns lvlup script">
<enabled />
<script>
lvlup
player.turns = player.turns + 1
</script>
</turnscript>
<function name="lvlup"><![CDATA[
expneeded = player.level * 100 + 100
if (player.experience >= expneeded) {
player.level = player.level + 1
player.experience = player.experience - expneeded
switch (player.gender) {
case ("male") {
player.strength = player.strength + 1
}
case ("female") {
player.agility = player.agility + 1
}
}
switch (player.race) {
case ("dwarf") {
player.strength = player.strength + 2
}
case ("elf") {
player.agility = player.intelligence + 2
}
case ("human") {
player.strength = player.strength + 1
player.agility = player.agility + 1
}
}
switch (player.class) {
case ("warrior") {
player.strength = player.strength + 2
}
case ("cleric") {
player.intelligence = player.intelligence + 1
player.agility = player.agility + 1
}
case ("mage") {
player.intelligence = player.intelligence + 2
}
case ("thief") {
player.strength = player.strength + 1
player.agility = player.agility + 1
}
}
lvlup
}
]]></function>
</asl>
<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>
<showscore />
<showhealth />
<start type="script">
msg ("What is your name?")
get input {
msg (" - " + result)
player.alias = result
show menu ("What is your gender?", split ("male;female" , ";"), false) {
player.gender = result
show menu ("What is your race?", split ("human;elf;dwarf" , ";"), false) {
player.race = result
show menu ("What is your class?", split ("warrior;cleric;mage;thief" , ";"), false) {
player.class = result
msg (player.alias + " is a " + " " + player.gender + " " + player.race + " " + player.class + ".")
}
}
}
}
</start>
</game>
<object name="room">
<inherit name="editor_room" />
<object name="player">
<inherit name="defaultplayer" />
<age type="int">0</age>
<height type="int">0</height>
<weight type="int">0</weight>
<strength type="int">0</strength>
<intelligence type="int">0</intelligence>
<agility type="int">0</agility>
<statusattributes type="stringdictionary">age = ;height = ;weight = ;strength = ;intelligence = ;agility = ;level = ;experience = ;cash = ;turns = </statusattributes>
<level type="int">0</level>
<experience type="int">0</experience>
<cash type="int">0</cash>
<turns type="int">0</turns>
</object>
<object name="potion100">
<inherit name="editor_object" />
<alias>100 exp potion</alias>
<take />
<alt type="list"></alt>
<displayverbs>Look at; Take; drink</displayverbs>
<inventoryverbs>Look at; Use; Drop; drink</inventoryverbs>
<drink type="script">
msg ("You drink the exp potion, receiving 100 experience.")
player.experience = player.experience + 100
</drink>
</object>
<object name="potion300">
<inherit name="editor_object" />
<alias>300 exp potion</alias>
<take />
<displayverbs>Look at; Take; drink</displayverbs>
<inventoryverbs>Look at; Use; Drop; drink</inventoryverbs>
<drink type="script">
msg ("You drink the exp potion, receiving 300 experience.")
player.experience = player.experience + 300
</drink>
</object>
</object>
<turnscript name="turns lvlup script">
<enabled />
<script>
lvlup
player.turns = player.turns + 1
</script>
</turnscript>
<function name="lvlup"><![CDATA[
if (player.experience >= player.level * 100 + 100) {
player.level = player.level + 1
player.experience = player.experience - player.level * 100 + 100
switch (player.gender) {
case ("male") {
player.strength = player.strength + 1
}
case ("female") {
player.agility = player.agility + 1
}
}
switch (player.race) {
case ("dwarf") {
player.strength = player.strength + 2
}
case ("elf") {
player.agility = player.intelligence + 2
}
case ("human") {
player.strength = player.strength + 1
player.agility = player.agility + 1
}
}
switch (player.class) {
case ("warrior") {
player.strength = player.strength + 2
}
case ("cleric") {
player.intelligence = player.intelligence + 1
player.agility = player.agility + 1
}
case ("mage") {
player.intelligence = player.intelligence + 2
}
case ("thief") {
player.strength = player.strength + 1
player.agility = player.agility + 1
}
}
lvlup
}
]]></function>
</asl>
expneeded = player.level * 100 + 100
player.level = player.level + 1
player.experience = player.experience - expneeded
and (vs)
player.level = player.level + 1
player.experience = player.experience - player.level * 100 + 100
Also, a quick question, is this possible to code?
for your displayed status attributes:
hit points (hp): "current hp (curhp)" / "maximum hp (maxhp)"
magic points (mp): "curmp" / "maxmp"
hp: 250 / 500
mp: 100 / 200
<!--Saved by Quest 5.3.4721.18482-->
<asl version="530">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="Testing">
<gameid>e352a6d8-c005-4b44-8021-1cf6a3f13fde</gameid>
<description type="string"></description>
</game>
<object name="room">
<inherit name="editor_room" />
<object name="player">
<inherit name="defaultplayer" />
<curhp type="int">250</curhp>
<maxhp type="int">500</maxhp>
<hp>Hits: 500/500</hp>
<statusattributes type="stringdictionary">hp = !</statusattributes>
</object>
</object>
<turnscript name="TrackHits">
<enabled />
<script>
player.hp = "Hits: " + player.curhp + "/" + player.maxhp
</script>
</turnscript>
</asl>
<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>
</game>
<object name="room">
<inherit name="editor_room" />
<object name="player">
<inherit name="defaultplayer" />
<turns type="int">0</turns>
<statusattributes type="stringdictionary">turns = ;hp = </statusattributes>
<curhp type="int">250</curhp>
<maxhp type="int">500</maxhp>
<hp>0 / 0</hp>
</object>
</object>
<turnscript name="turns turn script">
<enabled />
<script>
player.hp = player.curhp + " / " + player.maxhp
player.turns = player.turns + 1
</script>
</turnscript>
</asl>
<tab>
<parent>_ObjectEditor</parent>
Spell
<mustnotinherit>editor_room; defaultplayer</mustnotinherit>
<control>
<controltype>dropdowntypes</controltype>
Spell type
<types>*=Not a spell; spell=Non-attack spell; attackspell=Attack spell</types>
<width>150</width>
</control>
</tab>
<asl version="520">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<include ref="HK magic object type lib.aslx" />
<game name="Testing Game Stuff">
<gameid>cd102f9d-370a-4bda-b6ea-ca42288f619c</gameid>
<version>1.0</version>
</game>
<object name="room">
<inherit name="editor_room" />
<object name="player">
<inherit name="defaultplayer" />
<object name="aura_spell">
<inherit name="editor_object" />
<inherit name="spell" />
<alias>aura</alias>
<drop type="boolean">false</drop>
<cast type="script">
if (this.parent = player) {
msg ("You cast " + this.alias + " and a blue glow surrounds you.")
}
else {
msg ("You haven't learned this spell yet.")
}
</cast>
</object>
</object>
<object name="spellbook">
<inherit name="editor_object" />
<inherit name="container_closed" />
<take />
<listchildren />
<drop />
<object name="fireball_spell">
<inherit name="editor_object" />
<alias>fireball</alias>
<drop type="boolean">false</drop>
<cast type="script">
if (this.parent = player) {
msg ("You cast " + this.alias + " and a big ball of fire shoots outwards.")
}
else {
msg ("You haven't learned this spell yet.")
}
</cast>
</object>
</object>
</object>
<verb>
<property>learn</property>
<pattern>learn</pattern>
<defaultexpression>"You can't learn " + object.article + "."</defaultexpression>
</verb>
<verb>
<property>cast</property>
<pattern>cast</pattern>
<defaultexpression>"You can't cast " + object.article + "."</defaultexpression>
</verb>
</asl>
<?xml version="1.0"?>
<library>
<type name="spell">
<inventoryverbs type="list">Cast</inventoryverbs>
<displayverbs type="list">Learn</displayverbs>
<drop type="boolean">false</drop>
<take type="boolean">false</take>
<learn type="script"><![CDATA[
if (not this.parent = player) {
this.parent = player
msg ("You've learned, and can now cast, the spell, " + this.alias + ".")
}
else {
msg ("You already know it.")
}
]]></learn>
</type>
<type name="attackspell">
<inherit name="spell"/>
</type>
<tab>
<parent>_ObjectEditor</parent>
Magic
<mustnotinherit>editor_room; defaultplayer</mustnotinherit>
<control>
<controltype>dropdowntypes</controltype>
Spell type
<types>*=Not a spell; spell=Non-attack spell; attackspell=Attack spell</types>
<width>150</width>
</control>
</tab>
</library>
// I've tried using "Spell" first for the tab's caption, and then I've tried "Magic", but both still get a blank tab name in the GUI.
// for the control, the caption "Spell type" for the drop down doesn't show up either.
<tab>
<parent>_ObjectEditor</parent>
Spell
<mustnotinherit>editor_room; defaultplayer</mustnotinherit>
<control>
<controltype>dropdowntypes</controltype>
Spell type
<types>*=Not a spell; spell=Non-attack spell; attackspell=Attack spell</types>
<width>150</width>
</control>
</tab>
<tab>
<parent>_ObjectEditor</parent>
<caption>Spell</caption>
<mustnotinherit>editor_room; defaultplayer</mustnotinherit>
<control>
<controltype>dropdowntypes</controltype>
<caption>Spell type</caption>
<types>*=Not a spell; spell=Non-attack spell; attackspell=Attack spell</types>
<width>150</width>
</control>
</tab>
<type name="cmb_equipment">
<cmb_mod type="stringdictionary"/>
<cmb_where type="string"></cmb_where>
<!-- "head", neck", "body", "arms", "rhand", "lhand", "dhand", "legs", "feet" -->
<cmb_activelvl type="int">1</cmb_activelvl>
</type>
<object name="cmb_intern">
<cmb_attribs type="list">CMB_PA;CMB_AT;CMB_STR;CMB_HP;CMB_EXP</cmb_attribs>
<cmb_lvlexp type="stringdictionary">1=50;2=100;3=200;4=400;5=800;6=1500;7=3000</cmb_lvlexp>
<cmb_lvlmod type="stringdictionary">1=at=1,pa=1;2=at=2,hp=100;3=str=4,at=1;4=at=2;5=pa=2;6=at=2;7=at=1</cmb_lvlmod>
</object>
HegemonKhan wrote:
question 5: @Pertex, about your combat library<type name="cmb_equipment">
<cmb_mod type="stringdictionary"/>
<cmb_where type="string"></cmb_where>
<!-- "head", neck", "body", "arms", "rhand", "lhand", "dhand", "legs", "feet" -->
<cmb_activelvl type="int">1</cmb_activelvl>
</type>
what exactly are you doing here, what do your codes "say" ?
I'm guessing:
<!-- "head", neck", "body", "arms", "rhand", "lhand", "dhand", "legs", "feet" --> (or whatever you want to have) is the string you put into <cmb_where type="string"></cmb_where> , right?
HegemonKhan wrote:
and the <cmb_mod type="stringdictionary"/> contains the string ???
<cmb_mod type="stringdictionary">at = +3;str = +1;hp = 21</cmb_mod>
HegemonKhan wrote:
or does the '_mod' (in <cmb_mod type="stringdictionary"/> ) means you're modifying the string script, as I see you using 'mod' elsewhere too (like on-in, '<cmb_lvlmod type="stringdictionary">1=at=1,pa=1;2=at=2,hp=100;3=str=4,at=1;4=at=2;5=pa=2;6=at=2;7=at=1</cmb_lvlmod>' ) ??
HegemonKhan wrote:
as I got the same question with this too:<object name="cmb_intern">
<cmb_attribs type="list">CMB_PA;CMB_AT;CMB_STR;CMB_HP;CMB_EXP</cmb_attribs>
<cmb_lvlexp type="stringdictionary">1=50;2=100;3=200;4=400;5=800;6=1500;7=3000</cmb_lvlexp>
<cmb_lvlmod type="stringdictionary">1=at=1,pa=1;2=at=2,hp=100;3=str=4,at=1;4=at=2;5=pa=2;6=at=2;7=at=1</cmb_lvlmod>
</object>
is the '<cmb_lvlmod...' a modification of the '<cmb_lvlexp type...' ???
<object name="cmb_intern">
<cmb_attribs type="list">CMB_PA;CMB_AT;CMB_STR;CMB_HP;CMB_EXP</cmb_attribs>
<cmb_lvlexp type="stringdictionary">1=50;2=100;3=200;4=400;5=800;6=1500;7=3000</cmb_lvlexp>
<cmb_lvlmod type="stringdictionary">1=at=1,pa=1;2=at=2,hp=100;3=str=4,at=1;4=at=2;5=pa=2;6=at=2;7=at=1</cmb_lvlmod>
</object>
<object name="element_struct">
<elements type="list">fire; frost; storm; earthmight; shadow; rainbow; divine; necrotic</elements>
<opposedelements type="stringdictionary">fire = frost;frost = fire;storm = earthmight;earthmight = storm;shadow = rainbow;rainbow = shadow;necrotic = divine;divine=necrotic</opposedelements>
</object>
<type name="cmb_equipment">
<cmb_mod type="stringdictionary"/>
<cmb_where type="string"></cmb_where>
<!-- "head", neck", "body", "arms", "rhand", "lhand", "dhand", "legs", "feet" -->
<cmb_activelvl type="int">1</cmb_activelvl>
</type>
Pertex wrote:Right. You can put in any value you want e.g "finger", "nose" or even "aaa". When equipping an item, the library checks all object of the type "cmb_equipment" if there is another item worn at this location and if so, it throws a message "You can't waer another item at this location.
HK wrote:and the <cmb_mod type="stringdictionary"/> contains the string ???
Pertex wrote:No, it contains a stringdictionary. It contains the attribute modificators, if this item is equipped. Something like
<cmb_mod type="stringdictionary">at = +3;str = +1;hp = 21</cmb_mod>
Pertex wrote:The script reads all this values and increases ( or decreases) the actual attributes of the player
<cmb_where type="string"></cmb_where>
<!-- "head", neck", "body", "arms", "rhand", "lhand", "dhand", "legs", "feet" -->
<cmb_activelvl type="int">1</cmb_activelvl>[/code
or, something else (which I obviously don't see) ????
******************
and your game functions do the "When equipping an item, the library checks all object of the type "cmb_equipment" if there is another item worn at this location and if so, it throws a message "You can't waer another item at this location (Pertex)."
Question 9:
about Pertex response to my question 5, obviously (lol) it would help for me (lol) to understand what are:
(1) strings (I'm guessing they're a 'sentence' of letters and-or numbers, or expression: a 'sentence' of letters, numbers, and-or stripting codes)
(2) lists (I'm guessing these are local "attributes/scripts", instead of being universal "attributes/scripts")
(3) dictionaries (I'm guessing this is universal "attributes/scripts", instead of being local "attributes/scripts")
(4) stringlists (I'm guessing this is a collection of strings, but locally. Their individual strings can be separated "split" or joined together "join")
(5) stringdictionaries (I'm guessing, see stringlist, but they're universal instead)
(6) objectlists (I'm guessing, see stringlist, but with objects instead)
(7) object dictionaries (I'm guessing, see objectlists, but they're universal instead)
and I've seen:
(8) Item Keys (Are these related to the stringdictionaries: "key" and "string" ?? )
where are these from (what scripting type?) and what are they?
<function name="DoWear" parameters="object"><![CDATA[
if(not HasAttribute(object,"worn")) {
msg (DynamicTemplate("WearUnsuccessful", object))
} else if (object.parent = player and object.worn = true) {
msg (DynamicTemplate("AlreadyWearing", object))
} else if (not ListContains(ScopeInventory(), object)) {
msg (DynamicTemplate("WearUnsuccessful", object))
} else {
isLayerProblem = false
conflictedItem = null
if(HasAttribute(object,"wear_slots")) {
foreach(item, ScopeReachableInventory()) {
if(HasAttribute(item,"wear_slots")) {
if(item.worn = true) {
foreach(itemSlot,item.wear_slots) {
if(ListContains(object.wear_slots,itemSlot)) {
if(object.wear_layer < item.wear_layer) {
conflictedItem = item
isLayerProblem = true
} else if(object.wear_layer = item.wear_layer) {
conflictedItem = item
}
}
}
}
}
}
}
if(conflictedItem = null) {
object.worn = True
object.original_drop = object.drop
object.original_alias = object.alias
object.drop = false
object.display = GetDisplayName(object)
object.alias = GetDisplayAlias(object) + " (worn)"
if(object.wearmsg = null) {
msg (DynamicTemplate("WearSuccessful",object))
} else {
msg(object.wearmsg)
}
//do after
if (HasScript(object, "onafterwear")) {
do(object, "onafterwear")
} else if(HasString(object, "onafterwear")) {
msg(object.onafterwear)
}
} else if(isLayerProblem = true) {
msg(DynamicTemplate("CannotWearOver",conflictedItem))
} else {
msg(DynamicTemplate("CannotWearWith",conflictedItem))
}
}
]]></function>
<control>
<mustinherit>wearable</mustinherit>
<caption>Wear Slot</caption>
<controltype>list</controltype>
<attribute>wear_slots</attribute>
<editprompt>Please enter the name for the wear location</editprompt>
</control>
<object name="cmb_intern">
<cmb_attribs type="list">CMB_PA;CMB_AT;CMB_STR;CMB_HP;CMB_EXP</cmb_attribs>
<cmb_lvlexp type="stringdictionary">1=50;2=100;3=200;4=400;5=800;6=1500;7=3000</cmb_lvlexp>
<cmb_lvlmod type="stringdictionary">1=at=1,pa=1;2=at=2,hp=100;3=str=4,at=1;4=at=2;5=pa=2;6=at=2;7=at=1</cmb_lvlmod>
</object>
<object name="element_struct">
<elements type="list">fire; frost; storm; earthmight; shadow; rainbow; divine; necrotic</elements>
<opposedelements type="stringdictionary">fire = frost;frost = fire;storm = earthmight;earthmight = storm;shadow = rainbow;rainbow = shadow;necrotic = divine;divine=necrotic</opposedelements>
</object>
<type name="cmb_equipment">
<cmb_mod type="stringdictionary"/>
<cmb_where type="string"></cmb_where>
<!-- "head", neck", "body", "arms", "rhand", "lhand", "dhand", "legs", "feet" -->
<cmb_activelvl type="int">1</cmb_activelvl>
</type>
HegemonKhan wrote:
question 10:
@Pertex, about your:<type name="cmb_equipment">
<cmb_mod type="stringdictionary"/>
<cmb_where type="string"></cmb_where>
<!-- "head", neck", "body", "arms", "rhand", "lhand", "dhand", "legs", "feet" -->
<cmb_activelvl type="int">1</cmb_activelvl>
</type>
just to see if I understand (I haven't scanned-memorized, let alone understand, all your functions-script blocks, lol):
<cmb_where type="string"></cmb_where> is your string of whatever the body-equipment slots you want (why did you use a string, and not a list-stringlist or a stringdictionary?)
HegemonKhan wrote:
<cmb_activelvl type="int">1</cmb_activelvl> I'm going to guess this is the "equipment layer level" ?? (and you only assigned a single layer for this library-demo of yours, as the "1" can be easily changed to 2 or 3, for having multiple layers of equipment)
HegemonKhan wrote:
<cmb_mod type="stringdictionary"/> I still don't understand what this is for, or what it does... unless, does this become the parent (and universal, so it-"cmb_where" can be used in other functions) of the <cmb_where type="string"></cmb_where> ??
HK wrote:@Pertex,
I think I understand now about Pertex Combat Library part, that I was confused by earlier:<type name="cmb_equipment">
<cmb_mod type="stringdictionary"/>
<cmb_where type="string"></cmb_where>
<!-- "head", neck", "body", "arms", "rhand", "lhand", "dhand", "legs", "feet" -->
<cmb_activelvl type="int">1</cmb_activelvl>
</type>
the ( <cmb_mod type="stringdictionary"/> ) is merely allowing for you to script a stringdictionary (of then whatever you want), for the objects that inherit the object type, correct? (is the <cmb_mod type="stringdictionary"/> separate from the cmb_wear and "head", "etc" ? Edit: this is correct, as the cmb_wear would be indented if it was part of the stringdictionary, duh, sorry HK is not thinking clearly right now, lol. sorry for my prior confusion about this!)
Or, is this correct?:
StringDictionary -> cmb_where (key) and "head", "neck", "etc" (the string)
~(I had thought it was suppose to be an already created string dictionary with values, so that is why I was confused by it)
HegemonKhan wrote:
just a final check, this would be the correct understanding:
the ( <cmb_mod type="stringdictionary"/> ) is merely allowing for you to script a stringdictionary (of then whatever you want), for the objects that inherit the object type, correct? (is the <cmb_mod type="stringdictionary"/> separate from the cmb_wear and "head", "etc" ?)
HegemonKhan wrote:
Library File = enables you to create-set stringdictionaries for the objects with the inherited object type
Game File = you then go in and set the stringdictionaries for the various objects in your game:
Mace: at=8, pa=-3
Sword: ...
Shield: ---
etc
correct?
<library>
<!--
Chase's Wearables Library v2.3
Based on: Pixie's Clothing Library (originally)
You may edit this library however you please.
I decided to include a UI, since not having a UI kinda bugged me.
v1.01
-Fixed a typo
v1.02
+Added Event Handlers
+Fixed drop bug
v1.03
+Added configurable wear/remove messages
-Removed redundant events
v1.04
=Fixed an issue with wearing multiple blank items
=Fixed the issue with wearing items without aliases
v2.0
=Rewritten to better support base systems, may have broken older usages
+Added wear layer support
v2.1
=Fixed an issue of an error being thrown when trying to wear something that is not wearable.
v2.2
=Fixed an issue where the custom remove message doesn't play if the item cannot be removed.
v2.3
=Fixed a significant bug where you could not wear something if a non-wearable item was in your inventory.
Chase
chasesan@gmail.com
-->
<dynamictemplate name="WearSuccessful">"You put " + object.article + " on."</dynamictemplate>
<dynamictemplate name="WearUnsuccessful">"You can't wear " + object.article + "."</dynamictemplate>
<dynamictemplate name="AlreadyWearing">"You are already wearing " + object.article + "."</dynamictemplate>
<dynamictemplate name="CannotWearOver">"You cannot wear that over " + object.display + "."</dynamictemplate>
<dynamictemplate name="CannotWearWith">"You cannot wear that while wearing " + object.display + "."</dynamictemplate>
<dynamictemplate name="RemoveSuccessful">"You take " + object.article + " off."</dynamictemplate>
<dynamictemplate name="RemoveUnsuccessful">"You can't remove " + object.article + "."</dynamictemplate>
<dynamictemplate name="RemoveFirst">"You can't remove that while wearing "+object.display+"."</dynamictemplate>
<template name="Wear">Wear</template>
<verbtemplate name="wear">wear</verbtemplate>
<verbtemplate name="wear">put on</verbtemplate>
<template name="Remove">Remove</template>
<verbtemplate name="remove">remove</verbtemplate>
<verbtemplate name="remove">take off</verbtemplate>
<command name="wear" template="wear">
<multiple>
return (ScopeInventory())
</multiple>
<script>
foreach (obj, object) {
DoWear(obj)
}
</script>
</command>
<command name="remove" template="remove">
<multiple>
return (ScopeInventory())
</multiple>
<script>
foreach (obj, object) {
DoRemove(obj)
}
</script>
</command>
<function name="DoWear" parameters="object"><![CDATA[
if(not HasAttribute(object,"worn")) {
msg (DynamicTemplate("WearUnsuccessful", object))
} else if (object.parent = player and object.worn = true) {
msg (DynamicTemplate("AlreadyWearing", object))
} else if (not ListContains(ScopeInventory(), object)) {
msg (DynamicTemplate("WearUnsuccessful", object))
} else {
isLayerProblem = false
conflictedItem = null
if(HasAttribute(object,"wear_slots")) {
foreach(item, ScopeReachableInventory()) {
if(HasAttribute(item,"wear_slots")) {
if(item.worn = true) {
foreach(itemSlot,item.wear_slots) {
if(ListContains(object.wear_slots,itemSlot)) {
if(object.wear_layer < item.wear_layer) {
conflictedItem = item
isLayerProblem = true
} else if(object.wear_layer = item.wear_layer) {
conflictedItem = item
}
}
}
}
}
}
}
if(conflictedItem = null) {
object.worn = True
object.original_drop = object.drop
object.original_alias = object.alias
object.drop = false
object.display = GetDisplayName(object)
object.alias = GetDisplayAlias(object) + " (worn)"
if(object.wearmsg = null) {
msg (DynamicTemplate("WearSuccessful",object))
} else {
msg(object.wearmsg)
}
//do after
if (HasScript(object, "onafterwear")) {
do(object, "onafterwear")
} else if(HasString(object, "onafterwear")) {
msg(object.onafterwear)
}
} else if(isLayerProblem = true) {
msg(DynamicTemplate("CannotWearOver",conflictedItem))
} else {
msg(DynamicTemplate("CannotWearWith",conflictedItem))
}
}
]]></function>
<function name="DoRemove" parameters="object"><![CDATA[
if (not object.parent = player or not object.worn or not object.removeable) {
if(object.removemsg = null) {
msg (DynamicTemplate("RemoveUnsuccessful",object))
} else {
msg (object.removemsg)
}
} else {
conflictedItem = null
//check if we are wearing anything over it
if(HasAttribute(object,"wear_slots")) {
foreach(item, ScopeReachableInventory()) {
if(HasAttribute(item,"wear_slots")) {
if(item.worn = true) {
foreach(itemSlot,item.wear_slots) {
if(ListContains(object.wear_slots,itemSlot)) {
if(object.wear_layer < item.wear_layer) {
conflictedItem = item
}
}
}
}
}
}
}
if(conflictedItem = null) {
if(object.removemsg = null) {
msg (DynamicTemplate("RemoveSuccessful",object))
} else {
msg(object.removemsg)
}
object.worn = false
object.drop = object.original_drop
object.alias = object.original_alias
object.original_drop = null
object.original_alias = null
object.display = null
//do after
if (HasScript(object, "onafterremove")) {
do(object, "onafterremove")
} else if(HasString(object, "onafterremove")) {
msg(object.onafterremove)
}
} else {
msg (DynamicTemplate("RemoveFirst", conflictedItem))
}
}
]]></function>
<type name="wearable">
<worn type="boolean">false</worn>
<removeable type="boolean">true</removeable>
<wear_layer type="int">2</wear_layer>
<inventoryverbs type="listextend">[Wear];[Remove]</inventoryverbs>
</type>
<!-- Interface -->
<tab>
<parent>_ObjectEditor</parent>
<caption>Wearable</caption>
<mustnotinherit>editor_room; defaultplayer</mustnotinherit>
<control>
<controltype>title</controltype>
<caption>Wearable</caption>
</control>
<control>
<controltype>dropdowntypes</controltype>
<caption>Can be worn?</caption>
<types>*=Cannot be worn; wearable=Can be worn</types>
<width>150</width>
</control>
<control>
<mustinherit>wearable</mustinherit>
<controltype>checkbox</controltype>
<attribute>removeable</attribute>
<caption>Removeable?</caption>
</control>
<control>
<mustinherit>wearable</mustinherit>
<controltype>number</controltype>
<caption>Wear Layer</caption>
<attribute>wear_layer</attribute>
</control>
<control>
<mustinherit>wearable</mustinherit>
<caption>Wear Slot</caption>
<controltype>list</controltype>
<attribute>wear_slots</attribute>
<editprompt>Please enter the name for the wear location</editprompt>
</control>
<control>
<mustinherit>wearable</mustinherit>
<controltype>label</controltype>
<caption>If two objects have the same wear location, they will not be able to be worn at a same time. Any number items without wear locations can be worn.</caption>
<advanced/>
</control>
<!-- snip -->
<control>
<mustinherit>wearable</mustinherit>
<controltype>textbox</controltype>
<attribute>wearmsg</attribute>
<caption>Message to print when wearing (leave blank for default)</caption>
<nullable/>
</control>
<control>
<mustinherit>wearable</mustinherit>
<controltype>textbox</controltype>
<attribute>removemsg</attribute>
<caption>Message to print when removing or trying to remove (leave blank for default)</caption>
<nullable/>
</control>
<!-- Event Handlers from here down none/text/scripts -->
<control>
<mustinherit>wearable</mustinherit>
<controltype>title</controltype>
<caption>After Wearing</caption>
</control>
<control>
<mustinherit>wearable</mustinherit>
<selfcaption>After wearing the object</selfcaption>
<controltype>multi</controltype>
<attribute>onafterwear</attribute>
<types>null=None; string=Text; script=Run script</types>
<editors>string=textbox</editors>
<expand/>
</control>
<control>
<mustinherit>wearable</mustinherit>
<controltype>title</controltype>
<caption>After Removing</caption>
</control>
<control>
<mustinherit>wearable</mustinherit>
<selfcaption>After removing the object</selfcaption>
<controltype>multi</controltype>
<attribute>onafterremove</attribute>
<types>null=None; string=Text; script=Run script</types>
<editors>string=textbox</editors>
<expand/>
</control>
</tab>
</library>
<library>
<!-- done by Pertex (pertex@gmx.de)-->
<object name="cmb_intern">
<cmb_attribs type="list">CMB_PA;CMB_AT;CMB_STR;CMB_HP;CMB_EXP</cmb_attribs>
<cmb_lvlexp type="stringdictionary">1=50;2=100;3=200;4=400;5=800;6=1500;7=3000</cmb_lvlexp>
<cmb_lvlmod type="stringdictionary">1=at=1,pa=1;2=at=2,hp=100;3=str=4,at=1;4=at=2;5=pa=2;6=at=2;7=at=1</cmb_lvlmod>
</object>
<type name="cmb_equipment">
<cmb_mod type="stringdictionary"/>
<cmb_where type="string"></cmb_where>
<!-- "head", neck", "body", "arms", "rhand", "lhand", "dhand", "legs", "feet" -->
<cmb_activelvl type="int">1</cmb_activelvl>
</type>
<type name="cmb_fighter">
<cmb_at type="int">1</cmb_at>
<cmb_pa type="int">1</cmb_pa>
<cmb_str type="int">1</cmb_str>
<cmb_hp type="int">100</cmb_hp>
<cmb_at_max type="int">1</cmb_at_max>
<cmb_pa_max type="int">1</cmb_pa_max>
<cmb_str_max type="int">1</cmb_str_max>
<cmb_hp_max type="int">100</cmb_hp_max>
<cmb_exp type="int">0</cmb_exp>
<cmb_level type="int">0</cmb_level>
<dead type="boolean">false</dead>
<equiped type="string"></equiped>
<cmb_script type="scriptdictionary">
<item key="killed">
msg("killed")
</item>
</cmb_script>
</type>
<command name="attack">
<pattern>attack #text#</pattern>
<script>
cmb_attack (player, text)
</script>
</command>
<command name="loot">
<pattern>loot #text#</pattern>
<script>
cmb_loot ( trim(text) )
</script>
</command>
<command name="equip">
<pattern>equip #text#</pattern>
<script>
cmb_equip ( trim(text) )
</script>
</command>
<command name="unequip">
<pattern>unequip #text#</pattern>
<script>
cmb_unequip ( trim(text) )
</script>
</command>
<command name="unequipall">
<pattern>unequip all</pattern>
<script>
foreach (x,ScopeInventory () ) {
if (InstrRev ( getString(x, "alias") , "(" )>2) {
cmb_unequip ( getString (x, "name"))
}
}
</script>
</command>
<command name="equiped">
<pattern>equiped</pattern>
<script>
found=false
foreach (x,ScopeInventory () ) {
if (InstrRev ( getString(x, "alias") , "(" )>2) {
text=""
foreach(y,x.cmb_mod ) {
text=concat (text,concat (y,StringDictionaryItem (x.cmb_mod,y),"="),",")
}
msg (x.name+ " - Level " + x.cmb_activelvl + ", modification: "+ text )
found=true
}
}
if (not found) {
msg("You don't have any equiped item.")
}
</script>
</command>
<command name="equipment">
<pattern>equipment</pattern>
<script>
found=false
foreach (x,ScopeInventory () ) {
if (DoesInherit (x, "cmb_equipment")) {
text=""
foreach(y,x.cmb_mod ) {
text=concat (text,concat (y,StringDictionaryItem (x.cmb_mod,y),"="),",")
}
msg (x.name+ " - Level " + x.cmb_activelvl + ", modification: "+ text )
found=true
}
}
if (not found) {
msg("None of your items in your inventory can be equiped.")
}
</script>
</command>
<function name="cmb_addStatus" parameters="attrib">
attrib = cmb_chkAttrib (attrib)
if (GetAttribute ( player , "statusattributes" )=null ) {
player.statusattributes = NewStringDictionary()
}
switch (attrib) {
case ("cmb_hp") {
dictionary add (player.statusattributes, "cmb_hp", "Health: !/"+ player.cmb_hp_max )
}
case ("cmb_at") {
dictionary add (player.statusattributes, "cmb_at", "AT: !" )
}
case ("cmb_pa") {
dictionary add (player.statusattributes, "cmb_pa", "PA: !" )
}
case ("cmb_str") {
dictionary add (player.statusattributes, "cmb_str", "Strength: !" )
}
case ("cmb_level") {
dictionary add (player.statusattributes, "cmb_level", "Level: !" )
}
case ("cmb_exp") {
dictionary add (player.statusattributes, "cmb_exp", "EP: !" )
}
}
</function>
<function name="cmb_refreshStatus" >
saveStatus = NewStringList()
foreach( x , player.statusattributes){
list add(saveStatus, x)
}
player.statusattributes = NewStringDictionary()
foreach( x , saveStatus){
cmb_addStatus (x)
}
</function>
<function name="cmb_setAttrib" parameters="object,attrib,value">
if (cmb_chkObject(object)){
attrib=cmb_chkAttrib(attrib)
if (LengthOf(attrib)>0) {
set(object,attrib,value)
}
}
</function>
<function name="cmb_getAttrib" parameters="object,attrib" type="int">
if (cmb_chkObject(object)){
attrib=cmb_chkAttrib(attrib)
if (LengthOf(attrib)>0) {
return (GetInt(object,attrib))
} else {
return(0)
}
}
</function>
<function name="cmb_incAttrib" parameters="object,attrib,value" type="boolean">
if (cmb_chkObject(object)){
attrib=cmb_chkAttrib(attrib)
if (LengthOf(attrib)>0) {
cmb_setAttrib(object,attrib, cmb_getAttrib(object,attrib) + value)
return (true)
} else {
return (false)
}
} else {
return (false)
}
</function>
<function name="cmb_decAttrib" parameters="object,attrib,value" type="boolean">
if (cmb_chkObject(object)){
attrib=cmb_chkAttrib(attrib)
if (LengthOf(attrib)>0) {
cmb_setAttrib(object,attrib,cmb_getAttrib(object,attrib) - value)
return (true)
} else {
return (false)
}
} else {
return (false)
}
</function>
<function name="cmb_equip" parameters="itemname" type="boolean">
found=false
item= getObject(itemname)
if (item=null) {
msg("What does " + itemname + " mean?")
} else if ( not DoesInherit (item, "cmb_equipment")) {
msg("You can't equip this item.")
} else {
if (cmb_chkObject(item)){
foreach (cmb_object, ScopeInventory()) {
if (item=cmb_object){
found=true
}
}
if ( not found) {
msg ("You don't have this in your inventory.")
}
}
}
if (found) {
if ( player.cmb_level >=item.cmb_activelvl ) {
dict_equiped = NewStringDictionary ()
string2dict ( player.equiped,dict_equiped)
if (item.cmb_where="dhand" and (DictionaryContains (dict_equiped,"lhand") or (DictionaryContains (dict_equiped,"rhand")))){
msg("1")
msg("You already are carrying something in your hands!")
} else if ((item.cmb_where="dhand" or item.cmb_where="rhand") and DictionaryContains (dict_equiped,"dhand")){
msg("2")
msg("You already are carrying something in your hands!")
} else if ( DictionaryContains (dict_equiped,item.cmb_where)) {
msg("You already have something equiped there!")
} else {
dictionary add( dict_equiped,item.cmb_where, itemname)
item.alias=GetDisplayAlias (item)+ " ("+item.cmb_where+")"
eval_mod(player,item.cmb_mod, true )
}
player.equiped=dict2string (dict_equiped)
cmb_refreshStatus
msg("Done")
} else {
msg("You are not experienced enough to equip this item.")
}
}
return (true)
</function>
<function name="cmb_unequip" parameters="itemname" type="boolean">
found=false
item= getObject(itemname)
if (item=null) {
msg("What does " + itemname + " mean?")
} else if ( not DoesInherit (item, "cmb_equipment")) {
msg("You can't unequip this item.")
} else {
if (cmb_chkObject(item)){
foreach (cmb_object, ScopeInventory()) {
if (item=cmb_object){
found=true
}
}
if ( not found) {
msg ("You don't have this in your inventory.")
}
}
}
if (found) {
dict_equiped = NewStringDictionary ()
string2dict ( player.equiped,dict_equiped)
pos=DictionaryContainsValue(dict_equiped, itemname)
if ( lengthof(pos) > 0) {
dictionary remove(dict_equiped, pos)
if (InstrRev ( getString(item,"alias") , "(" )>2) {
item.alias=Left ( item.alias , InstrRev ( getString (item, "alias") , "(" )-2 )
}
eval_mod(player,item.cmb_mod, false )
}
player.equiped=dict2string (dict_equiped)
cmb_refreshStatus
msg("Done")
}
return (true)
</function>
<function name="cmb_unequipIntern" parameters="itemname" type="boolean">
item= getObject(itemname)
if (item=null) {
} else {
dict_equiped = NewStringDictionary ()
string2dict ( player.equiped,dict_equiped)
pos=DictionaryContainsValue(dict_equiped, itemname)
if ( lengthof(pos) > 0) {
dictionary remove(dict_equiped, pos)
if (InstrRev ( getString(item,"alias") , "(" )>2) {
item.alias=Left ( item.alias , InstrRev ( getString(item,"alias") , "(" )-2 )
}
eval_mod(player,item.cmb_mod, false )
}
player.equiped=dict2string (dict_equiped)
cmb_refreshStatus
}
</function>
<function name="eval_mod" parameters="object,mod_dict,inc">
foreach ( x, mod_dict ) {
if (x="at" or x="pa" or x="hp" or x="str"){
y=stringdictionaryitem(mod_dict,x)
if (IsInt(y)) {
if (inc) {
cmb_incAttrib(object,x,toint(y))
} else {
cmb_decAttrib(object,x,toint(y))
}
}
}
}
</function>
<function name="cmb_loot" parameters="targetname">
target= getObject(targetname)
if (target=null){
msg("You can't see that here.")
} else{
found=false
if(cmb_chkObject(target) and cmb_isReachable(target)){
if (target.dead) {
foreach (cmb_object, AllObjects()) {
if (cmb_object.parent=target) {
MoveObject (cmb_object, target.parent)
found=true
}
}
destroy(target.name)
if (found) {
msg("You found something.")
} else {
msg("You could not found something interessting.")
}
} else {
msg("You cant loot now.")
}
} else {
msg("You cant loot " + target.alias)
}
}
</function>
<function name="cmb_fight" parameters="object, target" type="boolean">
vattack=0
vparade=0
if (cmb_chkFighter(object) and cmb_chkFighter(target)){
for (x ,1, cmb_getAttrib(object,"cmb_at")) {
vattack = vattack + cmb_dicesix()
}
for (x ,1 ,cmb_getAttrib(target,"cmb_pa")) {
vparade = vparade + cmb_dicesix()
}
msg("at: " + ToString(vattack) + ", pa: "+ToString(vparade))
if (vattack > vparade) {
damage=cmb_dice(object.cmb_str) + cmb_dice(vattack-vparade)
cmb_decAttrib (target, "cmb_hp", damage)
msg(object.name + " hits " + target.name + " for " + damage + " points.")
} else {
msg (object.name + " misses.")
}
return (true)
} else {
return (false)
}
</function>
<function name="cmb_attack" parameters="object, targetname" type="boolean">
returnvalue=false
target= getObject(targetname)
if(target=null){
msg("There is no " + targetname + " here.")
returnvalue=false
} else if (not cmb_isReachable(target)){
msg("There is no " + target.name + " here.")
returnvalue=false
} else if (GetBoolean ( target , "dead" ) ){
msg("Your target ist not alive any more.")
returnvalue=false
} else if(cmb_chkObject(object) and cmb_chkObject(target)){
if (cmb_fight(object, target)) {
if (cmb_getAttrib(target,"cmb_hp")>0) {
msg( target.name + " hits back.")
cmb_fight(target,object)
if (cmb_getAttrib(object,"cmb_hp")>0) {
msg("")
} else {
if (object=player){
msg( "A last strike hits you. You are dying.")
msg( "GAME OVER")
finish
} else {
msg( object.name + " dies.")
SetObjectFlagOn (target, "dead")
target.alias = GetDisplayAlias (target) +" (dead)"
cmb_addexp(target)
if (DictionaryContains(target.cmb_script, "killed")) {
invoke (ScriptDictionaryItem(target.cmb_script, "killed"))
}
}
}
} else {
if (target=player){
msg( "A last strike hits you. You are dying.")
msg( "GAME OVER")
finish
} else {
msg( target.name + " dies.")
SetObjectFlagOn (target, "dead")
target.alias = GetDisplayAlias (target) +" (dead)"
cmb_addexp(target)
if (DictionaryContains(target.cmb_script, "killed")) {
invoke (ScriptDictionaryItem(target.cmb_script, "killed"))
}
}
}
} else {
msg("Why do you want to do this?")
}
returnvalue=true
}
return (returnvalue)
</function>
<function name="cmb_addexp" parameters="object" >
found=false
new_level=0
if (object.cmb_exp>0){
player.cmb_exp=player.cmb_exp+object.cmb_exp
msg("You got "+object.cmb_exp+" exp.")
foreach(x,cmb_intern.cmb_lvlexp) {
if(player.cmb_exp >= ToInt( StringDictionaryItem(cmb_intern.cmb_lvlexp,x))){
new_level=toint(x)
found=true
}
}
}
if (found) {
player.cmb_level=new_level
msg("Level "+new_level)
cmb_refreshStatus
}
</function>
<function name="cmb_chkObject" parameters="object" type="boolean">
value = false
foreach (cmb_object, AllObjects()) {
if (object=cmb_object) {
value = true
}
}
return (value)
</function>
<function name="cmb_chkFighter" parameters="object" type="boolean">
if (DoesInherit (object, "cmb_fighter")) {
return (true)
} else {
return (false)
}
</function>
<function name="cmb_chkAttrib" parameters="attrib" type="string">
<![CDATA[
if (ucase(left(attrib,4))<> "CMB_") {
attrib="cmb_" + attrib
}
if ( ListContains ( cmb_intern.cmb_attribs , ucase(attrib) )) {
return (attrib)
} else {
return ("")
}
]]>
</function>
<function name="cmb_isReachable" parameters="object" type="boolean">
value=false
foreach (x,ScopeReachableNotHeld ()) {
if(x=object) {
value=true
}
}
return (value)
</function>
<function name="cmb_dicesix" type="int">
dice=cmb_dice(GetRandomInt(1,6))
return (dice)
</function>
<function name="cmb_dice" parameters="number" type="int">
dice=GetRandomInt(1,number)
return (dice)
</function>
<function name="dict2string" parameters="dict" type="string">
text=""
foreach (x, dict) {
text=concat (text,concat (x,StringDictionaryItem (dict,x),"="),";")
}
return (text)
</function>
<function name="string2dict" parameters="text, dict">
list=split(text, ";")
if (ListCount(list)>0) {
for(x, 0, ListCount(list)-1) {
if ( Instr(StringListItem ( list , x ),"=")>0) {
list2=split( StringListItem ( list , x ), "=")
dictionary add (dict,StringListItem ( list2 , 0 ), StringListItem ( list2 , 1 ))
}
}
}
</function>
<function name="concat" parameters="text1,text2,separator" type="string">
if ( LengthOf(text1)>0 and LengthOf(text2)>0 ){
return (text1 + separator + text2)
} else if ( LengthOf(text1)>0 ) {
return (text1)
} else {
return (text2)
}
</function>
<function name="DictionaryContainsValue" parameters="dict,value" type="string">
found=""
foreach (x,dict) {
if (StringDictionaryItem(dict,x)=value) {
found=x
}
}
return (found)
</function>
<function name="cmb_startTurnscript" >
create turnscript ("cmb_tscript")
SetTurnScript (cmb_tscript) {
cmb_checkItems
}
EnableTurnScript (cmb_tscript)
</function>
<function name="cmb_checkItems" >
foreach (x,ScopeAllObjectsNotHeld () ) {
pos=instr( GetString ( x , "alias" ) , "(" )
if ( pos >0) {
cmb_unequipIntern( GetString ( x , "name" ))
}
}
</function>
<function name="ScopeAllObjectsNotHeld" type="objectlist">
result = NewObjectList()
foreach (obj, AllObjects()) {
if (not Contains(player, obj) and Contains(player.parent, obj)) {
list add(result, obj)
}
}
return (result)
</function>
</library>
<?xml version="1.0"?>
<library>
<!--
This library adds a basic magic system to quest. It allows for three types of spells:
nonattackspell: Instant effect
lastingspell: An on-going spell. These last until another spell is cast
attackspell: Instant effect, attacking anything of the "monster" type that is not dead
Attack spells must be of an element, and eight are already set up. Monsters
can be assigned to elements too; they will be immune to that element, but take
four-fold damage from the opposed element.
A "Magic" tab is added to the editor to make setting up spells and monsters as easy as possible.
-->
<!--
Adding new elements involves a bit of effort. This system requires that elements are added in pairs or opposites,
such as fire and frost.
1. Create a new type for both elements, named [elemem]_type
2. In the data section, the object element_struct needs both elements added to both "elements" and
"opposedelements", and for the latter you need to put them in both ways around (look at existing entries)
3. You need to add both elements to the tab, both for "monster" and for "attackspell". Again, see existing
entries.
-->
<!-- =================================================== -->
<!-- Templates -->
<!--
Using templates makes it easier to convert to other languages, but also for other users to word it how they want it.
When templates are in the library that uses them (as here) the way to change the language is to
modify the template in the library, so really the only benefit is that all the text is together here.
Also modify the default responses in the verbs!
-->
<template name="Learn">learn</template>
<template name="Cast">cast</template>
<template name="LookDead">Oh, and it is dead.</template>
<template name="SpellAlreadyKnown">Er, you already know that one!</template>
<template name="SpellNotKnown">Er, you don't know that one!</template>
<template name="NoMonstersPresent">No monsters present</template>
<dynamictemplate name="SpellEnds"><![CDATA["The <i>" + GetDisplayAlias(object) + "</i> spell ends."]]></dynamictemplate>
<dynamictemplate name="SpellCast"><![CDATA["You cast <i>" + GetDisplayAlias(object) + "</i>."]]></dynamictemplate>
<dynamictemplate name="SpellLearnt"><![CDATA["In a process that seems at once unfathomable, and yet familiar, the spell fades away, and you realise you are now able to cast the <i>" + GetDisplayAlias(object) + "</i> spell."]]></dynamictemplate>
<!-- =================================================== -->
<!-- Verbs -->
<verb>
<property>learn</property>
<pattern>[Learn]</pattern>
<defaultexpression>"You can't learn " + object.article + "."</defaultexpression>
</verb>
<verb>
<property>cast</property>
<pattern>[Cast]</pattern>
<defaultexpression>"You can't cast " + object.article + "."</defaultexpression>
</verb>
<!-- =================================================== -->
<!-- Functions -->
<!--
Handles an attack on the given monster, using the given spell.
Monster loses hit points according to the spell's powerrating.
If they share an element, then no damage, if elements are opposed, damage is multplied by 4
Handles monsters with no elements too, but spell must have an element set.
-->
<function name="SpellAttackMonster" parameters="monster, spell"><![CDATA[
element = GetElement (monster)
handled = False
if (not element = Null) {
if (DoesInherit (spell, element + "_type")) {
msg ("... " + monster.ignoreselement)
handled = True
}
if (DoesInherit (spell, StringDictionaryItem (element_struct.opposedelements, element) + "_type")) {
monster.hitpoints = monster.hitpoints - 4 * spell.powerrating
handled = True
if (monster.hitpoints > 0) {
msg ("... " + monster.hurtbyelement)
}
else {
msg ("... " + monster.deathbyelement)
Death (monster)
}
}
}
if (not handled) {
monster.hitpoints = monster.hitpoints - spell.powerrating
if (monster.hitpoints > 0) {
msg ("... " + monster.hurt)
}
else {
msg ("... " + monster.death)
Death (monster)
}
}
]]></function>
<!--
Call this when a spell is cast, to ensure any on-going spells
are terminated.
-->
<function name="CancelSpell"><![CDATA[
if (HasObject (player, "currentspell")) {
spell = player.currentspell
msg (DynamicTemplate("SpellEnds", spell))
player.currentspell = null
if (HasScript (spell, "terminate")) {
do (spell, "terminate")
}
}
]]></function>
<!--
Call this when a monster dies for some housekeeping.
-->
<function name="Death" parameters="monster"><![CDATA[
monster.alias = monster.alias + " (dead)"
if (HasString (monster, "lookwhendead")) {
monster.look = monster.lookwhendead
}
else {
monster.look = monster.look + " [LookDead]"
}
monster.dead = True
]]></function>
<!--
Returns as a string the name of this object's element (or null).
-->
<function name="GetElement" parameters="obj" type="string"><![CDATA[
result = Null
foreach (element, element_struct.elements) {
type = element + "_type"
if (DoesInherit (obj, type)) {
result = element
}
}
return (result)
]]></function>
<!--
Describes casting
-->
<function name="DescribeCast" parameters="spell"><![CDATA[
if (HasString (spell, "description")) {
msg (DynamicTemplate("SpellCast", spell) + " " + spell.description)
}
else {
msg (DynamicTemplate("SpellCast", spell))
}
]]></function>
<!-- =================================================== -->
<!-- Object types -->
<type name="spell">
<inventoryverbs type="list">Learn</inventoryverbs>
<displayverbs type="list">Learn</displayverbs>
<drop type="boolean">false</drop>
<take type="boolean">false</take>
<usedefaultprefix type="boolean">false</usedefaultprefix>
<learn type="script"><![CDATA[
if (not this.parent = player) {
this.parent = player
this.inventoryverbs = Split ("Cast", " ")
msg (DynamicTemplate("SpellLearnt", this))
}
else {
msg ("[SpellAlreadyKnown]")
}
]]></learn>
</type>
<type name="attackspell">
<inherit name="spell"/>
<cast type="script"><![CDATA[
// Check the player has the spell
// If so iterate through all objects in the room
// Apply attack to those with the monster type that are not dead
if (this.parent = player) {
DescribeCast (this)
flag = False
foreach (obj, ScopeVisibleNotHeld ()) {
if (DoesInherit (obj, "monster") and not GetBoolean (obj, "dead")) {
SpellAttackMonster (obj, this)
flag = True
}
}
if (not flag) {
msg ("... [NoMonstersPresent]")
}
CancelSpell ()
}
else {
msg ("[SpellNotKnown]")
}
]]></cast>
</type>
<type name="nonattackspell">
<inherit name="spell"/>
<cast type="script"><![CDATA[
if (this.parent = player) {
DescribeCast (this)
do (this, "spelleffect")
CancelSpell ()
}
else {
msg ("[SpellNotKnown]")
}
]]></cast>
</type>
<type name="lastingspell">
<inherit name="spell"/>
<cast type="script"><![CDATA[
if (this.parent = player) {
DescribeCast (this)
do (this, "spelleffect")
CancelSpell ()
player.currentspell = this
player.status = this.status
}
else {
msg ("[SpellNotKnown]")
}
]]></cast>
</type>
<type name="fire_type">
</type>
<type name="frost_type">
</type>
<type name="storm_type">
</type>
<type name="earthmight_type">
</type>
<type name="shadow_type">
</type>
<type name="rainbow_type">
</type>
<type name="divine_type">
</type>
<type name="necrotic_type">
</type>
<type name="monster">
</type>
<!-- =================================================== -->
<!-- Data -->
<!--
This is a data store for elements (I call it a "struct" after the keyword in the C programming language)
If you add more elements to the name, you need to add them to both lists as well as creating a new type.
Note that your new type must end "_type", but that must not be included on these lists.
-->
<object name="element_struct">
<elements type="list">fire; frost; storm; earthmight; shadow; rainbow; divine; necrotic</elements>
<opposedelements type="stringdictionary">fire = frost;frost = fire;storm = earthmight;earthmight = storm;shadow = rainbow;rainbow = shadow;necrotic = divine;divine=necrotic</opposedelements>
</object>
<!-- =================================================== -->
<!-- Tabs -->
<tab>
<parent>_ObjectEditor</parent>
<caption>Magic</caption>
<mustnotinherit>editor_room; defaultplayer</mustnotinherit>
<control>
<controltype>dropdowntypes</controltype>
<caption>Spell type</caption>
<types>*=None; nonattackspell=Non-attack spell; lastingspell=Lasting spell; attackspell=Attack spell; monster=Monster</types>
<width>150</width>
</control>
<control>
<controltype>title</controltype>
<caption>Non-Attack Spell</caption>
<mustinherit>nonattackspell</mustinherit>
</control>
<control>
<controltype>textbox</controltype>
<caption>Description (optional)</caption>
<attribute>description</attribute>
<mustinherit>nonattackspell</mustinherit>
</control>
<control>
<controltype>script</controltype>
<caption>Spell effect</caption>
<attribute>spelleffect</attribute>
<mustinherit>nonattackspell</mustinherit>
</control>
<control>
<controltype>title</controltype>
<caption>Lasting Spell</caption>
<mustinherit>lastingspell</mustinherit>
</control>
<control>
<controltype>textbox</controltype>
<caption>Description (optional)</caption>
<attribute>description</attribute>
<mustinherit>lastingspell</mustinherit>
</control>
<control>
<controltype>textbox</controltype>
<caption>Status when active</caption>
<attribute>status</attribute>
<mustinherit>lastingspell</mustinherit>
</control>
<control>
<controltype>script</controltype>
<caption>Spell effect</caption>
<attribute>spelleffect</attribute>
<mustinherit>lastingspell</mustinherit>
</control>
<control>
<controltype>script</controltype>
<caption>Cacel spell effect</caption>
<attribute>terminate</attribute>
<mustinherit>lastingspell</mustinherit>
</control>
<control>
<controltype>title</controltype>
<caption>Attack Spell</caption>
<mustinherit>attackspell</mustinherit>
</control>
<control>
<controltype>number</controltype>
<caption>Power of attack (1-10)</caption>
<attribute>powerrating</attribute>
<width>100</width>
<mustinherit>attackspell</mustinherit>
<minimum>0</minimum>
<maximum>10</maximum>
</control>
<control>
<controltype>textbox</controltype>
<caption>Description (optional)</caption>
<attribute>description</attribute>
<mustinherit>attackspell</mustinherit>
</control>
<control>
<controltype>dropdowntypes</controltype>
<caption>Element</caption>
<types>*=None; fire_type=Fire; frost_type=Frost; storm_type=Storm; earthmight_type=Earthmight; shadow_type=Shadow; rainbow_type=Rainbow; necrotic_type=Necrotic; divine_type=Divine</types>
<width>150</width>
<mustinherit>attackspell</mustinherit>
</control>
<control>
<controltype>title</controltype>
<caption>Monster</caption>
<mustinherit>monster</mustinherit>
</control>
<control>
<controltype>dropdowntypes</controltype>
<caption>Element</caption>
<types>*=None; fire_type=Fire; frost_type=Frost; storm_type=Storm; earthmight_type=Earthmight; shadow_type=Shadow; rainbow_type=Rainbow; necrotic_type=Necrotic; divine_type=Divine</types>
<width>150</width>
<mustinherit>monster</mustinherit>
</control>
<control>
<controltype>number</controltype>
<caption>Hit points</caption>
<attribute>hitpoints</attribute>
<width>100</width>
<mustinherit>monster</mustinherit>
<minimum>0</minimum>
</control>
<control>
<controltype>textbox</controltype>
<caption>Description on injury</caption>
<attribute>hurt</attribute>
<mustinherit>monster</mustinherit>
</control>
<control>
<controltype>textbox</controltype>
<caption>Description on death</caption>
<attribute>death</attribute>
<mustinherit>monster</mustinherit>
</control>
<control>
<controltype>textbox</controltype>
<caption>Description on injury by opposed element</caption>
<attribute>hurtbyelement</attribute>
<mustinherit>monster</mustinherit>
</control>
<control>
<controltype>textbox</controltype>
<caption>Description on death by opposed element</caption>
<attribute>deathbyelement</attribute>
<mustinherit>monster</mustinherit>
</control>
<control>
<controltype>textbox</controltype>
<caption>Description on ignore</caption>
<attribute>ignoreselement</attribute>
<mustinherit>monster</mustinherit>
</control>
<control>
<controltype>textbox</controltype>
<caption>Look (when dead)</caption>
<attribute>lookwhendead</attribute>
<mustinherit>monster</mustinherit>
</control>
</tab>
</library>
<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">
msg ("Let's generate a character...")
msg ("First, what is your name?")
get input {
player.alias = result
show menu ("Your gender?", game.gender_list, false) {
player.gender = result
show menu ("Your skill set?", game.class_list, false) {
player.class = result
msg (" ")
msg (player.alias + " was a " + LCase (player.gender) + " " + LCase (player.class) + ".")
msg (" ")
msg ("Now press a key to begin...")
wait {
ClearScreen
}
}
}
}
</start>
<gender_list type="list">male; female</gender_list>
<class_list type="list">warrior; cleric; mage; theif</class_list>
</game>
<object name="room">
<inherit name="editor_room" />
<object name="player">
<inherit name="defaultplayer" />
</object>
</object>
</asl>
<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>
</game>
<object name="room">
<inherit name="editor_room" />
<object name="player">
<inherit name="defaultplayer" />
</object>
</object>
</asl>
<game name="Testing Game Stuff">
<gameid>cd102f9d-370a-4bda-b6ea-ca42288f619c</gameid>
<version>1.0</version>
</game>
<game name="Testing Game Stuff">
<gameid>cd102f9d-370a-4bda-b6ea-ca42288f619c</gameid>
<version>1.0</version>
<start type="stript">
msg ("Let's generate a character...")
msg ("First, what is your name?")
get input {
player.alias = result
msg ("Hi, " + player.alias)
show menu ("Your gender?", game.gender_list, false) {
player.gender = result
show menu ("Your skill set?", game.class_list, false) {
player.class = result
msg (" ")
msg (player.alias + " was a " + LCase (player.gender) + " " + LCase (player.class) + ".")
msg (" ")
msg ("Now press a key to begin...")
wait {
ClearScreen
}
}
}
}
</start>
</game>
<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">
msg ("Let's generate a character...")
msg ("First, what is your name?")
get input {
player.alias = result
show menu ("Your gender?", game.gender_list, false) {
player.gender = result
show menu ("Your skill set?", game.class_list, false) {
player.class = result
msg (" ")
msg (player.alias + " was a " + LCase (player.gender) + " " + LCase (player.class) + ".")
msg (" ")
msg ("Now press a key to begin...")
wait {
ClearScreen
}
}
}
}
</start>
<gender_list type="list">male; female</gender_list>
<class_list type="list">warrior; cleric; mage; theif</class_list>
</game>
<object name="room">
<inherit name="editor_room" />
<object name="player">
<inherit name="defaultplayer" />
</object>
</object>
</asl>
<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">
msg ("What is your name?")
get input {
player.alias = result
show menu ("What is your gender?", split ("male;female" , ";"), false) {
player.gender = result
show menu ("What is your race?", split ("human;elf;dwarf" , ";"), false) {
player.race = result
show menu ("What is your class?", split ("warrior;cleric;mage;thief" , ";"), false) {
player.class = result
msg (player.alias + " is a " + LCase (player.gender) + " " + LCase (player.race) + " " + LCase (player.class) + ".")
}
}
}
}
</start>
</game>
<object name="room">
<inherit name="editor_room" />
<object name="player">
<inherit name="defaultplayer" />
</object>
</object>
</asl>
<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">
cc
</start>
</game>
<object name="room">
<inherit name="editor_room" />
<object name="player">
<inherit name="defaultplayer" />
<turns type="int">0</turns>
<statusattributes type="stringdictionary">turns = </statusattributes>
</object>
</object>
<turnscript name="turns turn script">
<enabled />
<script>
player.turns = player.turns + 1
</script>
</turnscript>
<function name="cc">
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 ("human;elf;dwarf;orc" , ";"), false) {
player.race = result
show menu ("What is your class?", split ("warrior;cleric;wizard;thief" , ";"), false) {
player.class = result
msg ("")
msg (player.alias + " is a " + " " + player.gender + " " + player.race + " " + player.class + ".")
msg ("")
msg ("(press a key to continue)")
wait {
ClearScreen
}
}
}
}
}
</function>
</asl>
<start type="script">
// Here "msg" is a script command, what string is sent to it will appear on the screen
msg ("Let's generate a character...")
// And again
msg ("First, what is your name?")
// Another script command, "get input". Waits for the player to type something,
// puts that text into a variable called "result",
// then runs its 'block'. The block is enclosed in curly braces.
get input {
// The "player" object has an attribute "alias" that is
// now set to the text in the "result" variable.
player.alias = result
// Now use "msg" to print to the screen, but this time the text is constructed
// by adding together two parts, using the plus sign.
msg ("Hi, " + player.alias)
// I have broken one line into two for simplicity
// The "Split" function breaks up a string of text into set of smaller strings,
// called a 'string list'.
// Here it will break up "Male;Female", and it will break the string wherever it
// find a semi-colon, as the second paramter is ";".
// The variable "options" will contain the output of the function.
options = Split ("Male;Female", ";")
// The "show menu" scrpt command will display a menu for the player.
// The "Your gender?" part will be the prompt or title.
// Then it will use the variable "options", which we just set. So the player will
// have the choice of "Male" or "Female".
// Finally we have "false", which tells Quest not to let the player cancel the menu
// choice.
// As with "get input", when the player makes a choice, the text goes into "result"
// and the block is run.
show menu ("Your gender?", options, false) {
// The "gender" attribute of "player" is now set to "Male" or "Female",
// as the player chose
player.gender = result
// Another menu, just like before, but here the two lines are combined
// You have the prompt, the string list with the option from the "Split"
// function, and "false" again.
show menu ("Your character class?", Split ("Warrior;Wizard;Priest;Thief", ";"), false) {
// The "class" attribute of "player" is now set.
player.class = result
// Print an empty line.
msg (" ")
// Print a summary to screen
msg (player.alias + " was a " + LCase (player.gender) + " " + LCase (player.class) + ".")
// Print an empty line.
msg (" ")
// Print instructions.
msg ("Now press a key to begin...")
// The "wait" script command is kind of like "get input", but instead of the player
// typing a sentence, the player presses a single key. Once that happens,
// the code in that box runs
wait {
// This function clears the screen, as you probably guessed
ClearScreen
// This is the end of the "wait" block.
}
// This is the end of the second "show menu" block.
}
// This is the end of the first "show menu" block.
}
// This is the end of the "get input" block.
}
</start>
<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>
</game>
<object name="room">
<inherit name="editor_room" />
<alias>homeland</alias>
<object name="player">
<inherit name="defaultplayer" />
</object>
</object>
<object name="room1">
<inherit name="editor_room" />
<alias>grassland</alias>
</object>
<command name="goto">
<pattern>goto</pattern>
<script>
location
</script>
</command>
<object name="room2">
<inherit name="editor_room" />
<alias>plains</alias>
</object>
<function name="location">
show menu ("Destination?", split ("homeland;grassland;plains" , ";"), false) {
switch (result) {
case ("homeland") {
MoveObject (player, room)
}
case ("grassland") {
MoveObject (player, room1)
}
case ("plains") {
MoveObject (player, room2)
}
}
}
</function>
</asl>
Pertex wrote:Your goto command:<command name="goto">
<pattern>goto #text#</pattern>
<script>
player.parent = GetObject(text)
</script>
</command>
Icandoit wrote:Can you tell me how to center the input on the screen during the game. For example, when I created the character (that is working now and I really thank you for the help on that) it appears on the left side of the screen as text input. I would like that to be centered on my screen but don't know how to do that. Help? lol.
<?xml version="1.0"?>
<library>
<type name="storage">
<open type="boolean">true</open>
<close type="boolean">true</close>
<take type="boolean">false</take>
<drop type="boolean">false</drop>
<give type="boolean">false</give>
<use type="boolean">false</use>
<inherit name="container_base"/>
<inventoryverbs type="list">Open;Close</inventoryverbs>
</type>
<object name="item_storage">
<parent>player</parent>
<inherit name="storage"/>
</object>
<type name="item">
</type>
<type name="useable_item">
<take type="boolean">true</take>
<drop type="boolean">true</drop>
<give type="boolean">true</give>
<use type="boolean">true</use>
</type>
<type name="battle_item">
</type>
<type name="quest_item">
</type>
<type name="gear">
<take type="boolean">true</take>
<drop type="boolean">true</drop>
<give type="boolean">true</give>
<use type="boolean">false</use>
<equipable type="boolean">true</equipable>
<unequipable type="boolean">true</unequipable>
<equipable_layer type="int">3</equipable_layer>
<equipable_slots type="list">Head;Face;Ears;Neck;Shoulders;Arms;Hands;Fingers;Chest;Back;Waist;Legs;Feet</equipable_slots>
<equipped type="boolean">false</equipped>
<inventoryverbs type="listextend">Equip;Unequip</inventoryverbs>
</type>
<type name="fire">
</type>
<type name="water">
</type>
<type name="air">
</type>
<type name="earth">
</type>
<type name="spell">
<inventoryverbs type="list">Learn</inventoryverbs>
<displayverbs type="list">Learn</displayverbs>
<take type="boolean">false</take>
<drop type="boolean">false</drop>
<give type="boolean">false</give>
<use type="boolean">false</use>
<learn type="script"><![CDATA[
if (not this.parent = ???) {
this.parent = ???
this.inventoryverbs = Split ("Cast;Teach" , ";")
msg (Dynamictemplate("Spell_Learned" , this))
}
else {
msg ("[Spell_Already_Learned]")
}
]]></learn>
</type>
<type name="char">
<dead type="boolean">false</dead>
<cur_hp type="int">0</cur_hp>
<max_hp type="int">0</max_hp>
<min_hp type="int">0</min_hp>
</type>
<type name="pc">
<inherit name="char"/>
</type>
<type name="npc">
<inherit name="char"/>
</type>
<tab>
<parent>_ObjectEditor</parent>
<caption>???</caption>
<mustnotinherit>editor_room</mustnotinherit>
<control>
<controltype>title</controltype>
<caption>???</caption>
<mustinherit>???</mustinherit>
</control>
<control>
<mustinherit>defaultplayer</mustinherit>
<controltype>dropdowntypes</controltype>
<caption>Character Type</caption>
<types>*=None; pc=Playable Character</types>
<width>150</width>
</control>
<control>
<mustnotinherit>defaultplayer</mustnotinherit>
<controltype>dropdowntypes</controltype>
<caption>Character Type</caption>
<types>*=None; npc=Non-Playable Character</types>
<width>150</width>
</control>
</tab>
</library>
<!--
??? = unfinished~unnamed
pc = playable character
npc = non-playable character
char = character
gear = equipment
hp = hit~health points = life
mp = mana~magic points = magic
some kind of player inventory unmoveable storage container "book" objects to organize your inventory's "items" (objects:
spells, items, gear, etc)
-->
<?xml version="1.0"?>
<library>
<verb name="battle">
<script>
battle_system
</script>
</verb>
<command name="battle">
<script>
battle_system
</script>
</command>
<turnscript name="battle_turns"
</turnscript>
<function name="battle_system"
<enable name="battle_turns"/>
<foreach (battle_turns; turns)
<get input/>
</function>
<!--
player.dmg_rat = player.cur_str - target.cur_end
target.dmg_rat = target.cur_str - player.cur_end
player.acr_rat = player.cur_dex - target.cur_spd
target.acr_rat = target.cur_dex - player.cur_spd
player.evd_rat = player.cur_agi - target.cur_spd
target.evd_rat = target.cur_agi - player.cur_spd
-->
<type name="char_char">
<dead type="boolean">false</dead>
<take type="boolean">false</take>
<drop type="boolean">false</drop>
<cur_hp type="int">0</cur_hp>
<max_hp type="int">0</max_hp>
<min_hp type="int">0</min_hp>
<cur_str type="int">0</cur_str>
<max_str type="int">200</max_str>
<min_str type="int">0</min_str>
<cur_end type="int">0</cur_end>
<max_end type="int">200</max_end>
<min_end type="int">0</min_end>
<cur_dex type="int">0</cur_dex>
<max_dex type="int">200</max_dex>
<min_dex type="int">0</min_dex>
<cur_agi type="int">0</cur_agi>
<max_agi type="int">200</max_agi>
<min_agi type="int">0</min_agi>
<cur_spd type="int">0</cur_spd>
<max_spd type="int">200</max_spd>
<min_spd type="int">0</min_spd>
</type>
<type name="pc_char">
<inherit name="char_char"/>
</type>
<type name="npc_char">
<inherit name="char_char"/>
<displayverbs type="listextend">Battle</displayverbs>
</type>
<tab>
<parent>_ObjectEditor</parent>
<caption>???</caption>
<mustnotinherit>editor_room</mustnotinherit>
<control>
<mustinherit>defaultplayer</mustinherit>
<controltype>dropdowntypes</controltype>
<caption>Character Type</caption>
<types>*=None; pc_char=Playable Character</types>
<width>150</width>
</control>
<control>
<mustnotinherit>defaultplayer</mustnotinherit>
<controltype>dropdowntypes</controltype>
<caption>Character Type</caption>
<types>*=None; npc_char=Non-Playable Character</types>
<width>150</width>
</control>
<control>
<controltype>number</controltype>
<caption>HP Amount</caption>
<attribute>cur_hp;max_hp</attribute>
<width>150</width>
<mustinherit>char_char</mustinherit>
<minimum>0</minimum>
</control>
<control>
<controltype>number</controltype>
<caption>Strength Amount (0-200)</caption>
<attribute>cur_str</attribute>
<width>150</width>
<mustinherit>char_char</mustinherit>
<minimum>0</minimum>
<maximum>200</maximum>
</control>
<control>
<controltype>number</controltype>
<caption>Endurance Amount (0-200)</caption>
<attribute>cur_end</attribute>
<width>150</width>
<mustinherit>char_char</mustinherit>
<minimum>0</minimum>
<maximum>200</maximum>
</control>
<control>
<controltype>number</controltype>
<caption>Dexterity Amount (0-200)</caption>
<attribute>cur_dex</attribute>
<width>150</width>
<mustinherit>char_char</mustinherit>
<minimum>0</minimum>
<maximum>200</maximum>
</control>
<control>
<controltype>number</controltype>
<caption>Agility Amount (0-200)</caption>
<attribute>cur_agi</attribute>
<width>150</width>
<mustinherit>char_char</mustinherit>
<minimum>0</minimum>
<maximum>200</maximum>
</control>
<control>
<controltype>number</controltype>
<caption>Speed Amount (0-200)</caption>
<attribute>cur_spd</attribute>
<width>150</width>
<mustinherit>char_char</mustinherit>
<minimum>0</minimum>
<maximum>200</maximum>
</control>
</tab>
</library
>attack orc
You hit the orc.
Orc hits you.
>attac orc
You hit the orc.
Orc hits you.
>attac orc
You hit the orc.
Orc is dead.
>attack orc
You hit the orc.
Orc hits you.
You hit the orc.
Orc hits you.
You hit the orc.
Orc is dead.
>attack orc
You hit the orc.
Orc hits you.
>cast fireball on orc
You hit the orc.
Orc is burning.
>equip sword
You are carrying a sword now.
Orc hits you critically.
>attack orc
+-----------------+
| show Menu |
+-----------------+
| attack |
| cast fireball |
| equip item |
| drink potion |
+-----------------+
[player chooses 'attack':]
You hit the orc.
Orc hits you.
...
>attack orc
You hit the orc.
Orc hits you.
>examine flower
It's a rose.
You hit the orc.
Orc hits you.
>eat apple
It tastes good.
You hit the orc.
Orc is dead.
NPC (non-hostile):
Talk; Steal; Fight; Give; Use; Cast (limited; only certain spells)
all of these can trigger hostility, and "Fight" (obviously) *WILL* trigger hostility
--------------------------------------------------------------------------------------------------------------------------
NPC (hostile):
Attack (physical damage), Defend (reduces physical damage, and enables a bonus to Attack in next combat turn), Cast, Item, Run
--------------------------------------------------------------------------------------------------------------------------
Other Battle Stuff:
>battle turns (rounds) are set up somehow
>player's choice lasts until you choose again
>*npc's choice* lasts until it chooses again
>npcs can't Run nor (use an) Item
>show a menu may be required to prevent you from doing any non-battle actions, inputs, and etc
>not sure how I want to handle multiple hostile npcs (battle each individually or all at once), and especially no idea if this would even be possible to code, either way, well I think anything is probably possible to code... Quest is powerful!
>instead of using show a menu, a possible alternative for battles, is to move the player and the npc(s) to a "battle room", and thus there's no non-battle stuff to do.
>player.turns would be the game-player turns as normal, and game.turns could be the battle turns (enabled upon entering the "battle room")
*I think this AI could be coded by a call function, of a function that uses a random number and switch
---------------------------------------------------------------------------------------------------------------------------
Player Attack Calculation Sequence:
1. Npc's Evasion
2A. Npc's Parry (If: No Shield and Yes Weapon, Percent Chance)
2B. Npc's Block (If: Yes Shield, Percent Chance)
3. Player's Accuracy (To Hit Percent Chance; Attack Rating)
4. Npc's Physical Resistance
5. Player's Physical Damage (Bonus if Player chose Defend last round; and Penalty if Npc chose Defend)
--------------------------------------------------------------------------------------------------------------------------
Npc Attack Calculation Sequence:
1. Player's Evasion
2. Player's Parry
3. Player's Block
4. NPC's Accuracy
5. Player's Damage Resistance
6. Npc's Damage (Penalty if Player chose Defend; and Bonus if Npc chose Defend last round)
------------------------------------------------------------------------------------------------------------------------
Player Cast On Npc Calculation Sequence:
1. NPC's Spell "evasion"
2. Player's Spell "accuracy"
3. NPC's Magical Resistance/Immunity/Vulnerability/Relection/Absorption
4. (If permitting; depends on #3) Player's Magical Damage On Npc, or (If Npc has Reflection) On Player, or (If Npc has Absorption) than Npc receives HP instead of losing it.
------------------------------------------------------------------------------------------------------------------------
NPC Cast On Player Calculation Sequence:
1. Player's Spell "evasion"
2. NPC's Spell "accuracy"
3. Player's Magical Resistance/Immunity/Vulnerability/Relection/Absorption
4. (If permitting; depends on #3) Npc's Magical Damage On Player, or (If Player has Reflection) On NPC, or (If Player has Absorption) than Player receives HP instead of losing it.
-----------------------------------------------------------------------------------------------------------------------
Player Defend, Run, Item, and Cast On Player:
>are self explanatory (I hope I'm not overlooking something)
-----------------------------------------------------------------------------------------------------------------------
Npc Defend and Cast On Npc:
>are self explanatory (I hope I'm not overlooking something)
----------------------------------------------------------------------------------------------------------------------
Battle Sequence:
Round (0 or 1):
1. "Initiative" is calculated (determines who goes first)
>If Player has "Initiative", see 2A1
>If Not, see 2B1
2A1a. Player: (If) Run (determines if player can escape the battle)
2A1b. Player: (If Not Run) Attack/Defend/Cast/Item
2A2. "Quickness" is calculated (determines if player can go again)
>If Player has "Quickness", see 2A1 [but it's now Round (1 or 2) instead]
>If Not, see 2A3
2A3. Npc: Attack/Defend/Cast
2A4. "Quickness" is calculated (determines if npc can go again)
>If Npc has "Quickness", see 2A3 [but it's now Round (1 or 2) instead]
>If Not, see 1 [but it's now Round (1 or 2) instead]
2B1. Npc: Attack/Defend/Cast
2B2. "Quickness" is calculated (determines if npc can go again)
>If Npc has "Quickness", see 2B1 [but it's now Round (1 or 2) instead]
>If Not, see 2B3
2B3a. Player: (If) Run (determines if player can escape the battle)
2B3b. Player: (If Not Run) Attack/Defend/Cast/Item
2B4. "Quickness" is calculated (determines if player can go again)
>If Player has "Quickness", see 2B3 [but it's now Round (1 or 2) instead]
>If Not, see 1 [but it's now Round (1 or 2) instead]
Round (1 or 2):
>See Round (0 or 1)
<asl version="520">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="Testing Game Stuff">
<gameid>d83ba5bb-2e3c-4f31-80c9-3e88a2dc082c</gameid>
<version>1.0</version>
<start type="script">
cc
</start>
</game>
<object name="room">
<inherit name="editor_room" />
<object name="player">
<inherit name="defaultplayer" />
<inherit name="pc_char" />
</object>
<object name="orc1">
<inherit name="editor_object" />
<inherit name="npc_char" />
<alias>orc</alias>
</object>
</object>
<turnscript name="player_game_turns">
<enabled />
<script>
lvlup
hp_mp_cur_max
game_over
player.turns = player.turns + 1
</script>
</turnscript>
<type name="char">
<cur_hp type="int">0</cur_hp>
<drop type="boolean">false</drop>
<max_hp type="int">0</max_hp>
<str type="int">0</str>
<end type="int">0</end>
<lvl type="int">0</lvl>
<exp type="int">0</exp>
<cash type="int">0</cash>
<dex type="int">0</dex>
<agi type="int">0</agi>
<spd type="int">0</spd>
<int type="int">0</int>
<spi type="int">0</spi>
<men type="int">0</men>
<cur_mp type="int">0</cur_mp>
<max_mp type="int">0</max_mp>
<hp type="int">0</hp>
<mp type="int">0</mp>
</type>
<type name="pc_char">
<inherit name="char" />
<turns type="int">0</turns>
<statusattributes type="stringdictionary">mp = ;hp = ;str = ;turns = ;end = ;dex = ;agi = ;spd = ;int = ;spi = ;men = ;lvl = ;exp = ;cash = </statusattributes>
</type>
<type name="npc_char">
<inherit name="char" />
<inherit name="surface" />
<dead type="boolean">false</dead>
<hostile type="boolean">false</hostile>
<displayverbs type="list">Look at; Talk; Steal; Give; Use; Cast; Fight</displayverbs>
</type>
<function name="cc">
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
switch (player.gender) {
case ("male") {
player.cur_hp = player.cur_hp + 30
player.max_hp = player.max_hp + 30
player.str = player.str + 30
player.end = player.end + 30
player.int = player.int + 30
player.spi = player.spi + 30
}
case ("female") {
player.cur_mp = player.cur_mp + 30
player.max_mp = player.max_mp + 30
player.dex = player.dex + 30
player.agi = player.agi + 30
player.spd = player.spd + 30
player.men = player.men + 30
}
}
show menu ("What is your race?", split ("human;dwarf;elf" , ";"), false) {
player.race = result
switch (player.race) {
case ("human") {
player.cur_hp = player.cur_hp + 20
player.max_hp = player.max_hp + 20
player.cur_mp = player.cur_mp + 20
player.max_mp = player.max_mp + 20
player.str = player.str + 20
player.end = player.end + 20
player.dex = player.dex + 20
player.agi = player.agi + 20
player.spd = player.spd + 20
player.int = player.int + 20
player.spi = player.spi + 20
player.men = player.men + 20
}
case ("dwarf") {
player.cur_hp = player.cur_hp + 30
player.max_hp = player.max_hp + 30
player.cur_mp = player.cur_mp + 10
player.max_mp = player.max_mp + 10
player.str = player.str + 30
player.end = player.end + 30
player.dex = player.dex + 10
player.agi = player.agi + 10
player.spd = player.spd + 10
player.int = player.int + 10
player.spi = player.spi + 10
player.men = player.men + 10
}
case ("elf") {
player.cur_hp = player.cur_hp + 10
player.max_hp = player.max_hp + 10
player.cur_mp = player.cur_mp + 30
player.max_mp = player.max_mp + 30
player.str = player.str + 10
player.end = player.end + 10
player.dex = player.dex + 30
player.agi = player.agi + 30
player.spd = player.spd + 30
player.int = player.int + 30
player.spi = player.spi + 30
player.men = player.men + 30
}
}
show menu ("What is your class?", split ("warrior;cleric;mage;thief" , ";"), false) {
player.class = result
switch (player.class) {
case ("warrior") {
player.cur_hp = player.cur_hp + 30
player.max_hp = player.max_hp + 30
player.str = player.str + 30
player.end = player.end + 30
player.dex = player.dex + 30
player.agi = player.agi + 20
player.spd = player.spd + 20
}
case ("cleric") {
player.cur_hp = player.cur_hp + 10
player.max_hp = player.max_hp + 10
player.cur_mp = player.cur_mp + 30
player.max_mp = player.max_mp + 30
player.agi = player.agi + 10
player.spd = player.spd + 10
player.spi = player.spi + 30
player.men = player.men + 30
}
case ("mage") {
player.cur_mp = player.cur_mp + 30
player.max_mp = player.max_mp + 30
player.agi = player.agi + 10
player.spd = player.spd + 10
player.int = player.int + 30
player.men = player.men + 30
}
case ("thief") {
player.cur_hp = player.cur_hp + 20
player.max_hp = player.max_hp + 20
player.str = player.str + 10
player.end = player.end + 10
player.dex = player.dex + 30
player.agi = player.agi + 30
player.spd = player.spd + 30
}
}
msg (player.alias + " is a " + player.gender + " " + player.race + " " + player.class + ".")
msg ("")
msg ("(Press a key to continue)")
wait {
ClearScreen
}
}
}
}
}
</function>
<function name="hp_mp_cur_max">
player.hp = player.cur_hp + " / " + player.max_hp
player.mp = player.cur_mp + " / " + player.max_mp
</function>
<function name="game_over">
if (player.cur_hp = 0) {
msg (player.alias + " has died.")
msg ("GAME OVER")
finish
}
</function>
<function name="lvlup"><![CDATA[
if (player.exp >= player.lvl * 100 + 100) {
player.exp = player.exp - (player.lvl * 100 + 100)
player.lvl = player.lvl + 1
}
]]></function>
</asl>
HegemonKhan wrote:
(Are container types, merely for implementing open~openable and close~closeable? what then is the point of the surface type? is it merely to deal with the scope?)
You can see a table (on which there is an apple).
} else if(cmb_chkObject(object) and cmb_chkObject(target)){
if (cmb_fight(object, target)) {
if (cmb_getAttrib(target,"cmb_hp")>0) {
msg( target.name + " hits back.")
cmb_fight(target,object)
if (cmb_getAttrib(object,"cmb_hp")>0) {
msg("")
HegemonKhan wrote:
is this the general structure~system of creating a combat system?
HegemonKhan wrote:
1B. as, there's also the object, 'cmb_intern'
HegemonKhan wrote:
1B. as, there's also the object, 'cmb_intern'
HegemonKhan wrote:
2. first, there's: 'cmb_chkObject' and 'cmb_chkFighter' functions
HegemonKhan wrote:
3. I finally found possibly where 'cmb_object'
HegemonKhan wrote:
4. I still can't find where or how the 'target' gets defined
<function name="cmb_attack" parameters="object, targetname" type="boolean">
cmb_attack (player, "orc")
target= getObject(targetname)
(code from Pertex' library)
<command name="attack">
<pattern>attack #text#</pattern>
<script>
cmb_attack (player, text)
</script>
</command>
<command name="attack">
<pattern>attack #object#</pattern>
<script>
cmb_attack (player, object)
</script>
</command>
<command name="attack">
<pattern>attack #object#</pattern>
<script>
cmb_attack (player, text)
</script>
</command>
<command name="attack">
<pattern>attack #text#</pattern>
<script>
cmb_attack (player, object)
</script>
</command>
<command name="fight">
<pattern>fight #text#</pattern>
<script>
battle_system (player , text)
</script>
</command>
<function name="battle_system" parameters="protagonist , text_input" type="boolean">
return_value = false
enemy = GetObject (text_input)
if (enemy = null) {
msg ("There is no " + enemy.alias + " here.")
return_value = false
} else if (not npc_reachable (enemy)) {
msg ("There is no " + enemy.alias + " in your vicinity.")
return_value = false
} else if (GetBoolean (enemy , "dead")) {
msg ("enemy.alias + " is already dead".")
return_value = false
} else if (not DoesInherit (enemy , npc_char)) {
msg ("You can not battle that!")
return_value = false
} else if (GetBoolean (enemy , hostile) = false) {
msg ("enemy.alias + " is not hostile".")
return_value = false
} else if (char_exists (protagonist) and char_exists (enemy)){
(under construction)
if (battle_sequence (attacker , defender)) {
if (???function needs to be created??? (defender , "cur_hp") > 0) {
msg (defender.alias + " fights back.")
battle_sequence (defender , attacker)
if (???function needs to be created??? (attacker , "cmb_hp") > 0) {
msg ("")
} else {
if (attacker = player) {
msg ("You have been killed.")
msg ("GAME OVER")
finish
} else {
msg (defender.name + " is killed.")
SetObjectFlagOn (defender , "dead")
defender.alias = GetDisplayAlias (defender) + " (dead)"
cmb_addexp(target)
if (DictionaryContains(target.cmb_script, "killed")) {
invoke (ScriptDictionaryItem(target.cmb_script, "killed"))
}
}
}
} else {
if (target=player){
msg( "A last strike hits you. You are dying.")
msg( "GAME OVER")
finish
} else {
msg( target.name + " dies.")
SetObjectFlagOn (target, "dead")
target.alias = GetDisplayAlias (target) +" (dead)"
cmb_addexp(target)
if (DictionaryContains(target.cmb_script, "killed")) {
invoke (ScriptDictionaryItem(target.cmb_script, "killed"))
}
}
}
} else {
msg("Why do you want to do this?")
}
returnvalue=true
}
return (returnvalue)
</function>
<function name="battle_sequence" parameters="protagonist , enemy" type="boolean">
(under construction)
vattack=0
vparade=0
if (cmb_chkFighter(object) and cmb_chkFighter(target)){
for (x ,1, cmb_getAttrib(object,"cmb_at")) {
vattack = vattack + cmb_dicesix()
}
for (x ,1 ,cmb_getAttrib(target,"cmb_pa")) {
vparade = vparade + cmb_dicesix()
}
msg("at: " + ToString(vattack) + ", pa: "+ToString(vparade))
if (vattack > vparade) {
damage=cmb_dice(object.cmb_str) + cmb_dice(vattack-vparade)
cmb_decAttrib (target, "cmb_hp", damage)
msg(object.name + " hits " + target.name + " for " + damage + " points.")
} else {
msg (object.name + " misses.")
}
return (true)
} else {
return (false)
}
</function>
<function name="npc_reachable" parameters="object" type="boolean">
value=false
foreach (x , ScopeReachableNotHeld ()) {
if (x = object) {
value=true
}
}
return (value)
</function>
<function name="char_exists" parameters="object" type="boolean">
value = false
foreach (x , AllObjects ()) {
if (object = x) {
value = true
}
}
return (value)
</function>
<function name="combat_player_critical_hit"><![CDATA[
player.critical_hit = RandomChance (GetInt (player , luck))
]]></function>
hostility idea:
npcs have an "anger" attribute value
if ("anger" >= 50) {
SetObjectFlagOn (npc_char_object , "hostile")
}
<asl version="520">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="Testing Game Stuff">
<gameid>d83ba5bb-2e3c-4f31-80c9-3e88a2dc082c</gameid>
<version>1.0</version>
<start type="script">
cc
</start>
</game>
<object name="room">
<inherit name="editor_room" />
<object name="player">
<inherit name="defaultplayer" />
<inherit name="pc_char" />
</object>
<object name="orc1">
<inherit name="editor_object" />
<inherit name="npc_char" />
<alias>orc</alias>
</object>
</object>
<turnscript name="player_game_turns">
<enabled />
<script>
lvlup
hp_mp_cur_max
game_over
player.turns = player.turns + 1
</script>
</turnscript>
<type name="char">
<cur_hp type="int">100</cur_hp>
<drop type="boolean">false</drop>
<max_hp type="int">100</max_hp>
<str type="int">0</str>
<end type="int">0</end>
<lvl type="int">0</lvl>
<exp type="int">0</exp>
<cash type="int">0</cash>
<dex type="int">0</dex>
<agi type="int">0</agi>
<spd type="int">0</spd>
<int type="int">0</int>
<spi type="int">0</spi>
<men type="int">0</men>
<cur_mp type="int">100</cur_mp>
<max_mp type="int">100</max_mp>
<hp type="int">0</hp>
<mp type="int">0</mp>
</type>
<type name="pc_char">
<inherit name="char" />
<turns type="int">0</turns>
<statusattributes type="stringdictionary">mp = ;hp = ;str = ;turns = ;end = ;dex = ;agi = ;spd = ;int = ;spi = ;men = ;lvl = ;exp = ;cash = </statusattributes>
</type>
<type name="npc_char">
<inherit name="char" />
<inherit name="surface" />
<dead type="boolean">false</dead>
<hostile type="boolean">false</hostile>
<displayverbs type="list">Look at; Talk; Steal; Give; Use; Cast; Fight</displayverbs>
<"anger" type="int">0</"anger">
<script>
if ("anger" >= 50) {
SetObjectFlagOn (this , "hostile")
}
</script>
</type>
<function name="cc">
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 ("human;dwarf;elf" , ";"), false) {
player.race = result
show menu ("What is your class?", split ("warrior;cleric;mage;thief" , ";"), false) {
player.class = result
msg (player.alias + " is a " + player.gender + " " + player.race + " " + player.class + ".")
msg ("")
msg ("(Press a key to continue)")
wait {
ClearScreen
}
}
}
}
}
</function>
<function name="hp_mp_cur_max">
player.hp = player.cur_hp + " / " + player.max_hp
player.mp = player.cur_mp + " / " + player.max_mp
</function>
<function name="game_over">
if (player.cur_hp = 0) {
msg (player.alias + " has died.")
msg ("GAME OVER")
finish
}
</function>
<function name="lvlup"><![CDATA[
if (player.exp >= player.lvl * 100 + 100) {
player.exp = player.exp - (player.lvl * 100 + 100)
player.lvl = player.lvl + 1
lvlup
}
]]></function>
</asl>
<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>
<pov type="object">player</pov>
<start type="script">
cc
</start>
</game>
<object name="room">
<inherit name="editor_room" />
<object name="player">
<inherit name="defaultplayer" />
<inherit name="pc_char" />
</object>
<object name="orc">
<inherit name="editor_object" />
<inherit name="npc_char" />
</object>
</object>
<turnscript name="player_game_turns">
<enabled />
<script>
lvlup
hp_mp_cur_max
game_over
player.turns = player.turns + 1
</script>
</turnscript>
<command name="fight">
<pattern>fight #text#</pattern>
<script>
battle_system (player, text)
</script>
</command>
<type name="char">
<cur_hp type="int">100</cur_hp>
<drop type="boolean">false</drop>
<max_hp type="int">100</max_hp>
<str type="int">0</str>
<end type="int">0</end>
<lvl type="int">0</lvl>
<exp type="int">0</exp>
<cash type="int">0</cash>
<dex type="int">0</dex>
<agi type="int">0</agi>
<spd type="int">0</spd>
<int type="int">0</int>
<spi type="int">0</spi>
<men type="int">0</men>
<cur_mp type="int">100</cur_mp>
<max_mp type="int">100</max_mp>
<hp type="int">0</hp>
<mp type="int">0</mp>
</type>
<type name="pc_char">
<inherit name="char" />
<turns type="int">0</turns>
<statusattributes type="stringdictionary">mp = ;hp = ;str = ;turns = ;end = ;dex = ;agi = ;spd = ;int = ;spi = ;men = ;lvl = ;exp = ;cash = </statusattributes>
</type>
<type name="npc_char">
<inherit name="char" />
<dead type="boolean">false</dead>
<hostile type="boolean">false</hostile>
<displayverbs type="list">Look at; Talk; Steal; Give; Use; Cast; Fight</displayverbs>
</type>
<function name="cc">
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 ("human;dwarf;elf" , ";"), false) {
player.race = result
show menu ("What is your class?", split ("warrior;cleric;mage;thief" , ";"), false) {
player.class = result
msg (player.alias + " is a " + player.gender + " " + player.race + " " + player.class + ".")
wait {
ClearScreen
}
}
}
}
}
</function>
<function name="hp_mp_cur_max">
player.hp = player.cur_hp + " / " + player.max_hp
player.mp = player.cur_mp + " / " + player.max_mp
</function>
<function name="game_over">
if (player.cur_hp = 0) {
msg (player.alias + " has died.")
msg ("GAME OVER")
finish
}
</function>
<function name="lvlup">
if (player.exp >= player.lvl * 100 + 100) {
player.exp = player.exp - (player.lvl * 100 + 100)
player.lvl = player.lvl + 1
lvlup
}
</function>
<function name="battle_system" parameters="protagonist , target" type="boolean">
return_value = false
enemy = GetObject (target)
if (enemy = null) {
msg ("There is no " + target + " here.")
return_value=false
} else if (not npc_reachable (enemy)) {
msg ("There is no " + enemy.name + " in your vicinity.")
return_value=false
} else if (GetBoolean (enemy , "dead")) {
msg (enemy.name + " is already dead.")
return_value=false
} else if (not Doesinherit (enemy , "npc_char")) {
msg ("You can not battle that!")
return_value=false
} else if (GetBoolean (enemy , "hostile") = false) {
msg (enemy.name + " is not hostile.")
return_value=false
}
</function>
<function name="npc_reachable" parameters="object" type="boolean">
value = false
foreach (x, ScopeReachableNotHeld ()) {
if (x=object) {
value = true
}
}
return (value)
</function>
</asl>
<function name="battle_system" parameters="protagonist , target" type="boolean">
return_value = false
enemy = GetObject (target)
if (enemy = null) {
Foreach (obj, AllObjects()){
if (obj.alias=target) {
enemy=obj
}
}
if (enemy = null) {
msg ("There is no " + target + " here.")
return_value=false
...
<command name="fight">
<pattern>fight #text#</pattern>
<script>
battle_system (game.pov , text)
</script>
</command>
<function name="battle_system" parameters="protagonist , target" type="boolean">
return_value = false
enemy = GetObject (target)
if (enemy = null) {
foreach (obj, AllObjects()){
if (obj.alias=target) {
enemy=obj
}
}
}
if (enemy = null) {
msg ("There is no " + target + " here.")
return_value=false
} else if (not npc_reachable (enemy)) {
msg ("There is no " + enemy.alias + " in your vicinity.")
return_value=false
} else if (GetBoolean (enemy , "dead")) {
msg (enemy.alias + " is already dead.")
return_value=false
} else if (not Doesinherit (enemy , "npc_char")) {
msg ("You can not battle that!")
return_value=false
} else if (GetBoolean (enemy , "hostile") = false) {
msg (enemy.alias + " is not hostile.")
return_value=false
} else if (char_exists (protagonist) and char_exists (enemy)) {
if (battle_sequence (protagonist , enemy)) {
if (GetInt (enemy , "cur_hp") > 0) {
msg (enemy.alias + " fights back.")
battle_sequence (enemy , protagonist)
if (GetInt (protagonist , "cmb_hp") > 0) {
msg ("")
} else {
if (protagonist = game.pov) {
game_over
} else {
msg (enemy.alias + " is killed.")
SetObjectFlagOn (enemy , "dead")
enemy.alias = GetDisplayAlias (enemy) + " (dead)"
cmb_addexp (enemy)
if (DictionaryContains (enemy.cmb_script, "killed")) {
invoke (ScriptDictionaryItem (enemy.cmb_script, "killed"))
}
}
}
} else {
if (protagonist=player) {
game_over
} else {
msg (enemy.alias + " is killed.")
SetObjectFlagOn (enemy, "dead")
enemy.alias = GetDisplayAlias (enemy) +" (dead)"
cmb_addexp (enemy)
if (DictionaryContains (enemy.cmb_script, "killed")) {
invoke (ScriptDictionaryItem (enemy.cmb_script, "killed"))
}
}
}
} else {
msg("Why do you want to do this?")
}
return_value=true
}
return (return_value)
</function>
<function name="battle_sequence" parameters="protagonist , enemy" type="boolean">
if (char_exists (protagonist) and char_exists (enemy)) {
if (GetInt (protagonist , spd) > GetInt (enemy , spd)) {
protagonist_battle_turn
enemy_battle_turn
battle_sequence
} else if (GetInt (protagonist , spd) = GetInt (enemy , spd)) {
if (RandomChance (50) = true) {
protagonist_battle_turn
enemy_battle_turn
battle_sequence
} else {
enemy_battle_turn
protagonist_battle_turn
battle_sequence
}
} else if (GetInt (protagonist , spd) < GetInt (enemy , spd)) {
enemy_battle_turn
protagonist_battle_turn
battle_sequence
}
}
battle_sequence
</function>
<function name="npc_reachable" parameters="object" type="boolean">
value=false
foreach (x , ScopeReachableNotHeld ()) {
if (x=object) {
value=true
}
}
return (value)
</function>
<function name="char_exists" parameters="object" type="boolean">
value = false
foreach (x , AllObjects ()) {
if (object=x) {
value = true
}
}
return (value)
</function>
<function name="protagonist_battle_turn">
show menu ("What is your battle choice?" , split ("Attack;Cast;Item;Run" , ";") , false) {
switch (result) {
case ("Attack") {
}
case ("Cast") {
}
case ("Item") {
}
case ("Run") {
}
}
}
if (GetInt (enemy , "cur_hp") > 0) {
if (RandomChance (GetInt (protagonist , spd) - GetInt (enemy , spd)) = true) {
msg ("You get an extra turn!")
protagonist_battle_turn
} else {
msg ("Your turn is over.")
}
} else {
msg ("Enemy is dead")
}
</function>
<function name="enemy_battle_turn">
GetRandomInt ( 1 , 2 ) {
switch (result) {
case (1) {
}
case (2) {
}
}
if (RandomChance (GetInt (enemy , spd) - GetInt (protagonist , spd)) = true) {
enemy_battle_turn
}
</function>
<function name="combat_player_critical_hit">
player.critical_hit = RandomChance (GetInt (game.pov , luck))
</function>
<!--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>
<pov type="object">player</pov>
<start type="script">
cc
</start>
</game>
<object name="room">
<inherit name="editor_room" />
<object name="player">
<inherit name="defaultplayer" />
<inherit name="pc_char" />
</object>
<object name="orc1">
<inherit name="editor_object" />
<inherit name="npc_char" />
<alias>orc</alias>
</object>
</object>
<turnscript name="player_game_turns">
<enabled />
<script>
lvlup
hp_mp_cur_max
game_over
player.turns = player.turns + 1
</script>
</turnscript>
<command name="fight">
<pattern>fight #text#</pattern>
<script>
battle_system (player, text)
</script>
</command>
<type name="char">
<cur_hp type="int">100</cur_hp>
<drop type="boolean">false</drop>
<max_hp type="int">100</max_hp>
<str type="int">0</str>
<end type="int">0</end>
<lvl type="int">0</lvl>
<exp type="int">0</exp>
<cash type="int">0</cash>
<dex type="int">0</dex>
<agi type="int">0</agi>
<spd type="int">0</spd>
<int type="int">0</int>
<spi type="int">0</spi>
<men type="int">0</men>
<cur_mp type="int">100</cur_mp>
<max_mp type="int">100</max_mp>
<hp type="int">0</hp>
<mp type="int">0</mp>
</type>
<type name="pc_char">
<inherit name="char" />
<turns type="int">0</turns>
<statusattributes type="stringdictionary">mp = ;hp = ;str = ;turns = ;end = ;dex = ;agi = ;spd = ;int = ;spi = ;men = ;lvl = ;exp = ;cash = </statusattributes>
</type>
<type name="npc_char">
<inherit name="char" />
<dead type="boolean">false</dead>
<hostile type="boolean">false</hostile>
<displayverbs type="list">Look at; Talk; Steal; Give; Use; Cast; Fight</displayverbs>
</type>
<function name="cc">
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 ("human;dwarf;elf" , ";"), false) {
player.race = result
show menu ("What is your class?", split ("warrior;cleric;mage;thief" , ";"), false) {
player.class = result
msg (player.alias + " is a " + player.gender + " " + player.race + " " + player.class + ".")
wait {
ClearScreen
}
}
}
}
}
</function>
<function name="hp_mp_cur_max">
player.hp = player.cur_hp + " / " + player.max_hp
player.mp = player.cur_mp + " / " + player.max_mp
</function>
<function name="game_over">
if (player.cur_hp = 0) {
msg (player.alias + " has died.")
msg ("GAME OVER")
finish
}
</function>
<function name="lvlup"><![CDATA[
if (player.exp >= player.lvl * 100 + 100) {
player.exp = player.exp - (player.lvl * 100 + 100)
player.lvl = player.lvl + 1
lvlup
}
]]></function>
<function name="battle_system" parameters="protagonist , target" type="boolean">
return_value = false
enemy = GetObject (target)
if (enemy = null) {
foreach (obj, AllObjects()){
if (obj.alias=target) {
enemy=obj
}
}
}
if (enemy = null) {
msg ("There is no " + target + " here.")
return_value=false
} else if (not npc_reachable (enemy)) {
msg ("There is no " + enemy.name + " in your vicinity.")
return_value=false
} else if (GetBoolean (enemy , "dead")) {
msg (enemy.name + " is already dead.")
return_value=false
} else if (not Doesinherit (enemy , "npc_char")) {
msg ("You can not battle that!")
return_value=false
} else if (GetBoolean (enemy , "hostile") = false) {
msg (enemy.name + " is not hostile.")
return_value=false
}
</function>
<function name="npc_reachable" parameters="object" type="boolean">
value = false
foreach (x, ScopeReachableNotHeld ()) {
if (x=object) {
value = true
}
}
return (value)
</function>
</asl>
<command name="fight">
<pattern>fight #text#</pattern>
<script>
battle_system (game.pov , text)
</script>
</command>
<function name="battle_system" parameters="protagonist , target" type="boolean">
return_value = false
enemy = GetObject (target)
if (enemy = null) {
foreach (obj, AllObjects()){
if (obj.alias=target) {
enemy=obj
}
}
}
if (enemy = null) {
msg ("There is no " + target + " here.")
return_value=false
} else if (not npc_reachable (enemy)) {
msg ("There is no " + enemy.alias + " in your vicinity.")
return_value=false
} else if (GetBoolean (enemy , "dead")) {
msg (enemy.alias + " is already dead.")
return_value=false
} else if (not Doesinherit (enemy , "npc_char")) {
msg ("You can not battle that!")
return_value=false
} else if (GetBoolean (enemy , "hostile") = false) {
msg (enemy.alias + " is not hostile.")
return_value=false
} else if (char_exists (protagonist) and char_exists (enemy)) {
if (battle_sequence (protagonist , enemy)) {
if (GetInt (enemy , "cur_hp") > 0) {
msg (enemy.alias + " fights back.")
battle_sequence (enemy , protagonist)
if (GetInt (protagonist , "cmb_hp") > 0) {
msg ("")
} else {
if (protagonist = game.pov) {
game_over
} else {
msg (enemy.alias + " is killed.")
SetObjectFlagOn (enemy , "dead")
enemy.alias = GetDisplayAlias (enemy) + " (dead)"
cmb_addexp (enemy)
if (DictionaryContains (enemy.cmb_script, "killed")) {
invoke (ScriptDictionaryItem (enemy.cmb_script, "killed"))
}
}
}
} else {
if (protagonist=player) {
game_over
} else {
msg (enemy.alias + " is killed.")
SetObjectFlagOn (enemy, "dead")
enemy.alias = GetDisplayAlias (enemy) +" (dead)"
cmb_addexp (enemy)
if (DictionaryContains (enemy.cmb_script, "killed")) {
invoke (ScriptDictionaryItem (enemy.cmb_script, "killed"))
}
}
}
} else {
msg("Why do you want to do this?")
}
return_value=true
}
return (return_value)
</function>
<function name="battle_sequence" parameters="protagonist , enemy" type="boolean">
if (char_exists (protagonist) and char_exists (enemy)) {
if (GetInt (protagonist , spd) > GetInt (enemy , spd)) {
protagonist_battle_turn
enemy_battle_turn
battle_sequence
} else if (GetInt (protagonist , spd) = GetInt (enemy , spd)) {
if (RandomChance (50) = true) {
protagonist_battle_turn
enemy_battle_turn
battle_sequence
} else {
enemy_battle_turn
protagonist_battle_turn
battle_sequence
}
} else if (GetInt (protagonist , spd) < GetInt (enemy , spd)) {
enemy_battle_turn
protagonist_battle_turn
battle_sequence
}
}
battle_sequence
</function>
<function name="battle_sequence" parameters="protagonist , enemy" type="boolean">
vattack=0
vparade=0
if (cmb_chkFighter(object) and cmb_chkFighter(target)){
for (x , 1 , cmb_getAttrib(object,"cmb_at")) {
vattack = vattack + cmb_dicesix()
}
for (x , 1 , cmb_getAttrib(target,"cmb_pa")) {
vparade = vparade + cmb_dicesix()
}
msg("at: " + ToString(vattack) + ", pa: "+ToString(vparade))
if (vattack > vparade) {
damage=cmb_dice(object.cmb_str) + cmb_dice(vattack-vparade)
cmb_decAttrib (target, "cmb_hp", damage)
msg(object.name + " hits " + target.name + " for " + damage + " points.")
} else {
msg (object.name + " misses.")
}
return (true)
} else {
return (false)
}
</function>
<function name="npc_reachable" parameters="object" type="boolean">
value=false
foreach (x , ScopeReachableNotHeld ()) {
if (x=object) {
value=true
}
}
return (value)
</function>
<function name="char_exists" parameters="object" type="boolean">
value = false
foreach (x , AllObjects ()) {
if (object=x) {
value = true
}
}
return (value)
</function>
<function name="protagonist_battle_turn">
show menu ("What is your battle choice?" , split ("Attack;Cast;Item;Run" , ";") , false) {
switch (result) {
case ("Attack") {
}
case ("Cast") {
}
case ("Item") {
}
case ("Run") {
}
}
}
if (GetInt (enemy , "cur_hp") > 0) {
if (RandomChance (GetInt (protagonist , spd) - GetInt (enemy , spd)) = true) {
msg ("You get an extra turn!")
protagonist_battle_turn
} else {
msg ("Your turn is over.")
}
} else {
msg ("Enemy is dead")
}
</function>
<function name="enemy_battle_turn">
GetRandomInt ( 1 , 2 ) {
switch (result) {
case (1) {
}
case (2) {
}
}
if (RandomChance (GetInt (enemy , spd) - GetInt (protagonist , spd)) = true) {
enemy_battle_turn
}
</function>
<function name="combat_player_critical_hit">
player.critical_hit = RandomChance (GetInt (game.pov , luck))
</function>
<!--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>
<pov type="object">player</pov>
<start type="script">
cc
</start>
</game>
<object name="room">
<inherit name="editor_room" />
<object name="player">
<inherit name="defaultplayer" />
<inherit name="pc_char" />
</object>
<object name="orc1">
<inherit name="editor_object" />
<inherit name="npc_char" />
<alias>orc</alias>
</object>
</object>
<turnscript name="player_game_turns">
<enabled />
<script>
lvlup
hp_mp_cur_max
game_over
player.turns = player.turns + 1
</script>
</turnscript>
<command name="fight">
<pattern>fight #text#</pattern>
<script>
battle_system (player, text)
</script>
</command>
<type name="char">
<cur_hp type="int">100</cur_hp>
<drop type="boolean">false</drop>
<max_hp type="int">100</max_hp>
<str type="int">0</str>
<end type="int">0</end>
<lvl type="int">0</lvl>
<exp type="int">0</exp>
<cash type="int">0</cash>
<dex type="int">0</dex>
<agi type="int">0</agi>
<spd type="int">0</spd>
<int type="int">0</int>
<spi type="int">0</spi>
<men type="int">0</men>
<cur_mp type="int">100</cur_mp>
<max_mp type="int">100</max_mp>
<hp type="int">0</hp>
<mp type="int">0</mp>
</type>
<type name="pc_char">
<inherit name="char" />
<turns type="int">0</turns>
<statusattributes type="stringdictionary">mp = ;hp = ;str = ;turns = ;end = ;dex = ;agi = ;spd = ;int = ;spi = ;men =
;lvl = ;exp = ;cash = </statusattributes>
</type>
<type name="npc_char">
<inherit name="char" />
<dead type="boolean">false</dead>
<hostile type="boolean">false</hostile>
<displayverbs type="list">Look at; Talk; Steal; Give; Use; Cast; Fight</displayverbs>
</type>
<function name="cc">
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 ("human;dwarf;elf" , ";"), false) {
player.race = result
show menu ("What is your class?", split ("warrior;cleric;mage;thief" , ";"), false) {
player.class = result
msg (player.alias + " is a " + player.gender + " " + player.race + " " + player.class + ".")
wait {
ClearScreen
}
}
}
}
}
</function>
<function name="hp_mp_cur_max">
player.hp = player.cur_hp + " / " + player.max_hp
player.mp = player.cur_mp + " / " + player.max_mp
</function>
<function name="game_over">
if (player.cur_hp = 0) {
msg (player.alias + " has died.")
msg ("GAME OVER")
finish
}
</function>
<function name="lvlup"><![CDATA[
if (player.exp >= player.lvl * 100 + 100) {
player.exp = player.exp - (player.lvl * 100 + 100)
player.lvl = player.lvl + 1
lvlup
}
]]></function>
<function name="battle_system" parameters="protagonist , target" type="boolean">
return_value = false
enemy = GetObject (target)
if (enemy = null) {
foreach (obj, AllObjects()){
if (obj.alias=target) {
enemy=obj
}
}
}
if (enemy = null) {
msg ("There is no " + target + " here.")
return_value=false
} else if (not npc_reachable (enemy)) {
msg ("There is no " + enemy.name + " in your vicinity.")
return_value=false
} else if (GetBoolean (enemy , "dead")) {
msg (enemy.name + " is already dead.")
return_value=false
} else if (not Doesinherit (enemy , "npc_char")) {
msg ("You can not battle that!")
return_value=false
} else if (GetBoolean (enemy , "hostile") = false) {
msg (enemy.name + " is not hostile.")
return_value=false
} else if (char_exists (protagonist) and char_exists (enemy)) {
if (battle_sequence (protagonist , enemy)) {
}
}
</function>
<function name="battle_sequence" parameters="protagonist , enemy" type="boolean">
if (char_exists (protagonist) and char_exists (enemy)) {
if (GetInt (protagonist , spd) > GetInt (enemy , spd)) {
protagonist_battle_turn
enemy_battle_turn
battle_sequence
} else if (GetInt (protagonist , spd) = GetInt (enemy , spd)) {
if (RandomChance (50) = true) {
protagonist_battle_turn
enemy_battle_turn
battle_sequence
} else {
enemy_battle_turn
protagonist_battle_turn
battle_sequence
}
} else if (GetInt (protagonist , spd) < GetInt (enemy , spd)) {
enemy_battle_turn
protagonist_battle_turn
battle_sequence
}
}
battle_sequence
</function>
<function name="npc_reachable" parameters="object" type="boolean">
value = false
foreach (x, ScopeReachableNotHeld ()) {
if (x=object) {
value = true
}
}
return (value)
</function>
<function name="char_exists" parameters="object" type="boolean">
value = false
foreach (x , AllObjects ()) {
if (object=x) {
value = true
}
}
return (value)
</function>
<function name="protagonist_battle_turn">
show menu ("What is your battle choice?" , split ("Attack;Cast;Item;Run" , ";") , false) {
switch (result) {
case ("Attack") {
}
case ("Cast") {
}
case ("Item") {
}
case ("Run") {
}
}
}
if (GetInt (enemy , "cur_hp") > 0) {
if (RandomChance (GetInt (protagonist , spd) - GetInt (enemy , spd)) = true) {
msg ("You get an extra turn!")
protagonist_battle_turn
} else {
msg ("Your turn is over.")
}
} else {
msg ("Enemy is dead")
}
</function>
<function name="enemy_battle_turn">
GetRandomInt ( 1 , 2 ) {
switch (result) {
case (1) {
}
case (2) {
}
}
}
if (RandomChance (GetInt (enemy , spd) - GetInt (protagonist , spd)) = true) {
enemy_battle_turn
}
</function>
</asl>
<function name="battle_sequence" parameters="protagonist , enemy" type="boolean">
if (char_exists (protagonist) and char_exists (enemy)) {
if (GetInt (protagonist , spd) > GetInt (enemy , spd)) {
protagonist_battle_turn
enemy_battle_turn
battle_sequence
} else if (GetInt (protagonist , spd) = GetInt (enemy , spd)) {
if (RandomChance (50) = true) {
protagonist_battle_turn
enemy_battle_turn
battle_sequence
} else {
enemy_battle_turn
protagonist_battle_turn
battle_sequence
}
} else if (GetInt (protagonist , spd) < GetInt (enemy , spd)) {
enemy_battle_turn
protagonist_battle_turn
battle_sequence
}
}
battle_sequence
</function>
<function name="battle_sequence" parameters="protagonist , enemy" type="boolean">
</function>
<!--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>
<pov type="object">player</pov>
<start type="script">
cc
</start>
</game>
<object name="room">
<inherit name="editor_room" />
<object name="player">
<inherit name="defaultplayer" />
<inherit name="pc_char" />
</object>
<object name="orc1">
<inherit name="editor_object" />
<inherit name="npc_char" />
<alias>orc</alias>
</object>
</object>
<turnscript name="player_game_turns">
<enabled />
<script>
lvlup
hp_mp_cur_max
game_over
player.turns = player.turns + 1
</script>
</turnscript>
<command name="fight">
<pattern>fight #text#</pattern>
<script>
battle_system (player, text)
</script>
</command>
<type name="char">
<cur_hp type="int">100</cur_hp>
<drop type="boolean">false</drop>
<max_hp type="int">100</max_hp>
<str type="int">0</str>
<end type="int">0</end>
<lvl type="int">0</lvl>
<exp type="int">0</exp>
<cash type="int">0</cash>
<dex type="int">0</dex>
<agi type="int">0</agi>
<spd type="int">0</spd>
<int type="int">0</int>
<spi type="int">0</spi>
<men type="int">0</men>
<cur_mp type="int">100</cur_mp>
<max_mp type="int">100</max_mp>
<hp type="int">0</hp>
<mp type="int">0</mp>
</type>
<type name="pc_char">
<inherit name="char" />
<turns type="int">0</turns>
<statusattributes type="stringdictionary">mp = ;hp = ;str = ;turns = ;end = ;dex = ;agi = ;spd = ;int = ;spi = ;men = ;lvl = ;exp = ;cash = </statusattributes>
</type>
<type name="npc_char">
<inherit name="char" />
<dead type="boolean">false</dead>
<hostile type="boolean">false</hostile>
<displayverbs type="list">Look at; Talk; Steal; Give; Use; Cast; Fight</displayverbs>
</type>
<function name="cc">
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 ("human;dwarf;elf" , ";"), false) {
player.race = result
show menu ("What is your class?", split ("warrior;cleric;mage;thief" , ";"), false) {
player.class = result
msg (player.alias + " is a " + player.gender + " " + player.race + " " + player.class + ".")
wait {
ClearScreen
}
}
}
}
}
</function>
<function name="hp_mp_cur_max">
player.hp = player.cur_hp + " / " + player.max_hp
player.mp = player.cur_mp + " / " + player.max_mp
</function>
<function name="game_over">
if (player.cur_hp = 0) {
msg (player.alias + " has died.")
msg ("GAME OVER")
finish
}
</function>
<function name="lvlup"><![CDATA[
if (player.exp >= player.lvl * 100 + 100) {
player.exp = player.exp - (player.lvl * 100 + 100)
player.lvl = player.lvl + 1
lvlup
}
]]></function>
<function name="battle_system" parameters="protagonist , target" type="boolean">
return_value = false
enemy = GetObject (target)
if (enemy = null) {
foreach (obj, AllObjects()) {
if (obj.alias=target) {
enemy = obj
}
}
}
if (enemy = null) {
msg ("There is no " + target + " here.")
return_value = false
}
else if (not npc_reachable (enemy)) {
msg ("There is no " + enemy.name + " in your vicinity.")
return_value = false
}
else if (GetBoolean (enemy , "dead")) {
msg (enemy.name + " is already dead.")
return_value = false
}
else if (not Doesinherit (enemy , "npc_char")) {
msg ("You can not battle that!")
return_value = false
}
else if (GetBoolean (enemy , "hostile") = false) {
msg (enemy.name + " is not hostile.")
return_value = false
}
else if (char_exists (protagonist) and char_exists (enemy)) {
if (battle_sequence (protagonist , enemy)) {
}
}
</function>
<function name="battle_sequence" parameters="protagonist , enemy" type="boolean"><![CDATA[
if (char_exists (protagonist) and char_exists (enemy)) {
if (GetInt (protagonist , spd) > GetInt (enemy , spd)) {
protagonist_battle_turn
enemy_battle_turn
battle_sequence
}
else if (GetInt (protagonist , spd) = GetInt (enemy , spd)) {
if (RandomChance (50) = true) {
protagonist_battle_turn
enemy_battle_turn
battle_sequence
}
else {
enemy_battle_turn
protagonist_battle_turn
battle_sequence
}
}
else if (GetInt (protagonist , spd) < GetInt (enemy , spd)) {
enemy_battle_turn
protagonist_battle_turn
battle_sequence
}
else {
}
}
]]></function>
<function name="npc_reachable" parameters="object" type="boolean">
value = false
foreach (x, ScopeReachableNotHeld ()) {
if (x=object) {
value = true
}
}
return (value)
</function>
<function name="char_exists" parameters="object" type="boolean">
value = false
foreach (x, AllObjects ()) {
if (object=x) {
value = true
}
}
return (value)
</function>
<function name="protagonist_battle_turn"><![CDATA[
show menu ("What is your battle choice?", split ("Attack;Cast;Item;Run" , ";"), false) {
switch (result) {
case ("Attack") {
}
case ("Cast") {
}
case ("Item") {
}
case ("Run") {
}
}
}
if (GetInt (enemy , "cur_hp") > 0) {
if (RandomChance (GetInt (protagonist , spd) - GetInt (enemy , spd)) = true) {
msg ("You get an extra turn!")
protagonist_battle_turn
}
else {
msg ("Your turn is over.")
}
}
else {
msg ("Enemy is dead")
}
]]></function>
<function name="enemy_battle_turn">
GetRandomInt (1, 2) {
switch (result) {
case (1) {
}
case (2) {
}
}
}
if (RandomChance (GetInt (enemy , spd) - GetInt (protagonist , spd)) = true) {
enemy_battle_turn
}
</function>
</asl>
<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>
<pov type="object">player</pov>
<start type="script">
cc
</start>
<turns type="int">0</turns>
<statusattributes type="stringdictionary">turns = </statusattributes>
</game>
<object name="room">
<inherit name="editor_room" />
<object name="player">
<inherit name="defaultplayer" />
<inherit name="pc_char" />
<statusattributes type="stringdictionary">mp = ;hp = ;str = ;end = ;dex = ;agi = ;spd = ;int = ;spi = ;men = ;lvl =
;exp = ;cash = </statusattributes>
</object>
<object name="orc1">
<inherit name="editor_object" />
<inherit name="npc_char" />
<alias>orc</alias>
</object>
</object>
<turnscript name="game_turns">
<enabled />
<script>
lvlup
hp_mp_cur_max
game_over
game.turns = game.turns + 1
</script>
</turnscript>
<command name="fight">
<pattern>fight #text#</pattern>
<script>
battle_system (game.pov , text)
</script>
</command>
<type name="char">
<cur_hp type="int">100</cur_hp>
<drop type="boolean">false</drop>
<max_hp type="int">100</max_hp>
<str type="int">0</str>
<end type="int">0</end>
<lvl type="int">0</lvl>
<exp type="int">0</exp>
<cash type="int">0</cash>
<dex type="int">0</dex>
<agi type="int">0</agi>
<spd type="int">0</spd>
<int type="int">0</int>
<spi type="int">0</spi>
<men type="int">0</men>
<cur_mp type="int">100</cur_mp>
<max_mp type="int">100</max_mp>
<hp type="int">0</hp>
<mp type="int">0</mp>
</type>
<type name="pc_char">
<inherit name="char" />
<statusattributes type="stringdictionary">mp = ;hp = ;str = ;turns = ;end = ;dex = ;agi = ;spd = ;int = ;spi = ;men =
;lvl = ;exp = ;cash = </statusattributes>
</type>
<type name="npc_char">
<inherit name="char" />
<dead type="boolean">false</dead>
<hostile />
<displayverbs type="list">Look; Talk; Steal; Give; Use; Cast; Fight</displayverbs>
</type>
<function name="cc">
msg ("What is your name?")
get input {
game.pov.alias = result
msg (" - " + game.pov.alias)
show menu ("What is your gender?", split ("male;female" , ";"), false) {
game.pov.gender = result
show menu ("What is your race?", split ("human;dwarf;elf" , ";"), false) {
game.pov.race = result
show menu ("What is your class?", split ("warrior;cleric;mage;thief" , ";"), false) {
game.pov.class = result
msg (game.pov.alias + " is a " + game.pov.gender + " " + game.pov.race + " " + game.pov.class + ".")
wait {
ClearScreen
}
}
}
}
}
</function>
<function name="hp_mp_cur_max">
game.pov.hp = game.pov.cur_hp + " / " + game.pov.max_hp
game.pov.mp = game.pov.cur_mp + " / " + game.pov.max_mp
</function>
<function name="game_over">
if (game.pov.cur_hp = 0) {
msg (game.pov.alias + " has died.")
msg ("GAME OVER")
finish
}
</function>
<function name="lvlup"><![CDATA[
if (game.pov.exp >= game.pov.lvl * 100 + 100) {
game.pov.exp = game.pov.exp - (game.pov.lvl * 100 + 100)
game.pov.lvl = game.pov.lvl + 1
lvlup
}
]]></function>
<function name="battle_system" parameters="selfname , textname" type="boolean">
return_value = false
enemy = GetObject (textname)
if (enemy = null) {
foreach (obj, AllObjects()) {
if (obj.alias=textname) {
enemy = obj
}
}
}
if (enemy = null) {
msg ("There is no " + textname + " here.")
return_value = false
}
else if (not npc_reachable (enemy)) {
msg ("There is no " + enemy.alias + " in your vicinity.")
return_value = false
}
else if (GetBoolean (enemy , "dead")) {
msg (enemy.alias + " is already dead.")
return_value = false
}
else if (not Doesinherit (enemy , "npc_char")) {
msg ("You can not battle that!")
return_value = false
}
else if (GetBoolean (enemy , "hostile") = false) {
msg (enemy.alias + " is not hostile.")
return_value = false
}
if (battle_sequence (selfname , enemy)) {
return_value = true
}
return (return_value)
</function>
<function name="battle_sequence" parameters="self , enemy" type="boolean"><![CDATA[
if (GetInt (self , spd) > GetInt (enemy , spd)) {
self_battle_turn
enemy_battle_turn
battle_sequence
}
else if (GetInt (self , spd) = GetInt (enemy , spd)) {
if (RandomChance (50) = true) {
self_battle_turn
enemy_battle_turn
battle_sequence
}
else {
enemy_battle_turn
self_battle_turn
battle_sequence
}
}
else if (GetInt (self , spd) < GetInt (enemy , spd)) {
enemy_battle_turn
self_battle_turn
battle_sequence
}
else {
}
]]></function>
<function name="npc_reachable" parameters="object" type="boolean">
value = false
foreach (x, ScopeReachableNotHeld ()) {
if (x=object) {
value = true
}
}
return (value)
</function>
<function name="self_battle_turn"><![CDATA[
show menu ("What is your battle choice?", split ("Attack;Cast;Item;Run" , ";"), false) {
switch (result) {
case ("Attack") {
}
case ("Cast") {
}
case ("Item") {
}
case ("Run") {
}
}
}
if (GetInt (enemy , "cur_hp") > 0) {
if (RandomChance (GetInt (self , spd) - GetInt (enemy , spd)) = true) {
msg ("You get an extra battle turn!")
self_battle_turn
}
else {
msg ("Your battle turn is over.")
}
}
else {
msg (enemy.alias + " is dead.")
}
]]></function>
<function name="enemy_battle_turn">
if (RandomChance (GetInt (enemy , spd) - GetInt (self , spd)) = true) {
enemy_battle_turn
}
</function>
</asl>
<library>
<!-- done by Pertex (pertex@gmx.de)-->
<object name="cmb_intern">
<cmb_attribs type="list">CMB_PA;CMB_AT;CMB_STR;CMB_HP;CMB_EXP</cmb_attribs>
<cmb_lvlexp type="stringdictionary">1=50;2=100;3=200;4=400;5=800;6=1500;7=3000</cmb_lvlexp>
<cmb_lvlmod type="stringdictionary">1=at=1,pa=1;2=at=2,hp=100;3=str=4,at=1;4=at=2;5=pa=2;6=at=2;7=at=1</cmb_lvlmod>
</object>
<type name="cmb_equipment">
<cmb_mod type="stringdictionary"/>
<cmb_where type="string"></cmb_where>
<!-- "head", neck", "body", "arms", "rhand", "lhand", "dhand", "legs", "feet" -->
<cmb_activelvl type="int">1</cmb_activelvl>
</type>
<type name="cmb_fighter">
<cmb_at type="int">1</cmb_at>
<cmb_pa type="int">1</cmb_pa>
<cmb_str type="int">1</cmb_str>
<cmb_hp type="int">100</cmb_hp>
<cmb_at_max type="int">1</cmb_at_max>
<cmb_pa_max type="int">1</cmb_pa_max>
<cmb_str_max type="int">1</cmb_str_max>
<cmb_hp_max type="int">100</cmb_hp_max>
<cmb_exp type="int">0</cmb_exp>
<cmb_level type="int">0</cmb_level>
<dead type="boolean">false</dead>
<equiped type="string"></equiped>
<cmb_script type="scriptdictionary">
<item key="killed">
msg("killed")
</item>
</cmb_script>
</type>
<command name="attack">
<pattern>attack #text#</pattern>
<script>
cmb_attack (player, text)
</script>
</command>
<command name="loot">
<pattern>loot #text#</pattern>
<script>
cmb_loot ( trim(text) )
</script>
</command>
<command name="equip">
<pattern>equip #text#</pattern>
<script>
cmb_equip ( trim(text) )
</script>
</command>
<command name="unequip">
<pattern>unequip #text#</pattern>
<script>
cmb_unequip ( trim(text) )
</script>
</command>
<command name="unequipall">
<pattern>unequip all</pattern>
<script>
foreach (x,ScopeInventory () ) {
if (InstrRev ( getString(x, "alias") , "(" )>2) {
cmb_unequip ( getString (x, "name"))
}
}
</script>
</command>
<command name="equiped">
<pattern>equiped</pattern>
<script>
found=false
foreach (x,ScopeInventory () ) {
if (InstrRev ( getString(x, "alias") , "(" )>2) {
text=""
foreach(y,x.cmb_mod ) {
text=concat (text,concat (y,StringDictionaryItem (x.cmb_mod,y),"="),",")
}
msg (x.name+ " - Level " + x.cmb_activelvl + ", modification: "+ text )
found=true
}
}
if (not found) {
msg("You don't have any equiped item.")
}
</script>
</command>
<command name="equipment">
<pattern>equipment</pattern>
<script>
found=false
foreach (x,ScopeInventory () ) {
if (DoesInherit (x, "cmb_equipment")) {
text=""
foreach(y,x.cmb_mod ) {
text=concat (text,concat (y,StringDictionaryItem (x.cmb_mod,y),"="),",")
}
msg (x.name+ " - Level " + x.cmb_activelvl + ", modification: "+ text )
found=true
}
}
if (not found) {
msg("None of your items in your inventory can be equiped.")
}
</script>
</command>
<function name="cmb_addStatus" parameters="attrib">
attrib = cmb_chkAttrib (attrib)
if (GetAttribute ( player , "statusattributes" )=null ) {
player.statusattributes = NewStringDictionary()
}
switch (attrib) {
case ("cmb_hp") {
dictionary add (player.statusattributes, "cmb_hp", "Health: !/"+ player.cmb_hp_max )
}
case ("cmb_at") {
dictionary add (player.statusattributes, "cmb_at", "AT: !" )
}
case ("cmb_pa") {
dictionary add (player.statusattributes, "cmb_pa", "PA: !" )
}
case ("cmb_str") {
dictionary add (player.statusattributes, "cmb_str", "Strength: !" )
}
case ("cmb_level") {
dictionary add (player.statusattributes, "cmb_level", "Level: !" )
}
case ("cmb_exp") {
dictionary add (player.statusattributes, "cmb_exp", "EP: !" )
}
}
</function>
<function name="cmb_refreshStatus" >
saveStatus = NewStringList()
foreach( x , player.statusattributes){
list add(saveStatus, x)
}
player.statusattributes = NewStringDictionary()
foreach( x , saveStatus){
cmb_addStatus (x)
}
</function>
<function name="cmb_setAttrib" parameters="object,attrib,value">
if (cmb_chkObject(object)){
attrib=cmb_chkAttrib(attrib)
if (LengthOf(attrib)>0) {
set(object,attrib,value)
}
}
</function>
<function name="cmb_getAttrib" parameters="object,attrib" type="int">
if (cmb_chkObject(object)){
attrib=cmb_chkAttrib(attrib)
if (LengthOf(attrib)>0) {
return (GetInt(object,attrib))
} else {
return(0)
}
}
</function>
<function name="cmb_incAttrib" parameters="object,attrib,value" type="boolean">
if (cmb_chkObject(object)){
attrib=cmb_chkAttrib(attrib)
if (LengthOf(attrib)>0) {
cmb_setAttrib(object,attrib, cmb_getAttrib(object,attrib) + value)
return (true)
} else {
return (false)
}
} else {
return (false)
}
</function>
<function name="cmb_decAttrib" parameters="object,attrib,value" type="boolean">
if (cmb_chkObject(object)){
attrib=cmb_chkAttrib(attrib)
if (LengthOf(attrib)>0) {
cmb_setAttrib(object,attrib,cmb_getAttrib(object,attrib) - value)
return (true)
} else {
return (false)
}
} else {
return (false)
}
</function>
<function name="cmb_equip" parameters="itemname" type="boolean">
found=false
item= getObject(itemname)
if (item=null) {
msg("What does " + itemname + " mean?")
} else if ( not DoesInherit (item, "cmb_equipment")) {
msg("You can't equip this item.")
} else {
if (cmb_chkObject(item)){
foreach (cmb_object, ScopeInventory()) {
if (item=cmb_object){
found=true
}
}
if ( not found) {
msg ("You don't have this in your inventory.")
}
}
}
if (found) {
if ( player.cmb_level >=item.cmb_activelvl ) {
dict_equiped = NewStringDictionary ()
string2dict ( player.equiped,dict_equiped)
if (item.cmb_where="dhand" and (DictionaryContains (dict_equiped,"lhand") or (DictionaryContains (dict_equiped,"rhand")))){
msg("1")
msg("You already are carrying something in your hands!")
} else if ((item.cmb_where="dhand" or item.cmb_where="rhand") and DictionaryContains (dict_equiped,"dhand")){
msg("2")
msg("You already are carrying something in your hands!")
} else if ( DictionaryContains (dict_equiped,item.cmb_where)) {
msg("You already have something equiped there!")
} else {
dictionary add( dict_equiped,item.cmb_where, itemname)
item.alias=GetDisplayAlias (item)+ " ("+item.cmb_where+")"
eval_mod(player,item.cmb_mod, true )
}
player.equiped=dict2string (dict_equiped)
cmb_refreshStatus
msg("Done")
} else {
msg("You are not experienced enough to equip this item.")
}
}
return (true)
</function>
<function name="cmb_unequip" parameters="itemname" type="boolean">
found=false
item= getObject(itemname)
if (item=null) {
msg("What does " + itemname + " mean?")
} else if ( not DoesInherit (item, "cmb_equipment")) {
msg("You can't unequip this item.")
} else {
if (cmb_chkObject(item)){
foreach (cmb_object, ScopeInventory()) {
if (item=cmb_object){
found=true
}
}
if ( not found) {
msg ("You don't have this in your inventory.")
}
}
}
if (found) {
dict_equiped = NewStringDictionary ()
string2dict ( player.equiped,dict_equiped)
pos=DictionaryContainsValue(dict_equiped, itemname)
if ( lengthof(pos) > 0) {
dictionary remove(dict_equiped, pos)
if (InstrRev ( getString(item,"alias") , "(" )>2) {
item.alias=Left ( item.alias , InstrRev ( getString (item, "alias") , "(" )-2 )
}
eval_mod(player,item.cmb_mod, false )
}
player.equiped=dict2string (dict_equiped)
cmb_refreshStatus
msg("Done")
}
return (true)
</function>
<function name="cmb_unequipIntern" parameters="itemname" type="boolean">
item= getObject(itemname)
if (item=null) {
} else {
dict_equiped = NewStringDictionary ()
string2dict ( player.equiped,dict_equiped)
pos=DictionaryContainsValue(dict_equiped, itemname)
if ( lengthof(pos) > 0) {
dictionary remove(dict_equiped, pos)
if (InstrRev ( getString(item,"alias") , "(" )>2) {
item.alias=Left ( item.alias , InstrRev ( getString(item,"alias") , "(" )-2 )
}
eval_mod(player,item.cmb_mod, false )
}
player.equiped=dict2string (dict_equiped)
cmb_refreshStatus
}
</function>
<function name="eval_mod" parameters="object,mod_dict,inc">
foreach ( x, mod_dict ) {
if (x="at" or x="pa" or x="hp" or x="str"){
y=stringdictionaryitem(mod_dict,x)
if (IsInt(y)) {
if (inc) {
cmb_incAttrib(object,x,toint(y))
} else {
cmb_decAttrib(object,x,toint(y))
}
}
}
}
</function>
<function name="cmb_loot" parameters="targetname">
target= getObject(targetname)
if (target=null){
msg("You can't see that here.")
} else{
found=false
if(cmb_chkObject(target) and cmb_isReachable(target)){
if (target.dead) {
foreach (cmb_object, AllObjects()) {
if (cmb_object.parent=target) {
MoveObject (cmb_object, target.parent)
found=true
}
}
destroy(target.name)
if (found) {
msg("You found something.")
} else {
msg("You could not found something interessting.")
}
} else {
msg("You cant loot now.")
}
} else {
msg("You cant loot " + target.alias)
}
}
</function>
<function name="cmb_fight" parameters="object, target" type="boolean">
vattack=0
vparade=0
if (cmb_chkFighter(object) and cmb_chkFighter(target)){
for (x ,1, cmb_getAttrib(object,"cmb_at")) {
vattack = vattack + cmb_dicesix()
}
for (x ,1 ,cmb_getAttrib(target,"cmb_pa")) {
vparade = vparade + cmb_dicesix()
}
msg("at: " + ToString(vattack) + ", pa: "+ToString(vparade))
if (vattack > vparade) {
damage=cmb_dice(object.cmb_str) + cmb_dice(vattack-vparade)
cmb_decAttrib (target, "cmb_hp", damage)
msg(object.name + " hits " + target.name + " for " + damage + " points.")
} else {
msg (object.name + " misses.")
}
return (true)
} else {
return (false)
}
</function>
<function name="cmb_attack" parameters="object, targetname" type="boolean">
returnvalue=false
target= getObject(targetname)
if(target=null){
msg("There is no " + targetname + " here.")
returnvalue=false
} else if (not cmb_isReachable(target)){
msg("There is no " + target.name + " here.")
returnvalue=false
} else if (GetBoolean ( target , "dead" ) ){
msg("Your target is not alive any more.")
returnvalue=false
} else if(cmb_chkObject(object) and cmb_chkObject(target)){
if (cmb_fight(object, target)) {
if (cmb_getAttrib(target,"cmb_hp")>0) {
msg( target.name + " hits back.")
cmb_fight(target,object)
if (cmb_getAttrib(object,"cmb_hp")>0) {
msg("")
} else {
if (object=player){
msg( "A last strike hits you. You are dying.")
msg( "GAME OVER")
finish
} else {
msg( object.name + " dies.")
SetObjectFlagOn (target, "dead")
target.alias = GetDisplayAlias (target) +" (dead)"
cmb_addexp(target)
if (DictionaryContains(target.cmb_script, "killed")) {
invoke (ScriptDictionaryItem(target.cmb_script, "killed"))
}
}
}
} else {
if (target=player){
msg( "A last strike hits you. You are dying.")
msg( "GAME OVER")
finish
} else {
msg( target.name + " dies.")
SetObjectFlagOn (target, "dead")
target.alias = GetDisplayAlias (target) +" (dead)"
cmb_addexp(target)
if (DictionaryContains(target.cmb_script, "killed")) {
invoke (ScriptDictionaryItem(target.cmb_script, "killed"))
}
}
}
} else {
msg("Why do you want to do this?")
}
returnvalue=true
}
return (returnvalue)
</function>
<function name="cmb_addexp" parameters="object" >
found=false
new_level=0
if (object.cmb_exp>0){
player.cmb_exp=player.cmb_exp+object.cmb_exp
msg("You got "+object.cmb_exp+" exp.")
foreach(x,cmb_intern.cmb_lvlexp) {
if(player.cmb_exp >= ToInt( StringDictionaryItem(cmb_intern.cmb_lvlexp,x))){
new_level=toint(x)
found=true
}
}
}
if (found) {
player.cmb_level=new_level
msg("Level "+new_level)
cmb_refreshStatus
}
</function>
<function name="cmb_chkObject" parameters="object" type="boolean">
value = false
foreach (cmb_object, AllObjects()) {
if (object=cmb_object) {
value = true
}
}
return (value)
</function>
<function name="cmb_chkFighter" parameters="object" type="boolean">
if (DoesInherit (object, "cmb_fighter")) {
return (true)
} else {
return (false)
}
</function>
<function name="cmb_chkAttrib" parameters="attrib" type="string">
<![CDATA[
if (ucase(left(attrib,4))<> "CMB_") {
attrib="cmb_" + attrib
}
if ( ListContains ( cmb_intern.cmb_attribs , ucase(attrib) )) {
return (attrib)
} else {
return ("")
}
]]>
</function>
<function name="cmb_isReachable" parameters="object" type="boolean">
value=false
foreach (x,ScopeReachableNotHeld ()) {
if(x=object) {
value=true
}
}
return (value)
</function>
<function name="cmb_dicesix" type="int">
dice=cmb_dice(GetRandomInt(1,6))
return (dice)
</function>
<function name="cmb_dice" parameters="number" type="int">
dice=GetRandomInt(1,number)
return (dice)
</function>
<function name="dict2string" parameters="dict" type="string">
text=""
foreach (x, dict) {
text=concat (text,concat (x,StringDictionaryItem (dict,x),"="),";")
}
return (text)
</function>
<function name="string2dict" parameters="text, dict">
list=split(text, ";")
if (ListCount(list)>0) {
for(x, 0, ListCount(list)-1) {
if ( Instr(StringListItem ( list , x ),"=")>0) {
list2=split( StringListItem ( list , x ), "=")
dictionary add (dict,StringListItem ( list2 , 0 ), StringListItem ( list2 , 1 ))
}
}
}
</function>
<function name="concat" parameters="text1,text2,separator" type="string">
if ( LengthOf(text1)>0 and LengthOf(text2)>0 ){
return (text1 + separator + text2)
} else if ( LengthOf(text1)>0 ) {
return (text1)
} else {
return (text2)
}
</function>
<function name="DictionaryContainsValue" parameters="dict,value" type="string">
found=""
foreach (x,dict) {
if (StringDictionaryItem(dict,x)=value) {
found=x
}
}
return (found)
</function>
<function name="cmb_startTurnscript" >
create turnscript ("cmb_tscript")
SetTurnScript (cmb_tscript) {
cmb_checkItems
}
EnableTurnScript (cmb_tscript)
</function>
<function name="cmb_checkItems" >
foreach (x,ScopeAllObjectsNotHeld () ) {
pos=instr( GetString ( x , "alias" ) , "(" )
if ( pos >0) {
cmb_unequipIntern( GetString ( x , "name" ))
}
}
</function>
<function name="ScopeAllObjectsNotHeld" type="objectlist">
result = NewObjectList()
foreach (obj, AllObjects()) {
if (not Contains(player, obj) and Contains(player.parent, obj)) {
list add(result, obj)
}
}
return (result)
</function>
</library>
<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>
<pov type="object">player</pov>
<start type="script">
cc
</start>
<turns type="int">0</turns>
<statusattributes type="stringdictionary">turns = </statusattributes>
</game>
<object name="room">
<inherit name="editor_room" />
<object name="player">
<inherit name="defaultplayer" />
<inherit name="pc_char" />
<statusattributes type="stringdictionary">mp = ;hp = ;str = ;end = ;dex = ;agi = ;spd = ;int = ;spi = ;men = ;lvl = ;exp = ;cash = </statusattributes>
</object>
<object name="orc1">
<inherit name="editor_object" />
<inherit name="npc_char" />
<alias>orc</alias>
</object>
<object name="potion100">
<inherit name="editor_object" />
<alias>100 exp potion</alias>
<take />
<alt type="list"></alt>
<displayverbs>Look at; Take; Drink</displayverbs>
<inventoryverbs>Look at; Use; Drop; drink</inventoryverbs>
<drink type="script">
msg ("You drink the exp potion, receiving 100 experience.")
game.pov.exp = game.pov.exp + 100
</drink>
</object>
<object name="potion300">
<inherit name="editor_object" />
<alias>300 exp potion</alias>
<take />
<displayverbs>Look at; Take; Drink</displayverbs>
<inventoryverbs>Look at; Use; Drop; drink</inventoryverbs>
<drink type="script">
msg ("You drink the exp potion, receiving 300 experience.")
game.pov.exp = game.pov.exp + 300
</drink>
</object>
</object>
<turnscript name="game_turns">
<enabled />
<script>
lvlup
hp_mp_cur_max
game_over
game.turns = game.turns + 1
</script>
</turnscript>
<command name="fight">
<pattern>fight #text#</pattern>
<script>
battle_system (game.pov,text)
</script>
</command>
<type name="char">
<cur_hp type="int">100</cur_hp>
<drop type="boolean">false</drop>
<defending type="boolean">false</defending>
<max_hp type="int">100</max_hp>
<str type="int">0</str>
<end type="int">0</end>
<lvl type="int">0</lvl>
<exp type="int">0</exp>
<cash type="int">0</cash>
<dex type="int">0</dex>
<agi type="int">0</agi>
<spd type="int">0</spd>
<int type="int">0</int>
<spi type="int">0</spi>
<men type="int">0</men>
<cur_mp type="int">100</cur_mp>
<max_mp type="int">100</max_mp>
<hp type="int">0</hp>
<mp type="int">0</mp>
<ac type="int">0</ac>
<ar type="int">0</ar>
</type>
<type name="pc_char">
<inherit name="char" />
<statusattributes type="stringdictionary">mp = ;hp = ;str = ;turns = ;end = ;dex = ;agi = ;spd = ;int = ;spi = ;men = ;lvl = ;exp = ;cash = </statusattributes>
</type>
<type name="npc_char">
<inherit name="char" />
<dead type="boolean">false</dead>
<hostile />
<displayverbs type="list">Look; Talk; Steal; Give; Use; Cast; Fight</displayverbs>
</type>
<function name="cc">
msg ("What is your name?")
get input {
game.pov.alias = result
msg (" - " + game.pov.alias)
show menu ("What is your gender?", split ("male;female" , ";"), false) {
game.pov.gender = result
show menu ("What is your race?", split ("human;dwarf;elf" , ";"), false) {
game.pov.race = result
show menu ("What is your class?", split ("warrior;cleric;mage;thief" , ";"), false) {
game.pov.class = result
msg (game.pov.alias + " is a " + game.pov.gender + " " + game.pov.race + " " + game.pov.class + ".")
wait {
ClearScreen
}
}
}
}
}
</function>
<function name="hp_mp_cur_max">
game.pov.hp = game.pov.cur_hp + " / " + game.pov.max_hp
game.pov.mp = game.pov.cur_mp + " / " + game.pov.max_mp
</function>
<function name="game_over">
if (game.pov.cur_hp = 0) {
msg (game.pov.alias + " has died.")
msg ("GAME OVER")
finish
}
</function>
<function name="lvlup"><![CDATA[
if (game.pov.exp >= game.pov.lvl * 100 + 100) {
game.pov.exp = game.pov.exp - (game.pov.lvl * 100 + 100)
game.pov.lvl = game.pov.lvl + 1
lvlup
}
]]></function>
<function name="battle_system" parameters="self,text" type="boolean">
return_value = false
enemy = GetObject (text)
if (enemy = null) {
foreach (obj,AllObjects()) {
if (obj.alias=text) {
enemy = obj
}
}
}
if (enemy = null) {
msg ("There is no " + text + " here.")
return_value = false
}
else if (not npc_reachable (enemy)) {
msg ("There is no " + enemy.alias + " in your vicinity.")
return_value = false
}
else if (GetBoolean (enemy,"dead")) {
msg (enemy.alias + " is already dead.")
return_value = false
}
else if (not Doesinherit (enemy,"npc_char")) {
msg ("You can not battle that!")
return_value = false
}
else if (GetBoolean (enemy,"hostile") = false) {
msg (enemy.alias + " is not hostile.")
return_value = false
}
if (battle_sequence (self,enemy)) {
return_value = true
}
return (return_value)
</function>
<function name="battle_sequence" parameters="self,enemy" type="boolean"><![CDATA[
if (GetInt (self,"spd") > GetInt (enemy,"spd")) {
self_battle_turn (self,enemy)
enemy_battle_turn (self,enemy)
battle_sequence (self,enemy)
}
else if (GetInt (self,"spd") = GetInt (enemy,"spd")) {
if (RandomChance (50) = true) {
self_battle_turn (self,enemy)
enemy_battle_turn (self,enemy)
battle_sequence (self,enemy)
}
else {
enemy_battle_turn (self,enemy)
self_battle_turn (self,enemy)
battle_sequence (self,enemy)
}
}
else if (GetInt (self,"spd") < GetInt (enemy,"spd")) {
enemy_battle_turn (self,enemy)
self_battle_turn (self,enemy)
battle_sequence (self,enemy)
}
else {
}
]]></function>
<function name="npc_reachable" parameters="object" type="boolean">
value = false
foreach (x,ScopeReachableNotHeld ()) {
if (x=object) {
value = true
}
}
return (value)
</function>
<function name="self_battle_turn" parameters="self,enemy" type="boolean"><![CDATA[
self.defending = false
show menu ("What is your battle choice?", split ("Attack;Defend;Cast;Item;Run", ";"), false) {
switch (result) {
case ("Attack") {
if (RandomChance (GetInt (enemy,"agi") - GetInt (self,"spd")) = true) {
msg (enemy.alias + "evaded your attack!")
}
else if msg ("Enemy Parry") {
msg (enemy.alias + "parried your attack!")
}
else if msg ("Enemy Block") {
msg (enemy.alias + "blocked your attack!")
}
else if (RandomChance (GetInt (self,"dex") - GetInt (enemy,"spd")) = false) {
msg ("Your attack missed " + enemy.alias +"!")
}
else if (RandomChance (GetInt (enemy,"ac") = true) {
msg ("Your attack got resisted by " + enemy.alias +"!")
}
else if (self.defending = true and enemy.defending = true) {
enemy.cur_hp = enemy.cur_hp - (crit_hit (self) * 2 * wd / 2 + wd * (GetInt (self,"str) - GetInt (enemy,"end")) / 100)
}
else if (self.defending = true and enemy.defending = false) {
enemy.cur_hp = enemy.cur_hp - (crit_hit (self) * 2 * wd + wd * (GetInt (self,"str") - GetInt (enemy,"end")) / 100)
}
else if (self.defending = false and enemy.defending = true) {
enemy.cur_hp = enemy.cur_hp - (crit_hit (self) * wd / 2 + wd * (GetInt (self,"str") - GetInt (enemy,"end")) / 100)
}
else if (self.defending = false and enemy.defending = false) {
enemy.cur_hp = enemy.cur_hp - (crit_hit (self) * wd + wd * (GetInt (self,"str") - GetInt (enemy,"end")) / 100)
}
}
case ("Defend") {
self.defending = true
}
case ("Cast") {
}
case ("Item") {
}
case ("Run") {
}
}
}
if (GetInt (enemy,"cur_hp") > 0) {
if (RandomChance (GetInt (self,"spd") - GetInt (enemy,"spd")) = true) {
msg ("You get an extra battle turn!")
self_battle_turn
}
else {
msg ("Your battle turn is over.")
}
}
else {
msg (enemy.alias + " is dead.")
}
]]></function>
<function name="enemy_battle_turn" parameters="self,enemy" type="boolean"><![CDATA[
enemy.defending = false
result = GetRandomInt (1,3)
switch (result) {
case (1) {
if (RandomChance (GetInt (self,"agi") - GetInt (enemy,"spd")) = true) {
msg ("You have evaded the attack!")
}
else if msg ("Self's Parry") {
msg ("You have parried the attack!")
}
else if msg ("Self Block") {
msg ("You have blocked the attack!")
}
else if (RandomChance (GetInt (enemy,"dex") - GetInt (self,"spd")) = false) {
msg (enemy.alias +"'s attack missed!")
}
else if (RandomChance (GetInt (self,"ac") = true) {
msg ("You resisted the attack!")
}
else if (enemy.defending = true and self.defending = true) {
self.cur_hp = self.cur_hp - (crit_hit (enemy) * 2 * wd / 2 + wd * (GetInt (enemy,"str") - GetInt (self,"end")) / 100)
}
else if (enemy.defending = true and self.defending = false) {
self.cur_hp = self.cur_hp - (crit_hit (enemy) * 2 * wd + wd * (GetInt (enemy,"str") - GetInt (self,"end")) / 100)
}
else if (enemy.defending = false and self.defending = true) {
self.cur_hp = self.cur_hp - (crit_hit (enemy) * wd / 2 + wd * (GetInt (enemy,"str") - GetInt (self,"end")) / 100)
}
else if (enemy.defending = false and self.defending = false) {
self.cur_hp = self.cur_hp - (crit_hit (enemy) * wd + wd * (GetInt (enemy,"str") - GetInt (self,"end")) / 100)
}
}
case (2) {
enemy.defending = true
}
case (3) {
(Cast)
}
}
if (RandomChance (GetInt (enemy,"spd") - GetInt (self,"spd")) = true) {
enemy_battle_turn
}
]]></function>
<function name="crit_hit" parameters="object" type="int">
if (RandomChance (GetInt (object,"luck")) = true) {
value = 2
}
else {
value = 1
}
return (value)
</function>
<function name="attack_rating_ar_vs_ac">
</function>
</asl>
<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>
<pov type="object">player</pov>
<start type="script">
cc
</start>
<turns type="int">0</turns>
<statusattributes type="stringdictionary">turns = </statusattributes>
</game>
<object name="room">
<inherit name="editor_room" />
<object name="player">
<inherit name="defaultplayer" />
<inherit name="pc_char" />
<statusattributes type="stringdictionary">mp = ;hp = ;str = ;end = ;dex = ;agi = ;spd = ;int = ;spi = ;men = ;lvl = ;exp = ;cash = </statusattributes>
</object>
<object name="orc1">
<inherit name="editor_object" />
<inherit name="npc_char" />
<alias>orc</alias>
</object>
<object name="potion100">
<inherit name="editor_object" />
<alias>100 exp potion</alias>
<take />
<alt type="list"></alt>
<displayverbs>Look at; Take; Drink</displayverbs>
<inventoryverbs>Look at; Use; Drop; drink</inventoryverbs>
<drink type="script">
msg ("You drink the exp potion, receiving 100 experience.")
game.pov.exp = game.pov.exp + 100
</drink>
</object>
<object name="potion300">
<inherit name="editor_object" />
<alias>300 exp potion</alias>
<take />
<displayverbs>Look at; Take; Drink</displayverbs>
<inventoryverbs>Look at; Use; Drop; drink</inventoryverbs>
<drink type="script">
msg ("You drink the exp potion, receiving 300 experience.")
game.pov.exp = game.pov.exp + 300
</drink>
</object>
</object>
<turnscript name="game_turns">
<enabled />
<script>
lvlup
hp_mp_cur_max
game_over
game.turns = game.turns + 1
</script>
</turnscript>
<command name="fight">
<pattern>fight #text#</pattern>
<script>
battle_system (game.pov,text)
</script>
</command>
<type name="char">
<cur_hp type="int">100</cur_hp>
<drop type="boolean">false</drop>
<defending type="boolean">false</defending>
<max_hp type="int">100</max_hp>
<str type="int">0</str>
<end type="int">0</end>
<lvl type="int">0</lvl>
<exp type="int">0</exp>
<cash type="int">0</cash>
<dex type="int">0</dex>
<agi type="int">0</agi>
<spd type="int">0</spd>
<int type="int">0</int>
<spi type="int">0</spi>
<men type="int">0</men>
<cur_mp type="int">100</cur_mp>
<max_mp type="int">100</max_mp>
<hp type="int">0</hp>
<mp type="int">0</mp>
<ac type="int">0</ac>
<ar type="int">0</ar>
</type>
<type name="pc_char">
<inherit name="char" />
<statusattributes type="stringdictionary">mp = ;hp = ;str = ;turns = ;end = ;dex = ;agi = ;spd = ;int = ;spi = ;men = ;lvl = ;exp = ;cash = </statusattributes>
</type>
<type name="npc_char">
<inherit name="char" />
<dead type="boolean">false</dead>
<hostile />
<displayverbs type="list">Look; Talk; Steal; Give; Use; Cast; Fight</displayverbs>
</type>
<function name="cc">
msg ("What is your name?")
get input {
game.pov.alias = result
msg (" - " + game.pov.alias)
show menu ("What is your gender?", split ("male;female" , ";"), false) {
game.pov.gender = result
show menu ("What is your race?", split ("human;dwarf;elf" , ";"), false) {
game.pov.race = result
show menu ("What is your class?", split ("warrior;cleric;mage;thief" , ";"), false) {
game.pov.class = result
msg (game.pov.alias + " is a " + game.pov.gender + " " + game.pov.race + " " + game.pov.class + ".")
wait {
ClearScreen
}
}
}
}
}
</function>
<function name="hp_mp_cur_max">
game.pov.hp = game.pov.cur_hp + " / " + game.pov.max_hp
game.pov.mp = game.pov.cur_mp + " / " + game.pov.max_mp
</function>
<function name="game_over">
if (game.pov.cur_hp = 0) {
msg (game.pov.alias + " has died.")
msg ("GAME OVER")
finish
}
</function>
<function name="lvlup"><![CDATA[
if (game.pov.exp >= game.pov.lvl * 100 + 100) {
game.pov.exp = game.pov.exp - (game.pov.lvl * 100 + 100)
game.pov.lvl = game.pov.lvl + 1
lvlup
}
]]></function>
<function name="battle_system" parameters="self,text" type="boolean">
return_value = false
enemy = GetObject (text)
if (enemy = null) {
foreach (obj,AllObjects()) {
if (obj.alias=text) {
enemy = obj
}
}
}
if (enemy = null) {
msg ("There is no " + text + " here.")
return_value = false
}
else if (not npc_reachable (enemy)) {
msg ("There is no " + enemy.alias + " in your vicinity.")
return_value = false
}
else if (GetBoolean (enemy,"dead")) {
msg (enemy.alias + " is already dead.")
return_value = false
}
else if (not Doesinherit (enemy,"npc_char")) {
msg ("You can not battle that!")
return_value = false
}
else if (GetBoolean (enemy,"hostile") = false) {
msg (enemy.alias + " is not hostile.")
return_value = false
}
if (battle_sequence (self,enemy)) {
return_value = true
}
return (return_value)
</function>
<function name="battle_sequence" parameters="self,enemy" type="boolean"><![CDATA[
if (GetInt (self,"spd") > GetInt (enemy,"spd")) {
self_battle_turn (self,enemy)
enemy_battle_turn (self,enemy)
battle_sequence (self,enemy)
}
else if (GetInt (self,"spd") = GetInt (enemy,"spd")) {
if (RandomChance (50) = true) {
self_battle_turn (self,enemy)
enemy_battle_turn (self,enemy)
battle_sequence (self,enemy)
}
else {
enemy_battle_turn (self,enemy)
self_battle_turn (self,enemy)
battle_sequence (self,enemy)
}
}
else if (GetInt (self,"spd") < GetInt (enemy,"spd")) {
enemy_battle_turn (self,enemy)
self_battle_turn (self,enemy)
battle_sequence (self,enemy)
}
else {
}
]]></function>
<function name="npc_reachable" parameters="object" type="boolean">
value = false
foreach (x,ScopeReachableNotHeld ()) {
if (x=object) {
value = true
}
}
return (value)
</function>
<function name="self_battle_turn" parameters="self,enemy" type="boolean"><![CDATA[
self.defending = false
show menu ("What is your battle choice?", split ("Attack;Defend;Cast;Item;Run", ";"), false) {
switch (result) {
case ("Attack") {
if (RandomChance (GetInt (enemy,"agi") - GetInt (self,"spd")) = true) {
msg (enemy.alias + "evaded your attack!")
}
else if msg ("Enemy Parry") {
msg (enemy.alias + "parried your attack!")
}
else if msg ("Enemy Block") {
msg (enemy.alias + "blocked your attack!")
}
else if (RandomChance (GetInt (self,"dex") - GetInt (enemy,"spd")) = false) {
msg ("Your attack missed " + enemy.alias +"!")
}
else if (RandomChance (GetInt (enemy,"ac") = true) {
msg ("Your attack got resisted by " + enemy.alias +"!")
}
else if (self.defending = true and enemy.defending = true) {
enemy.cur_hp = enemy.cur_hp - (crit_hit (self) * 2 * wd / 2 + wd * (GetInt (self,"str") - GetInt (enemy,"end")) / 100)
}
else if (self.defending = true and enemy.defending = false) {
enemy.cur_hp = enemy.cur_hp - (crit_hit (self) * 2 * wd + wd * (GetInt (self,"str") - GetInt (enemy,"end")) / 100)
}
else if (self.defending = false and enemy.defending = true) {
enemy.cur_hp = enemy.cur_hp - (crit_hit (self) * wd / 2 + wd * (GetInt (self,"str") - GetInt (enemy,"end")) / 100)
}
else if (self.defending = false and enemy.defending = false) {
enemy.cur_hp = enemy.cur_hp - (crit_hit (self) * wd + wd * (GetInt (self,"str") - GetInt (enemy,"end")) / 100)
}
}
case ("Defend") {
self.defending = true
}
case ("Cast") {
}
case ("Item") {
}
case ("Run") {
}
}
}
if (GetInt (enemy,"cur_hp") > 0) {
if (RandomChance (GetInt (self,"spd") - GetInt (enemy,"spd")) = true) {
msg ("You get an extra battle turn!")
self_battle_turn
}
else {
msg ("Your battle turn is over.")
}
}
else {
msg (enemy.alias + " is dead.")
}
]]></function>
<function name="enemy_battle_turn" parameters="self,enemy" type="boolean"><![CDATA[
enemy.defending = false
result = GetRandomInt (1,3)
switch (result) {
case (1) {
if (RandomChance (GetInt (self,"agi") - GetInt (enemy,"spd")) = true) {
msg ("You have evaded the attack!")
}
else if msg ("Self's Parry") {
msg ("You have parried the attack!")
}
else if msg ("Self Block") {
msg ("You have blocked the attack!")
}
else if (RandomChance (GetInt (enemy,"dex") - GetInt (self,"spd")) = false) {
msg (enemy.alias +"'s attack missed!")
}
else if (RandomChance (GetInt (self,"ac") = true) {
msg ("You resisted the attack!")
}
else if (enemy.defending = true and self.defending = true) {
self.cur_hp = self.cur_hp - (crit_hit (enemy) * 2 * wd / 2 + wd * (GetInt (enemy,"str") - GetInt (self,"end")) / 100)
}
else if (enemy.defending = true and self.defending = false) {
self.cur_hp = self.cur_hp - (crit_hit (enemy) * 2 * wd + wd * (GetInt (enemy,"str") - GetInt (self,"end")) / 100)
}
else if (enemy.defending = false and self.defending = true) {
self.cur_hp = self.cur_hp - (crit_hit (enemy) * wd / 2 + wd * (GetInt (enemy,"str") - GetInt (self,"end")) / 100)
}
else if (enemy.defending = false and self.defending = false) {
self.cur_hp = self.cur_hp - (crit_hit (enemy) * wd + wd * (GetInt (enemy,"str") - GetInt (self,"end")) / 100)
}
}
case (2) {
enemy.defending = true
}
case (3) {
(Cast)
}
}
if (RandomChance (GetInt (enemy,"spd") - GetInt (self,"spd")) = true) {
enemy_battle_turn
}
]]></function>
<function name="crit_hit" parameters="object" type="int">
if (RandomChance (GetInt (object,"luck")) = true) {
value = 2
}
else {
value = 1
}
return (value)
</function>
<function name="attack_rating_ar_vs_ac">
</function>
</asl>
else if msg ("Enemy Parry") {
doesn't make sense if (GetInt (enemy,"cur_hp") > 0) {
if (RandomChance (GetInt (self,"spd") - GetInt (enemy,"spd")) = true) {
...
must be in the show menu block <function name="self_battle_turn" parameters="self,enemy" type="boolean"><![CDATA[
self.defending = false
show menu ("What is your battle choice?", split ("Attack;Defend;Cast;Item;Run", ";"), false) {
switch (result) {
case ("Attack") {
if (RandomChance (GetInt (enemy,"agi") - GetInt (self,"spd")) = true) {
msg (enemy.alias + "evaded your attack!")
}
else if msg ("Enemy Parry") {
msg (enemy.alias + "parried your attack!")
}
else if msg ("Enemy Block") {
msg (enemy.alias + "blocked your attack!")
}
else if (RandomChance (GetInt (self,"dex") - GetInt (enemy,"spd")) = false) {
msg ("Your attack missed " + enemy.alias +"!")
}
else if (RandomChance (GetInt (enemy,"ac") = true) {
msg ("Your attack got resisted by " + enemy.alias +"!")
}
else if (self.defending = true and enemy.defending = true) {
enemy.cur_hp = enemy.cur_hp - (crit_hit (self) * 2 * wd / 2 + wd * (GetInt (self,"str") - GetInt (enemy,"end")) /
100)
}
else if (self.defending = true and enemy.defending = false) {
enemy.cur_hp = enemy.cur_hp - (crit_hit (self) * 2 * wd + wd * (GetInt (self,"str") - GetInt (enemy,"end")) /
100)
}
else if (self.defending = false and enemy.defending = true) {
enemy.cur_hp = enemy.cur_hp - (crit_hit (self) * wd / 2 + wd * (GetInt (self,"str") - GetInt (enemy,"end")) /
100)
}
else if (self.defending = false and enemy.defending = false) {
enemy.cur_hp = enemy.cur_hp - (crit_hit (self) * wd + wd * (GetInt (self,"str") - GetInt (enemy,"end")) / 100)
}
}
case ("Defend") {
self.defending = true
}
case ("Cast") {
}
case ("Item") {
}
case ("Run") {
}
}
if (GetInt (enemy,"cur_hp") > 0) {
if (RandomChance (GetInt (self,"spd") - GetInt (enemy,"spd")) = true) {
msg ("You get an extra battle turn!")
self_battle_turn
}
else {
msg ("Your battle turn is over.")
}
}
else {
msg (enemy.alias + " is dead.")
}
}
]]></function>
<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>
<pov type="object">player</pov>
<start type="script">
cc
</start>
<turns type="int">0</turns>
<statusattributes type="stringdictionary">turns = </statusattributes>
</game>
<object name="room">
<inherit name="editor_room" />
<object name="player">
<inherit name="defaultplayer" />
<inherit name="pc_char" />
<statusattributes type="stringdictionary">mp = ;hp = ;str = ;end = ;dex = ;agi = ;spd = ;int = ;spi = ;men = ;lvl = ;exp = ;cash = ;ar = ;ac = </statusattributes>
</object>
<object name="orc1">
<inherit name="editor_object" />
<inherit name="npc_char" />
<alias>orc</alias>
</object>
<object name="potion100">
<inherit name="editor_object" />
<alias>100 exp potion</alias>
<take />
<alt type="list"></alt>
<displayverbs>Look at; Take; Drink</displayverbs>
<inventoryverbs>Look at; Use; Drop; drink</inventoryverbs>
<drink type="script">
msg ("You drink the exp potion, receiving 100 experience.")
game.pov.exp = game.pov.exp + 100
</drink>
</object>
<object name="potion300">
<inherit name="editor_object" />
<alias>300 exp potion</alias>
<take />
<displayverbs>Look at; Take; Drink</displayverbs>
<inventoryverbs>Look at; Use; Drop; drink</inventoryverbs>
<drink type="script">
msg ("You drink the exp potion, receiving 300 experience.")
game.pov.exp = game.pov.exp + 300
</drink>
</object>
</object>
<turnscript name="game_turns">
<enabled />
<script>
lvlup
hp_mp_cur_max
game_over
game.turns = game.turns + 1
</script>
</turnscript>
<command name="fight">
<pattern>fight #text#</pattern>
<script>
battle_system (game.pov,text)
</script>
</command>
<type name="char">
<cur_hp type="int">100</cur_hp>
<drop type="boolean">false</drop>
<defending type="boolean">false</defending>
<max_hp type="int">100</max_hp>
<str type="int">0</str>
<end type="int">0</end>
<lvl type="int">0</lvl>
<exp type="int">0</exp>
<cash type="int">0</cash>
<dex type="int">0</dex>
<agi type="int">0</agi>
<spd type="int">0</spd>
<int type="int">0</int>
<spi type="int">0</spi>
<men type="int">0</men>
<cur_mp type="int">100</cur_mp>
<max_mp type="int">100</max_mp>
<hp type="int">0</hp>
<mp type="int">0</mp>
<ac type="int">0</ac>
<ar type="int">0</ar>
</type>
<type name="pc_char">
<inherit name="char" />
<statusattributes type="stringdictionary">mp = ;hp = ;str = ;turns = ;end = ;dex = ;agi = ;spd = ;int = ;spi = ;men = ;lvl = ;exp = ;cash = </statusattributes>
</type>
<type name="npc_char">
<inherit name="char" />
<dead type="boolean">false</dead>
<hostile />
<displayverbs type="list">Look; Talk; Steal; Give; Use; Cast; Fight</displayverbs>
</type>
<type name="gear">
<weight type="int">0</weight>
<take type="boolean">true</take>
<give type="boolean">true</give>
<equipped type="boolean">false</equipped>
<equipable type="boolean">true</equipable>
<unequipable type="boolean">true</unequipable>
<equipable_layer type="int">3</equipable_layer>
<equipable_slots type="list"></equipable_slots>
<inventoryverbs type="listextend">Equip;Unequip</inventoryverbs>
</type>
<type name="weapon_gear">
<inherit name="gear" />
<wd type="int">0</wd>
<ar type="int">0</ar>
</type>
<type name="armor_gear">
<inherit name="gear" />
<ac type="int">0</ac>
</type>
<type name="spell">
<drop type="boolean">false</drop>
<inventoryverbs type="list">Learn</inventoryverbs>
<displayverbs type="list">Learn</displayverbs>
</type>
<type name="fire">
</type>
<type name="water">
</type>
<type name="air">
</type>
<type name="earth">
</type>
<type name="light">
</type>
<type name="dark">
</type>
<function name="cc">
msg ("What is your name?")
get input {
game.pov.alias = result
msg (" - " + game.pov.alias)
show menu ("What is your gender?", split ("male;female" , ";"), false) {
game.pov.gender = result
show menu ("What is your race?", split ("human;dwarf;elf" , ";"), false) {
game.pov.race = result
show menu ("What is your class?", split ("warrior;cleric;mage;thief" , ";"), false) {
game.pov.class = result
msg (game.pov.alias + " is a " + game.pov.gender + " " + game.pov.race + " " + game.pov.class + ".")
wait {
ClearScreen
}
}
}
}
}
</function>
<function name="hp_mp_cur_max">
game.pov.hp = game.pov.cur_hp + " / " + game.pov.max_hp
game.pov.mp = game.pov.cur_mp + " / " + game.pov.max_mp
</function>
<function name="game_over">
if (game.pov.cur_hp = 0) {
msg (game.pov.alias + " has died.")
msg ("GAME OVER")
finish
}
</function>
<function name="lvlup"><![CDATA[
if (game.pov.exp >= game.pov.lvl * 100 + 100) {
game.pov.exp = game.pov.exp - (game.pov.lvl * 100 + 100)
game.pov.lvl = game.pov.lvl + 1
lvlup
}
]]></function>
<function name="battle_system" parameters="self,text" type="boolean">
return_value = false
enemy = GetObject (text)
if (enemy = null) {
foreach (obj,AllObjects()) {
if (obj.alias=text) {
enemy = obj
}
}
}
if (enemy = null) {
msg ("There is no " + text + " here.")
return_value = false
}
else if (not npc_reachable (enemy)) {
msg ("There is no " + enemy.alias + " in your vicinity.")
return_value = false
}
else if (GetBoolean (enemy,"dead")) {
msg (enemy.alias + " is already dead.")
return_value = false
}
else if (not Doesinherit (enemy,"npc_char")) {
msg ("You can not battle that!")
return_value = false
}
else if (GetBoolean (enemy,"hostile") = false) {
msg (enemy.alias + " is not hostile.")
return_value = false
}
if (battle_sequence (self,enemy)) {
return_value = true
}
return (return_value)
</function>
<function name="battle_sequence" parameters="self,enemy" type="boolean"><![CDATA[
if (GetInt (self,"spd") > GetInt (enemy,"spd")) {
self_battle_turn (self,enemy)
enemy_battle_turn (self,enemy)
battle_sequence (self,enemy)
}
else if (GetInt (self,"spd") = GetInt (enemy,"spd")) {
if (RandomChance (50) = true) {
self_battle_turn (self,enemy)
enemy_battle_turn (self,enemy)
battle_sequence (self,enemy)
}
else {
enemy_battle_turn (self,enemy)
self_battle_turn (self,enemy)
battle_sequence (self,enemy)
}
}
else if (GetInt (self,"spd") < GetInt (enemy,"spd")) {
enemy_battle_turn (self,enemy)
self_battle_turn (self,enemy)
battle_sequence (self,enemy)
}
else {
}
]]></function>
<function name="npc_reachable" parameters="object" type="boolean">
value = false
foreach (x,ScopeReachableNotHeld ()) {
if (x=object) {
value = true
}
}
return (value)
</function>
<function name="self_battle_turn" parameters="self,enemy" type="boolean"><![CDATA[
self.defending = false
show menu ("What is your battle choice?", split ("Attack;Defend;Cast;Item;Run", ";"), false) {
switch (result) {
case ("Attack") {
if (RandomChance (GetInt (enemy,"agi") - GetInt (self,"spd")) = true) {
msg (enemy.alias + "evaded your attack!")
}
else if (RandomChance (GetInt (enemy,"Dex") - GetInt (self,"agi")) = true) {
msg (enemy.alias + "parried your attack!")
}
else if (RandomChance (Get Int (enemy,"agi") - GetInt (self,"dex")) = true) {
msg (enemy.alias + "blocked your attack!")
}
else if (RandomChance (GetInt (self,"dex") - GetInt (enemy,"spd")) = false) {
msg ("Your attack missed " + enemy.alias +"!")
}
else if (RandomChance (GetInt (enemy,"ac") - GetInt (self,"ar")) = true) {
msg ("Your attack got resisted by " + enemy.alias +"!")
}
else if (self.defending = true and enemy.defending = true) {
enemy.cur_hp = enemy.cur_hp - (crit_hit (self) * 2 * wd / 2 + wd * (GetInt (self,"str") - GetInt (enemy,"end")) / 100)
}
else if (self.defending = true and enemy.defending = false) {
enemy.cur_hp = enemy.cur_hp - (crit_hit (self) * 2 * wd + wd * (GetInt (self,"str") - GetInt (enemy,"end")) / 100)
}
else if (self.defending = false and enemy.defending = true) {
enemy.cur_hp = enemy.cur_hp - (crit_hit (self) * wd / 2 + wd * (GetInt (self,"str") - GetInt (enemy,"end")) / 100)
}
else if (self.defending = false and enemy.defending = false) {
enemy.cur_hp = enemy.cur_hp - (crit_hit (self) * wd + wd * (GetInt (self,"str") - GetInt (enemy,"end")) / 100)
}
}
case ("Defend") {
self.defending = true
}
case ("Cast") {
}
case ("Item") {
}
case ("Run") {
}
}
if (GetInt (enemy,"cur_hp") > 0) {
if (RandomChance (GetInt (self,"spd") - GetInt (enemy,"spd")) = true) {
msg ("You get an extra battle turn!")
self_battle_turn
}
else {
msg ("Your battle turn is over.")
}
}
else {
msg (enemy.alias + " is dead.")
}
}
]]></function>
<function name="enemy_battle_turn" parameters="self,enemy" type="boolean"><![CDATA[
enemy.defending = false
result = GetRandomInt (1,3)
switch (result) {
case (1) {
if (RandomChance (GetInt (self,"agi") - GetInt (enemy,"spd")) = true) {
msg ("You have evaded the attack!")
}
else if (RandomChance (GetInt (self,"dex") - GetInt (enemy,"agi")) = true) {
msg ("You have parried the attack!")
}
else if (RandomChance (GetInt (self,"agi") - GetInt (enemy,"dex")) = true) {
msg ("You have blocked the attack!")
}
else if (RandomChance (GetInt (enemy,"dex") - GetInt (self,"spd")) = false) {
msg (enemy.alias +"'s attack missed!")
}
else if (RandomChance (GetInt (self,"ac") - GetInt (enemy,"ar")) = true) {
msg ("You resisted the attack!")
}
else if (enemy.defending = true and self.defending = true) {
self.cur_hp = self.cur_hp - (crit_hit (enemy) * 2 * wd / 2 + wd * (GetInt (enemy,"str") - GetInt (self,"end")) / 100)
}
else if (enemy.defending = true and self.defending = false) {
self.cur_hp = self.cur_hp - (crit_hit (enemy) * 2 * wd + wd * (GetInt (enemy,"str") - GetInt (self,"end")) / 100)
}
else if (enemy.defending = false and self.defending = true) {
self.cur_hp = self.cur_hp - (crit_hit (enemy) * wd / 2 + wd * (GetInt (enemy,"str") - GetInt (self,"end")) / 100)
}
else if (enemy.defending = false and self.defending = false) {
self.cur_hp = self.cur_hp - (crit_hit (enemy) * wd + wd * (GetInt (enemy,"str") - GetInt (self,"end")) / 100)
}
}
case (2) {
enemy.defending = true
}
case (3) {
(Cast)
}
}
if (RandomChance (GetInt (enemy,"spd") - GetInt (self,"spd")) = true) {
enemy_battle_turn
}
]]></function>
<function name="crit_hit" parameters="object" type="int">
if (RandomChance (GetInt (object,"luck")) = true) {
value = 2
}
else {
value = 1
}
return (value)
</function>
</asl>
<function name="battle_sequence" parameters="self,enemy" type="boolean"><![CDATA[
if (GetInt (self,"spd") > GetInt (enemy,"spd")) {
self_battle_turn (self,enemy)
enemy_battle_turn (self,enemy)
on ready {
battle_sequence (self,enemy)
}
}
else if (GetInt (self,"spd") = GetInt (enemy,"spd")) {
if (RandomChance (50) = true) {
self_battle_turn (self,enemy)
enemy_battle_turn (self,enemy)
on ready {
battle_sequence (self,enemy)
}
}
else {
enemy_battle_turn (self,enemy)
self_battle_turn (self,enemy)
on ready {
battle_sequence (self,enemy)
}
}
}
else if (GetInt (self,"spd") < GetInt (enemy,"spd")) {
enemy_battle_turn (self,enemy)
self_battle_turn (self,enemy
on ready {
battle_sequence (self,enemy)
}
}
else {
}
return (true)
]]></function>
case (3) {
// (Cast)
<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>
<pov type="object">player</pov>
<start type="script">
cc
</start>
<turns type="int">0</turns>
<btrns type="int">0</btrns>
<brnds type="int">0</brnds>
<statusattributes type="stringdictionary">turns = </statusattributes>
</game>
<object name="room">
<inherit name="editor_room" />
<object name="player">
<inherit name="defaultplayer" />
<inherit name="pc" />
<cur_hp type="int">100</cur_hp>
<max_hp type="int">100</max_hp>
<cur_mp type="int">100</cur_mp>
<max_mp type="int">100</max_mp>
<str type="int">100</str>
<end type="int">100</end>
<dex type="int">100</dex>
<agi type="int">100</agi>
<spd type="int">100</spd>
<hc type="int">100</hc>
<pd type="int">100</pd>
<pr type="int">100</pr>
</object>
<object name="orc1">
<inherit name="editor_object" />
<inherit name="npc" />
<hostile type="boolean">true</hostile>
<alias>orc</alias>
<cur_hp type="int">999</cur_hp>
<max_hp type="int">999</max_hp>
<str type="int">25</str>
<end type="int">25</end>
<dex type="int">25</dex>
<agi type="int">25</agi>
<spd type="int">25</spd>
<hc type="int">25</hc>
<pd type="int">25</pd>
<pr type="int">25</pr>
<exp type="int">100</exp>
</object>
<object name="potion100">
<inherit name="editor_object" />
<alias>100 exp potion</alias>
<take />
<alt type="list"></alt>
<displayverbs>Look at; Take; Drink</displayverbs>
<inventoryverbs>Look at; Use; Drop; Drink</inventoryverbs>
<drink type="script">
msg ("You drink the exp potion, receiving 100 experience.")
game.pov.exp = game.pov.exp + 100
</drink>
</object>
<object name="potion300">
<inherit name="editor_object" />
<alias>300 exp potion</alias>
<take />
<displayverbs>Look at; Take; Drink</displayverbs>
<inventoryverbs>Look at; Use; Drop; Drink</inventoryverbs>
<drink type="script">
msg ("You drink the exp potion, receiving 300 experience.")
game.pov.exp = game.pov.exp + 300
</drink>
</object>
</object>
<turnscript name="game_turns">
<enabled />
<script>
lvlup
sa
game_over
game.turns = game.turns + 1
</script>
</turnscript>
<command name="fight">
<pattern>fight #text#</pattern>
<script>
battle_system (game.pov,text)
</script>
</command>
<type name="char">
<cur_hp type="int">0</cur_hp>
<drop type="boolean">false</drop>
<defending type="boolean">false</defending>
<max_hp type="int">0</max_hp>
<str type="int">0</str>
<end type="int">0</end>
<lvl type="int">0</lvl>
<exp type="int">0</exp>
<cash type="int">0</cash>
<dex type="int">0</dex>
<agi type="int">0</agi>
<spd type="int">0</spd>
<int type="int">0</int>
<spi type="int">0</spi>
<men type="int">0</men>
<cur_mp type="int">0</cur_mp>
<max_mp type="int">0</max_mp>
<hp type="int">0</hp>
<mp type="int">0</mp>
<hc type="int">0</hc>
<pd type="int">0</pd>
<fd type="int">0</fd>
<wd type="int">0</wd>
<ad type="int">0</ad>
<ed type="int">0</ed>
<ld type="int">0</ld>
<dd type="int">0</dd>
<pr type="int">0</pr>
<fr type="int">0</fr>
<wr type="int">0</wr>
<ar type="int">0</ar>
<er type="int">0</er>
<lr type="int">0</lr>
<dr type="int">0</dr>
<wt type="int">0</wt>
<ht type="int">0</ht>
<cur_arrow type="int">0</cur_arrow>
<cur_bolt type="int">0</cur_bolt>
<cur_bullet type="int">0</cur_bullet>
<max_arrow type="int">0</max_arrow>
<max_bolt type="int">0</max_bolt>
<max_bullet type="int">0</max_bullet>
<arrows type="int">0</arrows>
<bolts type="int">0</bolts>
<bullets type="int">0</bullets>
<cur_shuriken type="int">0</cur_shuriken>
<cur_throwing_axe type="int">0</cur_throwing_axe>
<cur_javelin type="int">0</cur_javelin>
<max_shuriken type="int">0</max_shuriken>
<max_throwing_axe type="int">0</max_throwing_axe>
<max_javelin type="int">0</max_javelin>
<shurikens type="int">0</shurikens>
<throwing_axes type="int">0</throwing_axes>
<javelins type="int">0</javelins>
<cur_throwing_knife type="int">0</cur_throwing_knife>
<max_throwing_knife type="int">0</max_throwing_knife>
<throwing_knives type="int">0</throwing_knives>
</type>
<type name="pc">
<inherit name="char" />
<escaped type="boolean">false</escaped>
<statusattributes type="stringdictionary">mp = ;hp = ;str = ;end = ;dex = ;agi = ;spd = ;int = ;spi = ;men = ;lvl = ;exp = ;cash = ;hc = ;pd = ;fd = ;wd = ;ad = ;ed = ;ld = ;dd = ;pr = ;fr = ;wr = ;ar = ;er = ;lr = ;dr = ;wt = ;ht = ;arrows = ;bolts = ;bullets = ;shurikens = ;throwing_axes = ;javelins = ;throwing_knives = </statusattributes>
</type>
<type name="npc">
<inherit name="char" />
<dead type="boolean">false</dead>
<hostile type="boolean">false</hostile>
<displayverbs type="list">Look; Talk; Steal; Give; Use; Cast; Fight</displayverbs>
<hostility type="script">
if (this.hostile = true) {
this.alias = this.displayalias + "(hostile)"
this.displayverbs = split ("Look;Use;Cast;Fight", ";")
}
</hostility>
<death type="script">
if (this.dead = true) {
this.alias = this.displayalias + "(dead)"
game.pov.exp = game.pov.exp + this.exp
this.displayverbs = split ("Look;Steal;Give;Use;Cast", ";")
}
</death>
</type>
<type name="storage">
<inherit name="container_closed" />
<drop type="boolean">false</drop>
<inventoryverbs type="list">Look; Open; Close</inventoryverbs>
</type>
<type name="gear">
<wt type="int">0</wt>
<take type="boolean">true</take>
<give type="boolean">true</give>
<equipped type="boolean">false</equipped>
<equipable type="boolean">true</equipable>
<unequipable type="boolean">true</unequipable>
<equipable_layer type="int">3</equipable_layer>
<equipable_slots type="list"></equipable_slots>
<inventoryverbs type="listextend">Equip;Unequip</inventoryverbs>
</type>
<type name="weapon">
<inherit name="gear" />
<pd type="int">0</pd>
<hc type="int">0</hc>
</type>
<type name="one_handed">
<inherit name="weapon" />
<equipable_slots type="list">right_hand</equipable_slots>
</type>
<type name="two_handed">
<inherit name="weapon" />
<equipable_slots type="list">left_hand;right_hand</equipable_slots>
</type>
<type name="sword">
</type>
<type name="axe">
</type>
<type name="blunt">
</type>
<type name="spear">
<inherit name="two_handed" />
</type>
<type name="staff">
<inherit name="two_handed" />
</type>
<type name="dagger">
<inherit name="one_handed" />
</type>
<type name="whip">
<inherit name="one_handed" />
</type>
<type name="bow">
<inherit name="two_handed" />
</type>
<type name="crossbow">
<inherit name="two_handed" />
</type>
<type name="gun">
</type>
<type name="throwing">
</type>
<type name="armor">
<inherit name="gear" />
<pr type="int">0</pr>
</type>
<type name="shield">
<inherit name="armor" />
<equipable_slots type="list">left_hand</equipable_slots>
</type>
<type name="clothing">
<inherit name="gear" />
</type>
<type name="headwear">
<equipable_slots type="list">head</equipable_slots>
</type>
<type name="facewear">
<inherit name="clothing" />
<equipable_slots type="list">face</equipable_slots>
</type>
<type name="earwear">
<inherit name="clothing" />
<equipable_slots type="list">ear</equipable_slots>
</type>
<type name="neckwear">
<inherit name="clothing" />
<equipable_slots type="list">neck</equipable_slots>
</type>
<type name="shoulderwear">
<inherit name="armor" />
<equipable_slots type="list">shoulder</equipable_slots>
</type>
<type name="armwear">
<equipable_slots type="list">arm</equipable_slots>
</type>
<type name="handwear">
<equipable_slots type="list">hand</equipable_slots>
</type>
<type name="fingerwear">
<inherit name="clothing" />
<equipable_slots type="list">finger</equipable_slots>
</type>
<type name="chestwear">
<equipable_slots type="list">chest</equipable_slots>
</type>
<type name="backwear">
<inherit name="clothing" />
<equipable_slots type="list">back</equipable_slots>
</type>
<type name="waistwear">
<equipable_slots type="list">waist</equipable_slots>
</type>
<type name="legwear">
<equipable_slots type="list">leg</equipable_slots>
</type>
<type name="footwear">
<equipable_slots type="list">foot</equipable_slots>
</type>
<type name="arrow">
<cur_arrow type="int">0</cur_arrow>
</type>
<type name="arrow_case">
<inherit name="backwear" />
<max_arrow type="int">0</max_arrow>
</type>
<type name="bolt">
<cur_bolt type="int">0</cur_bolt>
</type>
<type name="bolt_case">
<inherit name="backwear" />
<max_bolt type="int">0</max_bolt>
</type>
<type name="bullet">
<cur_bullet type="int">0</cur_bullet>
</type>
<type name="bullet_case">
<inherit name="backwear" />
<max_bullet type="int">0</max_bullet>
</type>
<type name="spell">
<drop type="boolean">false</drop>
<inventoryverbs type="list">Learn</inventoryverbs>
<displayverbs type="list">Learn</displayverbs>
</type>
<type name="fire">
</type>
<type name="water">
</type>
<type name="air">
</type>
<type name="earth">
</type>
<type name="light">
</type>
<type name="dark">
</type>
<function name="cc">
msg ("What is your name?")
get input {
game.pov.alias = result
msg (" - " + game.pov.alias)
show menu ("What is your gender?", split ("male;female" , ";"), false) {
game.pov.gender = result
show menu ("What is your race?", split ("human;dwarf;elf" , ";"), false) {
game.pov.race = result
show menu ("What is your class?", split ("warrior;cleric;mage;thief" , ";"), false) {
game.pov.class = result
msg (game.pov.alias + " is a " + game.pov.gender + " " + game.pov.race + " " + game.pov.class + ".")
wait {
ClearScreen
}
}
}
}
}
</function>
<function name="sa">
game.pov.hp = game.pov.cur_hp + " / " + game.pov.max_hp
game.pov.mp = game.pov.cur_mp + " / " + game.pov.max_mp
game.pov.arrows = game.pov.cur_arrow + " / " + game.pov.max_arrow
game.pov.bolts = game.pov.cur_bolt + " / " + game.pov.max_bolt
game.pov.bullets = game.pov.cur_bullet + " / " + game.pov.max_bullet
game.pov.shurikens = game.pov.cur_shuriken + " / " + game.pov.max_shuriken
game.pov.javelins = game.pov.cur_javelin + " / " + game.pov.max_javelin
game.pov.throwing_axes = game.pov.cur_throwing_axe + " / " + game.pov.max_throwing_axe
game.pov.throwing_knives = game.pov.cur_throwing_knife + " / " + game.pov.max_throwing_knife
</function>
<function name="game_over">
if (game.pov.cur_hp = 0) {
msg (game.pov.alias + " has died.")
msg ("GAME OVER")
finish
}
</function>
<function name="lvlup"><![CDATA[
if (game.pov.exp >= game.pov.lvl * 100 + 100) {
game.pov.exp = game.pov.exp - (game.pov.lvl * 100 + 100)
game.pov.lvl = game.pov.lvl + 1
lvlup
}
]]></function>
<function name="battle_system" parameters="self,text" type="boolean">
return_value = false
enemy = GetObject (text)
if (enemy = null) {
foreach (obj,AllObjects()) {
if (obj.alias=text) {
enemy = obj
}
}
}
if (enemy = null) {
msg ("There is no " + text + " here.")
return_value = false
}
else if (not npc_reachable (enemy)) {
msg ("There is no " + enemy.alias + " in your vicinity.")
return_value = false
}
else if (GetBoolean (enemy,"dead") = true) {
msg (enemy.alias + " is already dead.")
return_value = false
}
else if (not Doesinherit (enemy,"npc")) {
msg ("You can not battle that!")
return_value = false
}
else if (GetBoolean (enemy,"hostile") = false) {
msg (enemy.alias + " is not hostile.")
return_value = false
}
else if (battle_sequence (self,enemy) = true) {
self.escaped = false
enemy.hostile = false
self.defending = false
enemy.defending = false
return_value = true
}
return (return_value)
</function>
<function name="battle_sequence" parameters="self,enemy" type="boolean"><![CDATA[
if (enemy.dead = true) {
return (true)
}
if (self.escaped = true) {
return (true)
}
if (GetInt (self,"spd") > GetInt (enemy,"spd")) {
self_battle_turn (self,enemy)
on ready {
enemy_battle_turn (self,enemy)
}
on ready {
battle_sequence (self,enemy)
}
}
else if (GetInt (self,"spd") = GetInt (enemy,"spd")) {
if (RandomChance (50) = true) {
self_battle_turn (self,enemy)
on ready {
enemy_battle_turn (self,enemy)
}
on ready {
battle_sequence (self,enemy)
}
}
else {
enemy_battle_turn (self,enemy)
self_battle_turn (self,enemy)
on ready {
battle_sequence (self,enemy)
}
}
}
else if (GetInt (self,"spd") < GetInt (enemy,"spd")) {
enemy_battle_turn (self,enemy)
self_battle_turn (self,enemy)
on ready {
battle_sequence (self,enemy)
}
}
]]></function>
<function name="npc_reachable" parameters="object" type="boolean">
value = false
foreach (x,ScopeReachableNotHeld ()) {
if (x=object) {
value = true
}
}
return (value)
</function>
<function name="self_battle_turn" parameters="self,enemy" type="boolean"><![CDATA[
self.defending = false
if (enemy.dead = true) {
return (true)
}
wait {
show menu ("What is your battle choice?", split ("Attack;Defend;Cast;Item;Run", ";"), false) {
switch (result) {
case ("Attack") {
if (RandomChance (GetInt (enemy,"agi") - GetInt (self,"spd")) = true) {
msg (enemy.alias + "evaded your attack!")
}
else if (RandomChance (GetInt (enemy,"Dex") - GetInt (self,"agi")) = true) {
msg (enemy.alias + "parried your attack!")
}
else if (RandomChance (GetInt (enemy,"agi") - GetInt (self,"dex")) = true) {
msg (enemy.alias + "blocked your attack!")
}
else if (RandomChance (GetInt (self,"dex") - GetInt (enemy,"spd")) = false) {
msg ("Your attack missed " + enemy.alias +"!")
}
else if (RandomChance (GetInt (enemy,"pr") - GetInt (self,"hc")) = true) {
msg ("Your attack got resisted by " + enemy.alias +"!")
}
else if (self.defending = true and enemy.defending = true) {
enemy.cur_hp = enemy.cur_hp - (crit_hit (self) * 2 * GetInt (self,"pd") / 2 + GetInt (self,"pd") * (GetInt (self,"str") - GetInt (enemy,"end")) / 100)
}
else if (self.defending = true and enemy.defending = false) {
enemy.cur_hp = enemy.cur_hp - (crit_hit (self) * 2 * GetInt (self,"pd") + GetInt (self,"pd") * (GetInt (self,"str") - GetInt (enemy,"end")) / 100)
}
else if (self.defending = false and enemy.defending = true) {
enemy.cur_hp = enemy.cur_hp - (crit_hit (self) * GetInt (self,"pd") / 2 + GetInt (self,"pd") * (GetInt (self,"str") - GetInt (enemy,"end")) / 100)
}
else if (self.defending = false and enemy.defending = false) {
enemy.cur_hp = enemy.cur_hp - (crit_hit (self) * GetInt (self,"pd") + GetInt (self,"pd") * (GetInt (self,"str") - GetInt (enemy,"end")) / 100)
}
}
case ("Defend") {
self.defending = true
}
case ("Cast") {
}
case ("Item") {
}
case ("Run") {
}
}
if (GetInt (enemy,"cur_hp") > 0) {
if (RandomChance (GetInt (self,"spd") - GetInt (enemy,"spd")) = true) {
msg ("You get an extra battle turn!")
self_battle_turn
}
else {
msg ("Your battle turn is over.")
return (true)
}
}
else if (GetInt (enemy,"cur_hp") <= 0) {
enemy.dead = true
msg (enemy.alias + " is dead.")
return (true)
}
}
}
return (false)
]]></function>
<function name="enemy_battle_turn" parameters="self,enemy" type="boolean"><![CDATA[
enemy.defending = false
if (enemy.dead = true) {
return (true)
}
result = GetRandomInt (1,3)
switch (result) {
case (1) {
if (RandomChance (GetInt (self,"agi") - GetInt (enemy,"spd")) = true) {
msg ("You have evaded the attack!")
}
else if (RandomChance (GetInt (self,"dex") - GetInt (enemy,"agi")) = true) {
msg ("You have parried the attack!")
}
else if (RandomChance (GetInt (self,"agi") - GetInt (enemy,"dex")) = true) {
msg ("You have blocked the attack!")
}
else if (RandomChance (GetInt (enemy,"dex") - GetInt (self,"spd")) = false) {
msg (enemy.alias +"'s attack missed!")
}
else if (RandomChance (GetInt (self,"pr") - GetInt (enemy,"hc")) = true) {
msg ("You resisted the attack!")
}
else if (enemy.defending = true and self.defending = true) {
self.cur_hp = self.cur_hp - (crit_hit (enemy) * 2 * GetInt (enemy,"pd") / 2 + GetInt (enemy,"pd") * (GetInt (enemy,"str") - GetInt (self,"end")) / 100)
}
else if (enemy.defending = true and self.defending = false) {
self.cur_hp = self.cur_hp - (crit_hit (enemy) * 2 * GetInt (enemy,"pd") + GetInt (enemy,"pd") * (GetInt (enemy,"str") - GetInt (self,"end")) / 100)
}
else if (enemy.defending = false and self.defending = true) {
self.cur_hp = self.cur_hp - (crit_hit (enemy) * GetInt (enemy,"pd") / 2 + GetInt (enemy,"pd") * (GetInt (enemy,"str") - GetInt (self,"end")) / 100)
}
else if (enemy.defending = false and self.defending = false) {
self.cur_hp = self.cur_hp - (crit_hit (enemy) * GetInt (enemy,"pd") + GetInt (enemy,"pd") * (GetInt (enemy,"str") - GetInt (self,"end")) / 100)
}
}
case (2) {
enemy.defending = true
}
case (3) {
// (Cast)
}
}
if (GetInt (self,"cur_hp") > 0) {
if (RandomChance (GetInt (enemy,"spd") - GetInt (self,"spd")) = true) {
msg (enemy.alias + " gets an extra battle turn!")
enemy_battle_turn
}
else {
msg (enemy.alias + " 's battle turn is over.")
return (true)
}
}
else if (GetInt (self,"cur_hp") <= 0) {
msg (self.alias + " has died.")
msg ("GAME OVER")
finish
}
]]></function>
<function name="crit_hit" parameters="object" type="int">
if (RandomChance (GetInt (object,"luck")) = true) {
value = 2
}
else {
value = 1
}
return (value)
</function>
</asl>
<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>
<pov type="object">player</pov>
<start type="script">
cc
</start>
<turns type="int">0</turns>
<btrns type="int">0</btrns>
<brnds type="int">0</brnds>
<statusattributes type="stringdictionary">turns = </statusattributes>
</game>
<object name="room">
<inherit name="editor_room" />
<object name="player">
<inherit name="defaultplayer" />
<inherit name="pc" />
<escaped type="boolean">false</escaped>
<cur_hp type="int">100</cur_hp>
<max_hp type="int">100</max_hp>
<cur_mp type="int">100</cur_mp>
<max_mp type="int">100</max_mp>
<str type="int">100</str>
<end type="int">100</end>
<dex type="int">100</dex>
<agi type="int">100</agi>
<spd type="int">100</spd>
<hc type="int">100</hc>
<pd type="int">100</pd>
<pr type="int">100</pr>
</object>
<object name="orc1">
<inherit name="editor_object" />
<inherit name="npc" />
<hostile type="boolean">true</hostile>
<dead type="boolean">false</dead>
<alias>orc</alias>
<cur_hp type="int">999</cur_hp>
<max_hp type="int">999</max_hp>
<str type="int">25</str>
<end type="int">25</end>
<dex type="int">25</dex>
<agi type="int">25</agi>
<spd type="int">25</spd>
<hc type="int">25</hc>
<pd type="int">25</pd>
<pr type="int">25</pr>
<exp type="int">100</exp>
</object>
<object name="potion100">
<inherit name="editor_object" />
<alias>100 exp potion</alias>
<take />
<alt type="list"></alt>
<displayverbs>Look at; Take; Drink</displayverbs>
<inventoryverbs>Look at; Use; Drop; Drink</inventoryverbs>
<drink type="script">
msg ("You drink the exp potion, receiving 100 experience.")
game.pov.exp = game.pov.exp + 100
</drink>
</object>
<object name="potion300">
<inherit name="editor_object" />
<alias>300 exp potion</alias>
<take />
<displayverbs>Look at; Take; Drink</displayverbs>
<inventoryverbs>Look at; Use; Drop; Drink</inventoryverbs>
<drink type="script">
msg ("You drink the exp potion, receiving 300 experience.")
game.pov.exp = game.pov.exp + 300
</drink>
</object>
</object>
<turnscript name="game_turns">
<enabled />
<script>
lvlup
sa
game_over
game.turns = game.turns + 1
</script>
</turnscript>
<command name="fight">
<pattern>fight #text#</pattern>
<script>
battle_system (game.pov,text)
</script>
</command>
<type name="char">
<cur_hp type="int">0</cur_hp>
<drop type="boolean">false</drop>
<defending type="boolean">false</defending>
<max_hp type="int">0</max_hp>
<str type="int">0</str>
<end type="int">0</end>
<lvl type="int">0</lvl>
<exp type="int">0</exp>
<cash type="int">0</cash>
<dex type="int">0</dex>
<agi type="int">0</agi>
<spd type="int">0</spd>
<int type="int">0</int>
<spi type="int">0</spi>
<men type="int">0</men>
<cur_mp type="int">0</cur_mp>
<max_mp type="int">0</max_mp>
<hp type="int">0</hp>
<mp type="int">0</mp>
<hc type="int">0</hc>
<pd type="int">0</pd>
<fd type="int">0</fd>
<wd type="int">0</wd>
<ad type="int">0</ad>
<ed type="int">0</ed>
<ld type="int">0</ld>
<dd type="int">0</dd>
<pr type="int">0</pr>
<fr type="int">0</fr>
<wr type="int">0</wr>
<ar type="int">0</ar>
<er type="int">0</er>
<lr type="int">0</lr>
<dr type="int">0</dr>
<wt type="int">0</wt>
<ht type="int">0</ht>
<cur_arrow type="int">0</cur_arrow>
<cur_bolt type="int">0</cur_bolt>
<cur_bullet type="int">0</cur_bullet>
<max_arrow type="int">0</max_arrow>
<max_bolt type="int">0</max_bolt>
<max_bullet type="int">0</max_bullet>
<arrows type="int">0</arrows>
<bolts type="int">0</bolts>
<bullets type="int">0</bullets>
<cur_shuriken type="int">0</cur_shuriken>
<cur_throwing_axe type="int">0</cur_throwing_axe>
<cur_javelin type="int">0</cur_javelin>
<max_shuriken type="int">0</max_shuriken>
<max_throwing_axe type="int">0</max_throwing_axe>
<max_javelin type="int">0</max_javelin>
<shurikens type="int">0</shurikens>
<throwing_axes type="int">0</throwing_axes>
<javelins type="int">0</javelins>
<cur_throwing_knife type="int">0</cur_throwing_knife>
<max_throwing_knife type="int">0</max_throwing_knife>
<throwing_knives type="int">0</throwing_knives>
</type>
<type name="pc">
<inherit name="char" />
<escaped type="boolean">false</escaped>
<statusattributes type="stringdictionary">mp = ;hp = ;str = ;end = ;dex = ;agi = ;spd = ;int = ;spi = ;men = ;lvl = ;exp = ;cash = ;hc = ;pd = ;fd = ;wd = ;ad = ;ed = ;ld = ;dd = ;pr = ;fr = ;wr = ;ar = ;er = ;lr = ;dr = ;wt = ;ht = ;arrows = ;bolts = ;bullets = ;shurikens = ;throwing_axes = ;javelins = ;throwing_knives = </statusattributes>
</type>
<type name="npc">
<inherit name="char" />
<dead type="boolean">false</dead>
<hostile type="boolean">false</hostile>
<displayverbs type="list">Look; Talk; Steal; Give; Use; Cast; Fight</displayverbs>
<hostility type="script">
if (this.hostile = true) {
this.alias = this.displayalias + "(hostile)"
this.displayverbs = split ("Look;Use;Cast;Fight", ";")
}
</hostility>
<death type="script">
if (this.dead = true) {
this.alias = this.displayalias + "(dead)"
game.pov.exp = game.pov.exp + this.exp
this.displayverbs = split ("Look;Steal;Give;Use;Cast", ";")
}
</death>
</type>
<type name="storage">
<inherit name="container_closed" />
<drop type="boolean">false</drop>
<inventoryverbs type="list">Look; Open; Close</inventoryverbs>
</type>
<type name="gear">
<wt type="int">0</wt>
<take type="boolean">true</take>
<give type="boolean">true</give>
<equipped type="boolean">false</equipped>
<equipable type="boolean">true</equipable>
<unequipable type="boolean">true</unequipable>
<equipable_layer type="int">3</equipable_layer>
<equipable_slots type="list"></equipable_slots>
<inventoryverbs type="listextend">Equip;Unequip</inventoryverbs>
</type>
<type name="weapon">
<inherit name="gear" />
<pd type="int">0</pd>
<hc type="int">0</hc>
</type>
<type name="one_handed">
<inherit name="weapon" />
<equipable_slots type="list">right_hand</equipable_slots>
</type>
<type name="two_handed">
<inherit name="weapon" />
<equipable_slots type="list">left_hand;right_hand</equipable_slots>
</type>
<type name="sword">
</type>
<type name="axe">
</type>
<type name="blunt">
</type>
<type name="spear">
<inherit name="two_handed" />
</type>
<type name="staff">
<inherit name="two_handed" />
</type>
<type name="dagger">
<inherit name="one_handed" />
</type>
<type name="whip">
<inherit name="one_handed" />
</type>
<type name="bow">
<inherit name="two_handed" />
</type>
<type name="crossbow">
<inherit name="two_handed" />
</type>
<type name="gun">
</type>
<type name="throwing">
</type>
<type name="armor">
<inherit name="gear" />
<pr type="int">0</pr>
</type>
<type name="shield">
<inherit name="armor" />
<equipable_slots type="list">left_hand</equipable_slots>
</type>
<type name="clothing">
<inherit name="gear" />
</type>
<type name="headwear">
<equipable_slots type="list">head</equipable_slots>
</type>
<type name="facewear">
<inherit name="clothing" />
<equipable_slots type="list">face</equipable_slots>
</type>
<type name="earwear">
<inherit name="clothing" />
<equipable_slots type="list">ear</equipable_slots>
</type>
<type name="neckwear">
<inherit name="clothing" />
<equipable_slots type="list">neck</equipable_slots>
</type>
<type name="shoulderwear">
<inherit name="armor" />
<equipable_slots type="list">shoulder</equipable_slots>
</type>
<type name="armwear">
<equipable_slots type="list">arm</equipable_slots>
</type>
<type name="handwear">
<equipable_slots type="list">hand</equipable_slots>
</type>
<type name="fingerwear">
<inherit name="clothing" />
<equipable_slots type="list">finger</equipable_slots>
</type>
<type name="chestwear">
<equipable_slots type="list">chest</equipable_slots>
</type>
<type name="backwear">
<inherit name="clothing" />
<equipable_slots type="list">back</equipable_slots>
</type>
<type name="waistwear">
<equipable_slots type="list">waist</equipable_slots>
</type>
<type name="legwear">
<equipable_slots type="list">leg</equipable_slots>
</type>
<type name="footwear">
<equipable_slots type="list">foot</equipable_slots>
</type>
<type name="arrow">
<cur_arrow type="int">0</cur_arrow>
</type>
<type name="arrow_case">
<inherit name="backwear" />
<max_arrow type="int">0</max_arrow>
</type>
<type name="bolt">
<cur_bolt type="int">0</cur_bolt>
</type>
<type name="bolt_case">
<inherit name="backwear" />
<max_bolt type="int">0</max_bolt>
</type>
<type name="bullet">
<cur_bullet type="int">0</cur_bullet>
</type>
<type name="bullet_case">
<inherit name="backwear" />
<max_bullet type="int">0</max_bullet>
</type>
<type name="spell">
<drop type="boolean">false</drop>
<inventoryverbs type="list">Learn</inventoryverbs>
<displayverbs type="list">Learn</displayverbs>
</type>
<type name="fire">
</type>
<type name="water">
</type>
<type name="air">
</type>
<type name="earth">
</type>
<type name="light">
</type>
<type name="dark">
</type>
<function name="cc">
msg ("What is your name?")
get input {
game.pov.alias = result
msg (" - " + game.pov.alias)
show menu ("What is your gender?", split ("male;female" , ";"), false) {
game.pov.gender = result
show menu ("What is your race?", split ("human;dwarf;elf" , ";"), false) {
game.pov.race = result
show menu ("What is your class?", split ("warrior;cleric;mage;thief" , ";"), false) {
game.pov.class = result
msg (game.pov.alias + " is a " + game.pov.gender + " " + game.pov.race + " " + game.pov.class + ".")
wait {
ClearScreen
}
}
}
}
}
</function>
<function name="sa">
game.pov.hp = game.pov.cur_hp + " / " + game.pov.max_hp
game.pov.mp = game.pov.cur_mp + " / " + game.pov.max_mp
game.pov.arrows = game.pov.cur_arrow + " / " + game.pov.max_arrow
game.pov.bolts = game.pov.cur_bolt + " / " + game.pov.max_bolt
game.pov.bullets = game.pov.cur_bullet + " / " + game.pov.max_bullet
game.pov.shurikens = game.pov.cur_shuriken + " / " + game.pov.max_shuriken
game.pov.javelins = game.pov.cur_javelin + " / " + game.pov.max_javelin
game.pov.throwing_axes = game.pov.cur_throwing_axe + " / " + game.pov.max_throwing_axe
game.pov.throwing_knives = game.pov.cur_throwing_knife + " / " + game.pov.max_throwing_knife
</function>
<function name="game_over">
if (game.pov.cur_hp = 0) {
msg (game.pov.alias + " has died.")
msg ("GAME OVER")
finish
}
</function>
<function name="lvlup"><![CDATA[
if (game.pov.exp >= game.pov.lvl * 100 + 100) {
game.pov.exp = game.pov.exp - (game.pov.lvl * 100 + 100)
game.pov.lvl = game.pov.lvl + 1
lvlup
}
]]></function>
<function name="battle_system" parameters="self,text" type="boolean">
first_value = false
enemy = GetObject (text)
if (enemy = null) {
foreach (obj,AllObjects()) {
if (obj.alias=text) {
enemy = obj
}
}
}
if (enemy = null) {
msg ("There is no " + text + " here.")
first_value = false
}
else if (not Doesinherit (enemy,"npc")) {
msg ("You can not battle that!")
first_value = false
}
else if (not npc_reachable (enemy)) {
msg ("There is no " + enemy.alias + " in your vicinity.")
first_value = false
}
else if (GetBoolean (enemy,"dead") = true) {
msg (enemy.alias + " is already dead.")
first_value = false
}
else if (GetBoolean (enemy,"hostile") = false) {
msg (enemy.alias + " is not hostile.")
first_value = false
}
else if (battle_sequence (self,enemy) = true) {
msg ("The battle is over.")
first_value = true
}
return (first_value)
</function>
<function name="battle_sequence" parameters="self,enemy" type="boolean"><![CDATA[
if (GetInt (self,"spd") > GetInt (enemy,"spd")) {
on ready {
msg ("You get to go first for this round")
if (self_battle_turn (self,enemy) = true) {
return (true)
}
}
on ready {
if (enemy_battle_turn (self,enemy) = true) {
msg ("The round has ended.")
}
}
on ready {
battle_sequence (self,enemy)
}
}
else if (GetInt (self,"spd") < GetInt (enemy,"spd")) {
on ready {
msg (enemy.alias + " gets to go first for this round.")
if (enemy_battle_turn (self,enemy) = true) {
msg ("It is now your turn.")
}
}
on ready {
if (self_battle_turn (self,enemy) = true) {
return (true)
}
else {
msg ("The round has ended.")
}
}
on ready {
battle_sequence (self,enemy)
}
}
else if (GetInt (self,"spd") = GetInt (enemy,"spd")) {
if (RandomChance (50) = true) {
on ready {
msg ("You get to go first for this round")
if (self_battle_turn (self,enemy) = true) {
return (true)
}
}
on ready {
if (enemy_battle_turn (self,enemy) = true) {
msg ("The round has ended.")
}
}
on ready {
battle_sequence (self,enemy)
}
}
else {
on ready {
msg (enemy.alias + " gets to go first for this round.")
if (enemy_battle_turn (self,enemy) = true) {
msg ("It is now your turn.")
}
}
on ready {
if (self_battle_turn (self,enemy) = true) {
return (true)
}
else {
msg ("The round has ended.")
}
}
on ready {
battle_sequence (self,enemy)
}
}
}
]]></function>
<function name="self_battle_turn" parameters="self,enemy" type="boolean"><![CDATA[
msg (self.alias + " has " + self.cur_hp + " HP left.")
msg (self.alias + " has " + self.cur_mp + " MP left.")
msg (" ")
msg (enemy.alias + " has " + enemy.cur_hp + " HP left.")
wait {
show menu ("What is your battle choice?", split ("Attack;Defend;Cast;Item;Run", ";"), false) {
switch (result) {
case ("Attack") {
second_value = false
if (RandomChance (GetInt (enemy,"agi") - GetInt (self,"spd")) = true) {
msg (enemy.alias + "evaded your attack!")
second_value = true
}
else if (RandomChance (GetInt (enemy,"Dex") - GetInt (self,"agi")) = true) {
msg (enemy.alias + "parried your attack!")
second_value = true
}
else if (RandomChance (GetInt (enemy,"agi") - GetInt (self,"dex")) = true) {
msg (enemy.alias + "blocked your attack!")
second_value = true
}
else if (RandomChance (GetInt (self,"dex") - GetInt (enemy,"spd")) = false) {
msg ("Your attack missed " + enemy.alias +"!")
second_value = true
}
else if (RandomChance (GetInt (enemy,"pr") - GetInt (self,"hc")) = true) {
msg ("Your attack got resisted by " + enemy.alias +"!")
second_value = true
}
else if (second_value = false) {
if (self.defending = true and enemy.defending = true) {
enemy.cur_hp = enemy.cur_hp - (crit_hit (self) * 2 * GetInt (self,"pd") / 2 + GetInt (self,"pd") * (GetInt (self,"str") - GetInt (enemy,"end")) / 100)
msg (enemy.alias + " has " + enemy.cur_hp + " HP left.")
self.defending = false
}
else if (self.defending = true and enemy.defending = false) {
enemy.cur_hp = enemy.cur_hp - (crit_hit (self) * 2 * GetInt (self,"pd") + GetInt (self,"pd") * (GetInt (self,"str") - GetInt (enemy,"end")) / 100)
msg (enemy.alias + " has " + enemy.cur_hp + " HP left.")
self.defending = false
}
else if (self.defending = false and enemy.defending = true) {
enemy.cur_hp = enemy.cur_hp - (crit_hit (self) * GetInt (self,"pd") / 2 + GetInt (self,"pd") * (GetInt (self,"str") - GetInt (enemy,"end")) / 100)
msg (enemy.alias + " has " + enemy.cur_hp + " HP left.")
}
else if (self.defending = false and enemy.defending = false) {
enemy.cur_hp = enemy.cur_hp - (crit_hit (self) * GetInt (self,"pd") + GetInt (self,"pd") * (GetInt (self,"str") - GetInt (enemy,"end")) / 100)
msg (enemy.alias + " has " + enemy.cur_hp + " HP left.")
}
}
}
case ("Defend") {
if (self.defending = false) {
self.defending = true
}
}
case ("Cast") {
self.defending = false
}
case ("Item") {
self.defending = false
}
case ("Run") {
self.defending = false
}
}
if (GetInt (enemy,"cur_hp") > 0) {
if (RandomChance (GetInt (self,"spd") - GetInt (enemy,"spd")) = true) {
msg ("You get an extra battle turn!")
self_battle_turn
}
else {
msg ("Your battle turn is over.")
return (false)
}
}
else if (GetInt (enemy,"cur_hp") <= 0) {
msg (enemy.alias + " is dead.")
msg ("You have won the battle!")
enemy.defending = false
enemy.dead = true
return (true)
}
}
}
]]></function>
<function name="enemy_battle_turn" parameters="self,enemy" type="boolean"><![CDATA[
msg (self.alias + " has " + self.cur_hp + " HP left.")
msg (self.alias + " has " + self.cur_mp + " MP left.")
msg (" ")
msg (enemy.alias + " has " + enemy.cur_hp + " HP left.")
msg (" ")
result = GetRandomInt (1,3)
switch (result) {
case (1) {
third_value = false
if (RandomChance (GetInt (self,"agi") - GetInt (enemy,"spd")) = true) {
msg ("You have evaded the attack!")
third_value = true
}
else if (RandomChance (GetInt (self,"dex") - GetInt (enemy,"agi")) = true) {
msg ("You have parried the attack!")
third_value = true
}
else if (RandomChance (GetInt (self,"agi") - GetInt (enemy,"dex")) = true) {
msg ("You have blocked the attack!")
third_value = true
}
else if (RandomChance (GetInt (enemy,"dex") - GetInt (self,"spd")) = false) {
msg (enemy.alias +"'s attack missed!")
third_value = true
}
else if (RandomChance (GetInt (self,"pr") - GetInt (enemy,"hc")) = true) {
msg ("You resisted the attack!")
third_value = true
}
else if (third_value = false) {
if (enemy.defending = true and self.defending = true) {
self.cur_hp = self.cur_hp - (crit_hit (enemy) * 2 * GetInt (enemy,"pd") / 2 + GetInt (enemy,"pd") * (GetInt (enemy,"str") - GetInt (self,"end")) / 100)
msg (self.alias + " has " + self.cur_hp + " HP left.")
enemy.defending = false
}
else if (enemy.defending = true and self.defending = false) {
self.cur_hp = self.cur_hp - (crit_hit (enemy) * 2 * GetInt (enemy,"pd") + GetInt (enemy,"pd") * (GetInt (enemy,"str") - GetInt (self,"end")) / 100)
msg (self.alias + " has " + self.cur_hp + " HP left.")
enemy.defending = false
}
else if (enemy.defending = false and self.defending = true) {
self.cur_hp = self.cur_hp - (crit_hit (enemy) * GetInt (enemy,"pd") / 2 + GetInt (enemy,"pd") * (GetInt (enemy,"str") - GetInt (self,"end")) / 100)
msg (self.alias + " has " + self.cur_hp + " HP left.")
}
else if (enemy.defending = false and self.defending = false) {
self.cur_hp = self.cur_hp - (crit_hit (enemy) * GetInt (enemy,"pd") + GetInt (enemy,"pd") * (GetInt (enemy,"str") - GetInt (self,"end")) / 100)
msg (self.alias + " has " + self.cur_hp + " HP left.")
}
}
}
case (2) {
if (enemy.defending = false) {
msg (enemy.alias + " has choosen to defend itself.")
enemy.defending = true
}
}
case (3) {
enemy.defending = false
// (Cast)
}
}
if (GetInt (self,"cur_hp") > 0) {
if (RandomChance (GetInt (enemy,"spd") - GetInt (self,"spd")) = true) {
msg (enemy.alias + " gets an extra battle turn!")
enemy_battle_turn
}
else {
msg (enemy.alias + " 's battle turn is over.")
return (true)
}
}
else if (GetInt (self,"cur_hp") <= 0) {
msg (self.alias + " has died.")
msg ("GAME OVER")
finish
}
]]></function>
<function name="npc_reachable" parameters="object" type="boolean">
value = false
foreach (x,ScopeReachableNotHeld ()) {
if (x=object) {
value = true
}
}
return (value)
</function>
<function name="crit_hit" parameters="object" type="int">
if (RandomChance (GetInt (object,"luck")) = true) {
value = 2
}
else {
value = 1
}
return (value)
</function>
</asl>
<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>
<pov type="object">player</pov>
<start type="script">
cc
</start>
<turns type="int">0</turns>
<statusattributes type="stringdictionary">turns = </statusattributes>
</game>
<object name="room">
<inherit name="editor_room" />
<object name="player">
<inherit name="defaultplayer" />
<inherit name="pc" />
<cur_hp type="int">999</cur_hp>
<max_hp type="int">999</max_hp>
<str type="int">100</str>
<end type="int">100</end>
<dex type="int">100</dex>
<agi type="int">100</agi>
<spd type="int">100</spd>
<hc type="int">100</hc>
<pd type="int">100</pd>
<pr type="int">100</pr>
</object>
<object name="orc1">
<inherit name="editor_object" />
<inherit name="npc" />
<hostile type="boolean">true</hostile>
<dead type="boolean">false</dead>
<alias>orc</alias>
<cur_hp type="int">999</cur_hp>
<max_hp type="int">999</max_hp>
<str type="int">25</str>
<end type="int">25</end>
<dex type="int">25</dex>
<agi type="int">25</agi>
<spd type="int">25</spd>
<hc type="int">25</hc>
<pd type="int">25</pd>
<pr type="int">25</pr>
</object>
</object>
<turnscript name="game_turns">
<enabled />
<script>
sa
game.turns = game.turns + 1
</script>
</turnscript>
<command name="fight">
<pattern>fight #text#</pattern>
<script>
battle_system (game.pov,text)
</script>
</command>
<type name="char">
<cur_hp type="int">0</cur_hp>
<drop type="boolean">false</drop>
<defending type="boolean">false</defending>
<max_hp type="int">0</max_hp>
<str type="int">0</str>
<end type="int">0</end>
<dex type="int">0</dex>
<agi type="int">0</agi>
<spd type="int">0</spd>
<hp type="int">0</hp>
<hc type="int">0</hc>
<pd type="int">0</pd>
<pr type="int">0</pr>
</type>
<type name="pc">
<inherit name="char" />
<statusattributes type="stringdictionary">hp = ;str = ;end = ;dex = ;agi = ;spd = ;hc = ;pd = ;pr = </statusattributes>
</type>
<type name="npc">
<inherit name="char" />
<dead type="boolean">false</dead>
<hostile type="boolean">false</hostile>
<displayverbs type="list">Look at; Talk; Fight</displayverbs>
</type>
<function name="cc">
msg ("What is your name?")
get input {
game.pov.alias = result
msg (" - " + game.pov.alias)
show menu ("What is your gender?", split ("male;female" , ";"), false) {
game.pov.gender = result
show menu ("What is your race?", split ("human;dwarf;elf" , ";"), false) {
game.pov.race = result
show menu ("What is your class?", split ("warrior;cleric;mage;thief" , ";"), false) {
game.pov.class = result
msg (game.pov.alias + " is a " + game.pov.gender + " " + game.pov.race + " " + game.pov.class + ".")
wait {
ClearScreen
}
}
}
}
}
</function>
<function name="sa">
game.pov.hp = game.pov.cur_hp + " / " + game.pov.max_hp
</function>
<function name="battle_system" parameters="self,text" type="boolean">
first_value = false
enemy = GetObject (text)
if (enemy = null) {
foreach (obj,AllObjects()) {
if (obj.alias=text) {
enemy = obj
}
}
}
if (enemy = null) {
msg ("There is no " + text + " here.")
first_value = false
}
else if (not Doesinherit (enemy,"npc")) {
msg ("You can not battle that!")
first_value = false
}
else if (not npc_reachable (enemy)) {
msg ("There is no " + enemy.alias + " in your vicinity.")
first_value = false
}
else if (GetBoolean (enemy,"dead") = true) {
msg (enemy.alias + " is already dead.")
first_value = false
}
else if (GetBoolean (enemy,"hostile") = false) {
msg (enemy.alias + " is not hostile.")
first_value = false
}
else if (battle_sequence (self,enemy) = true) {
msg ("The battle is over.")
first_value = true
}
return (first_value)
</function>
<function name="battle_sequence" parameters="self,enemy" type="boolean"><![CDATA[
second_value = false
if (enemy.dead = false) {
if (GetInt (self,"spd") > GetInt (enemy,"spd")) {
on ready {
msg ("You get to go first for this round")
if (self_battle_turn (self,enemy) = true) {
battle_sequence (self,enemy)
}
}
on ready {
if (enemy.dead = false) {
if (enemy_battle_turn (self,enemy) = true) {
msg ("The round has ended.")
}
}
}
on ready {
battle_sequence (self,enemy)
}
}
else if (GetInt (self,"spd") < GetInt (enemy,"spd")) {
on ready {
msg (enemy.alias + " gets to go first for this round.")
if (enemy_battle_turn (self,enemy) = true) {
msg ("It is now your turn.")
}
}
on ready {
if (self_battle_turn (self,enemy) = true) {
battle_sequence (self,enemy)
}
else {
msg ("The round has ended.")
}
}
on ready {
battle_sequence (self,enemy)
}
}
else if (GetInt (self,"spd") = GetInt (enemy,"spd")) {
if (RandomChance (50) = true) {
on ready {
msg ("You get to go first for this round")
if (self_battle_turn (self,enemy) = true) {
battle_sequence (self,enemy)
}
}
on ready {
if (enemy_battle_turn (self,enemy) = true) {
msg ("The round has ended.")
}
}
on ready {
battle_sequence (self,enemy)
}
}
else {
on ready {
msg (enemy.alias + " gets to go first for this round.")
if (enemy_battle_turn (self,enemy) = true) {
msg ("It is now your turn.")
}
}
on ready {
if (self_battle_turn (self,enemy) = true) {
battle_sequence (self,enemy)
}
else {
msg ("The round has ended.")
}
}
on ready {
battle_sequence (self,enemy)
}
}
}
}
else {
second_value = true
}
return (second_value)
]]></function>
<function name="self_battle_turn" parameters="self,enemy" type="boolean"><![CDATA[
third_value = false
msg (self.alias + " has " + self.cur_hp + " HP left.")
msg (enemy.alias + " has " + enemy.cur_hp + " HP left.")
wait {
show menu ("What is your battle choice?", split ("Attack;Defend;Cast;Item;Run", ";"), false) {
switch (result) {
case ("Attack") {
fourth_value = false
if (RandomChance (GetInt (enemy,"agi") - GetInt (self,"spd")) = true) {
msg (enemy.alias + "evaded your attack!")
fourth_value = true
}
else if (RandomChance (GetInt (enemy,"Dex") - GetInt (self,"agi")) = true) {
msg (enemy.alias + "parried your attack!")
fourth_value = true
}
else if (RandomChance (GetInt (enemy,"agi") - GetInt (self,"dex")) = true) {
msg (enemy.alias + "blocked your attack!")
fourth_value = true
}
else if (RandomChance (GetInt (self,"dex") - GetInt (enemy,"spd")) = false) {
msg ("Your attack missed " + enemy.alias +"!")
fourth_value = true
}
else if (RandomChance (GetInt (enemy,"pr") - GetInt (self,"hc")) = true) {
msg ("Your attack got resisted by " + enemy.alias +"!")
fourth_value = true
}
else if (fourth_value = false) {
if (self.defending = true and enemy.defending = true) {
enemy.cur_hp = enemy.cur_hp - (crit_hit (self) * 2 * GetInt (self,"pd") / 2 + GetInt (self,"pd") * (GetInt (self,"str") - GetInt (enemy,"end")) / 100)
msg (enemy.alias + " has " + enemy.cur_hp + " HP left.")
self.defending = false
}
else if (self.defending = true and enemy.defending = false) {
enemy.cur_hp = enemy.cur_hp - (crit_hit (self) * 2 * GetInt (self,"pd") + GetInt (self,"pd") * (GetInt (self,"str") - GetInt (enemy,"end")) / 100)
msg (enemy.alias + " has " + enemy.cur_hp + " HP left.")
self.defending = false
}
else if (self.defending = false and enemy.defending = true) {
enemy.cur_hp = enemy.cur_hp - (crit_hit (self) * GetInt (self,"pd") / 2 + GetInt (self,"pd") * (GetInt (self,"str") - GetInt (enemy,"end")) / 100)
msg (enemy.alias + " has " + enemy.cur_hp + " HP left.")
}
else if (self.defending = false and enemy.defending = false) {
enemy.cur_hp = enemy.cur_hp - (crit_hit (self) * GetInt (self,"pd") + GetInt (self,"pd") * (GetInt (self,"str") - GetInt (enemy,"end")) / 100)
msg (enemy.alias + " has " + enemy.cur_hp + " HP left.")
}
}
}
case ("Defend") {
if (self.defending = false) {
self.defending = true
}
}
case ("Cast") {
self.defending = false
}
case ("Item") {
self.defending = false
}
case ("Run") {
self.defending = false
}
}
if (GetInt (enemy,"cur_hp") > 0) {
if (RandomChance (GetInt (self,"spd") - GetInt (enemy,"spd")) = true) {
msg ("You get an extra battle turn!")
self_battle_turn (self,enemy)
}
else {
msg ("Your battle turn is over.")
third_value = false
}
}
else if (GetInt (enemy,"cur_hp") <= 0) {
msg (enemy.alias + " is dead.")
msg ("You have won the battle!")
enemy.defending = false
enemy.dead = true
third_value = true
wait {
ClearScreen
}
}
}
}
return (third_value)
]]></function>
<function name="enemy_battle_turn" parameters="self,enemy" type="boolean"><![CDATA[
fifth_value = false
msg (self.alias + " has " + self.cur_hp + " HP left.")
msg (enemy.alias + " has " + enemy.cur_hp + " HP left.")
result = GetRandomInt (1,3)
switch (result) {
case (1) {
sixth_value = false
if (RandomChance (GetInt (self,"agi") - GetInt (enemy,"spd")) = true) {
msg ("You have evaded the attack!")
sixth_value = true
}
else if (RandomChance (GetInt (self,"dex") - GetInt (enemy,"agi")) = true) {
msg ("You have parried the attack!")
sixth_value = true
}
else if (RandomChance (GetInt (self,"agi") - GetInt (enemy,"dex")) = true) {
msg ("You have blocked the attack!")
sixth_value = true
}
else if (RandomChance (GetInt (enemy,"dex") - GetInt (self,"spd")) = false) {
msg (enemy.alias +"'s attack missed!")
sixth_value = true
}
else if (RandomChance (GetInt (self,"pr") - GetInt (enemy,"hc")) = true) {
msg ("You resisted the attack!")
sixth_value = true
}
else if (sixth_value = false) {
if (enemy.defending = true and self.defending = true) {
self.cur_hp = self.cur_hp - (crit_hit (enemy) * 2 * GetInt (enemy,"pd") / 2 + GetInt (enemy,"pd") * (GetInt (enemy,"str") - GetInt (self,"end")) / 100)
msg (self.alias + " has " + self.cur_hp + " HP left.")
enemy.defending = false
}
else if (enemy.defending = true and self.defending = false) {
self.cur_hp = self.cur_hp - (crit_hit (enemy) * 2 * GetInt (enemy,"pd") + GetInt (enemy,"pd") * (GetInt (enemy,"str") - GetInt (self,"end")) / 100)
msg (self.alias + " has " + self.cur_hp + " HP left.")
enemy.defending = false
}
else if (enemy.defending = false and self.defending = true) {
self.cur_hp = self.cur_hp - (crit_hit (enemy) * GetInt (enemy,"pd") / 2 + GetInt (enemy,"pd") * (GetInt (enemy,"str") - GetInt (self,"end")) / 100)
msg (self.alias + " has " + self.cur_hp + " HP left.")
}
else if (enemy.defending = false and self.defending = false) {
self.cur_hp = self.cur_hp - (crit_hit (enemy) * GetInt (enemy,"pd") + GetInt (enemy,"pd") * (GetInt (enemy,"str") - GetInt (self,"end")) / 100)
msg (self.alias + " has " + self.cur_hp + " HP left.")
}
}
}
case (2) {
if (enemy.defending = false) {
msg (enemy.alias + " has choosen to defend itself.")
enemy.defending = true
}
}
case (3) {
enemy.defending = false
msg ("Cast")
}
}
if (GetInt (self,"cur_hp") > 0) {
if (RandomChance (GetInt (enemy,"spd") - GetInt (self,"spd")) = true) {
msg (enemy.alias + " gets an extra battle turn!")
wait {
enemy_battle_turn (self,enemy)
}
}
else {
msg (enemy.alias + " 's battle turn is over.")
fifth_value = true
}
}
else if (GetInt (self,"cur_hp") <= 0) {
msg (self.alias + " has died.")
msg ("GAME OVER")
finish
}
return (fifth_value)
]]></function>
<function name="npc_reachable" parameters="object" type="boolean">
value = false
foreach (x,ScopeReachableNotHeld ()) {
if (x=object) {
value = true
}
}
return (value)
</function>
<function name="crit_hit" parameters="object" type="int">
if (RandomChance (GetInt (object,"luck")) = true) {
value = 2
}
else {
value = 1
}
return (value)
</function>
</asl>
01. cc = character creation function
02. sa = status attributes (mainly for implementing/displaying of ' cur / max ' stats) function
03. char = character object type ("pcs", "npcs", "monsters", etc., so, not a room, item, equipment, spell, etc)
04. pc = playable character object type ("player" characters / game.povs)
05. npc = non-playable character ("people", "monsters", and etc, so not a "player" character / not a game.pov, I'm going to have a hostility system, so any npc can be friendly or hostile, instead of having an actual "monster/enemy" type set aside)
06. hp = hit points (life) stat attribute
07. mp = mana points (magic) stat attribute
08. str = strength (physical damage, carry weight / equipment requirement, etc) stat attribute
09. end = endurance (physical defense, and etc) stat attribute
10. dex = dexterity (weapon~attack skill, think of this as "if your attack connects or not, do you 'whiff' or not", so not to gete confused with hc, and etc) stat attribute
11. agi = agility (dodging/evading, and etc) stat attribute
12. spd = speed (who goes first in battle, extra battle turns, escaping from battle, and etc) stat attribute
13. hc = hit chance (think of this more as piercing their armor or not, so not to get confused with dex, and etc) stat attribute
14. pd = physical damage stat attribute
15. fp = fire damage stat attribute
16. wp = water damage stat attribute
17. ap = air damage stat attribute
18. ed = earth damage stat attribute
19. ld = light damage stat attribute
20. dd = dark damage stat attribute
21. pr = physical resistance stat attribute
22. fr = fire resistance stat attribute
23. wr = water resistance stat attribute
24. ar = air resistance stat attribute
25. er = earth resistance stat attribute
26. lr = light resistance stat attribute
27. dr = dark resistance stat attribute
28. defending = boolean (reduces damage done for that character and increases the damage done by that character, if they chosoe to attack on the next turn)
29. escaped = boolean, run from battle (not completed/implemented yet)
30. hostile = boolean, any npc can be friendly or a(n) "monster/enemy", based upon a hostility scale (0-100), but not completed
31. dead = boolean
32. crit_hit = critical hit (bonus damage based upon luck)
33. luck = luck stat attribute
34. lvl = level stat attribute
35. exp = experience stat attribute
36. cash = cash stat attribute (currency)
37. lvlup = level up function
<library>
<!-- Commands -->
<command name="help_command">
<pattern>help</pattern>
<script>
help_function
</script>
</command>
<command name="statistics_command">
<pattern>stats</pattern>
<script>
statistics_function
</script>
</command>
<command name="explore_command">
<pattern>explore</pattern>
<script>
explore_function
</script>
</command>
<command name="travel_command">
<pattern>goto</pattern>
<script>
travel_function
</script>
</command>
<command name="storage_command">
<pattern>storage</pattern>
<script>
storage_function
</script>
</command>
<command name="equipment_command">
<pattern>gear</pattern>
<script>
equipment_function
</script>
</command>
<!-- Functions -->
<function name="help_function">
</function>
<function name="statistics_function">
</function>
<function name="explore_function">
switch (game.pov.parent) {
case ("homeland") {
if (firsttime) {
ScriptDictionaryItem (dictionary_structures.homeland_events_script_dictionary,"homeland_discovery")
} otherwise {
ScriptDictionaryItem (dictionary_structures.homeland_events_script_dictionary,GetRandomInt(1,max_value))
}
}
}
</function>
<function name="travel_function">
show menu ("Where do you wish to travel?",dictionary_structures.travel_script_dictionary,true) {
ScriptDictionaryItem (dictionary_structures.travel_script_dictionary,result)
}
</function>
<function name="storage_function">
</function>
<function name="equipment_function">
</function>
<function name="travel_script_dictionary_function"><![CDATA[
if (boolean_structures.homeland_discovered = true) {
dictionary add (dictionary_structures.travel_script_dictionary,"homeland", etc etc and script (if (game.pov.parent <> homeland) then script (game.pov.parent = homeland))
}
]]></function>
<function name="game_turns_function">
game.turns = game.turns + 1
</function>
<!-- Turnscripts -->
<turnscript name="game_turns_turnscript">
travel_script_dictionary_function
game_turns_function
</turnscript>
<!-- Object Structures (Data Storage) -->
<object name="dictionary_structures">
<parent>null</parent>
<travel_script_dictionary type="scriptdictionary">
<item key="homeland"><![CDATA[
if (game.pov.parent = homeland) {
msg ("You are already here at the homeland! Try again.")
wait {
travel_function
}
} else if (game.pov.parent <> homeland) {
game.pov.parent = homeland
]]></item>
</travel_script_dictionary>
<homeland_events_script_dictionary type="scriptdictionary">
<item key="homeland_discovery">
boolean_structures.homeland_discovered = true
msg ("You've discovered the homeland! Now, you can truly explore, and also travel to, the homeland!")
</item>
</homeland_events_script_dictionary>
</object>
</library>