foreach (att, game.pov.attlist) {
msg (att + ": {command:Dec " + att + ":<} {" + game.pov.name + "." + att + "} {command:Inc " + att + ":>}")
// HK notes // strength: {command:dec strength:<} {HK.strength} {command:inc strength:>}
// HK notes // strength: < 50 >
}
<library>
<!--
LevelLib is a basic character creation and levelling library for Quest. See the Wiki How to guide for details.
Version 1.0
Quest version: 5.4
Written by: The Pixie
-->
<command name="IncCommand">
<pattern>Inc #text#</pattern>
<script><![CDATA[
if (TotalAttributes() < game.pov.maxpoints) {
value = GetAttribute(game.pov, text)
set (game.pov, text, value+1)
}
ChooseAttributes
]]></script>
</command>
<command name="DecCommand">
<pattern>Dec #text#</pattern>
<script><![CDATA[
value = GetAttribute(game.pov, text)
oldvalue = GetAttribute(game.pov, text+"_old")
if (value > oldvalue) {
set (game.pov, text, value-1)
}
ChooseAttributes
]]></script>
</command>
<command name="LevellingDoneCommand">
<pattern>Levelling Done</pattern>
<script>
ClearScreen
request (Show, "Command")
game.showdescriptiononenter = game.remembershowdescriptiononenter
ShowRoomDescription
game.notarealturn = true
</script>
</command>
<command name="LevellingCommand">
<pattern>level</pattern>
<script>
LevelUp
</script>
</command>
<function name="LevelUp"><![CDATA[
game.remembershowdescriptiononenter = game.showdescriptiononenter
game.showdescriptiononenter = false
request (Hide, "Command")
foreach (att, game.pov.attlist) {
if (not HasInt (game.pov, att)) {
set (game.pov, att, 0)
set (game.pov, att + "_old", GetInt (game.pov, att))
}
}
ChooseAttributes
]]></function>
<function name="ChooseAttributes"><![CDATA[
ClearScreen
msg ("Assign points to attributes (" + (game.pov.maxpoints - TotalAttributes()) + ")")
foreach (att, game.pov.attlist) {
msg (att + ": {command:Dec " + att + ":<} {" + game.pov.name + "." + att + "} {command:Inc " + att + ":>}")
// HK notes // strength: {command:dec strength:<} {hk.strength} {command:inc strength:>}
// HK notes // strength: < 50 >
}
msg ("{command:Levelling Done:Done}")
game.notarealturn = true
]]></function>
<function name="TotalAttributes" type="int">
total = 0
foreach (att, game.pov.attlist) {
total = total + GetInt (game.pov, att)
}
return (total)
</function>
<function name="PointsLeft" type="int">
return (game.pov.maxpoints - TotalAttributes())
</function>
</library>
<asl version="550">
<include ref="English.aslx"/>
<include ref="Core.aslx"/>
<game name="Testing Game Stuff">
<gameid>b073bbfb-0e99-45d3-9786-bb395a6bc6b0</gameid>
<version>1.0</version>
<firstpublished>2015</firstpublished>
<pov type="object">player</pov>
<start type="script">
msg ("xxx")
</start>
</game>
<object name="room">
<inherit name="editor_room" />
<object name="player">
<inherit name="editor_object" />
<inherit name="editor_player" />
<inherit name="playable_character_object_type" />
</object>
</object>
<object name="potion_1">
<inherit name="editor_object" />
<alias>potion</alias>
<attr name="parent" type="object">player</attr>
<attr name="drink" type="script">
this.parent.experience_integer = this.parent.experience_integer + 100
</attr>
</object>
<object name="global_data_object">
<inherit name="editor_object" />
<attr name="primary_attribute_stringlist" type="simplestringlist">strength_integer;endurance_integer;dexterity_integer;agility_integer;speed_integer;luck_integer;piety_integer;intelligence_integer;spirituality_integer;mentality_integer;personality_integer;leadership_integer;charisma_integer;perception_integer;deception_integer;alignment_integer;creativity_integer;vitality_integer</attr>
</object>
<type name="playable_character_object_type">
<attr name="level_integer" type="int">0</attr>
<attr name="experience_integer" type="int">0</attr>
<attr name="cash_integer" type="int">0</attr>
<attr name="attribute_integer" type="int">0</attr>
<attr name="life_string" type="string">Life: 0/0</attr>
<attr name="mana_string" type="string">Mana: 0/0</attr>
<attr name="tech_string" type="string">Tech: 0/0</attr>
<attr name="current_life_integer" type="int">0</attr>
<attr name="maximum_life_integer" type="int">0</attr>
<attr name="current_mana_integer" type="int">0</attr>
<attr name="maximum_mana_integer" type="int">0</attr>
<attr name="current_tech_integer" type="int">0</attr>
<attr name="maximum_tech_integer" type="int">0</attr>
<attr name="strength_integer" type="int">0</attr>
<attr name="endurance_integer" type="int">0</attr>
<attr name="dexterity_integer" type="int">0</attr>
<attr name="agility_integer" type="int">0</attr>
<attr name="speed_integer" type="int">0</attr>
<attr name="luck_integer" type="int">0</attr>
<attr name="piety_integer" type="int">0</attr>
<attr name="intelligence_integer" type="int">0</attr>
<attr name="spirituality_integer" type="int">0</attr>
<attr name="mentality_integer" type="int">0</attr>
<attr name="personality_integer" type="int">0</attr>
<attr name="leadership_integer" type="int">0</attr>
<attr name="charisma_integer" type="int">0</attr>
<attr name="perception_integer" type="int">0</attr>
<attr name="deception_integer" type="int">0</attr>
<attr name="alignment_integer" type="int">0</attr>
<attr name="creativity_integer" type="int">0</attr>
<attr name="vitality_integer" type="int">0</attr>
<attr name="statusattributes" type="simplestringdictionary">level_integer = Level: !;experience_integer = Experience: !;attribute_integer = Attribute: !;cash_integer = Cash: !;life_string = !;mana_string = !;tech_string = !;strength_integer = Strength: !;endurance_integer = Endurance: !;dexterity_integer = Dexterity: !;agility_integer = Agility: !;vitality_integer = Vitality: !;speed_integer = Speed: !;luck_integer = Luck: !;piety_integer = Piety: !;alignment_integer = Alignment: !;intelligence_integer = Intelligence: !;spirituality_integer = Spirituality: !;mentality_integer = Mentality: !;personality_integer = Personality: !;leadership_integer = Leadership: !;charisma_integer = Charisma: !;creativity_integer = Creativity: !;perception_integer = Perception: !;deception_integer = Deception: !</attr>
<attr name="changedcurrent_life_integer" type="script">
this.life_string = "Life: " + this.current_life_integer + "/" + this.maximum_life_integer
</attr>
<attr name="changedmaximum_life_integer" type="script">
this.life_string = "Life: " + this.current_life_integer + "/" + this.maximum_life_integer
</attr>
<attr name="changedcurrent_mana_integer" type="script">
this.mana_string = "Mana: " + this.current_mana_integer + "/" + this.maximum_mana_integer
</attr>
<attr name="changedmaximum_mana_integer" type="script">
this.mana_string = "Mana: " + this.current_mana_integer + "/" + this.maximum_mana_integer
</attr>
<attr name="changedcurrent_tech_integer" type="script">
this.tech_string = "Tech: " + this.current_tech_integer + "/" + this.maximum_tech_integer
</attr>
<attr name="changedmaximum_tech_integer" type="script">
this.tech_string = "Tech: " + this.current_tech_integer + "/" + this.maximum_tech_integer
</attr>
</type>
<turnscript name="global_turnscript">
<enabled />
<script>
leveling_function (game.pov)
</script>
</turnscript>
<command name="increase_command">
<pattern>increase #text#</pattern>
<script><![CDATA[
if (game.pov.attribute_integer > 0) {
value_variable = GetInt (game.pov, text)
set (game.pov, text + "_old", value_variable)
set (game.pov, text, value_variable + 1)
game.pov.attribute_integer = game.pov.attribute_integer - 1
}
]]></script>
</command>
<command name="decrease_command">
<pattern>decrease #text#</pattern>
<script><![CDATA[
value_variable = GetInt (game.pov, text)
old_value_variable = GetInt (game.pov, text + "_old")
if (value_variable > old_value_variable) {
set (game.pov, text, value_variable - 1)
game.pov.attribute_integer = game.pov.attribute_integer + 1
}
]]></script>
</command>
<command name="leveling_command">
<pattern>leveling</pattern>
<script><![CDATA[
if (game.pov.attribute_integer > 0) {
foreach (attribute_variable, global_data_object.primary_attribute_stringlist) {
msg (attribute_variable + ": {command:decrease " + attribute_variable + ":<} {" + game.pov.name + "." + attribute_variable + "} {command:increase " + attribute_variable + ":>}")
}
} else {
msg ("You need more experience.")
}
]]></script>
</command>
<function name="leveling_function" parameters="character_parameter"><![CDATA[
if (character_parameter.experience_integer >= character_parameter.level_integer * 100 + 100) {
character_parameter.experience_integer = character_parameter.experience_integer - (character_parameter.level_integer * 100 + 100)
character_parameter.attribute_integer = character_parameter.attribute_integer + 5
character_parameter.level_integer = character_parameter.level_integer + 1
leveling_function (character_parameter)
}
]]></function>
</asl>
foreach (att, game.pov.attlist) {
msg (att + ": {command:Dec " + att + ":<} {" + game.pov.name + "." + att + "} {command:Inc " + att + ":>}")
}
msg ("Strength: {command:Dec Strength:<} {player.Strength} {command:Inc Strength:>}")
{command:Dec Strength:<} This will display "<", as a hyperlink that will do the "Dec Strength" command
{player.Strength} This will display the value of player.Strength
{command:Inc Strength:>} This will display ">", as a hyperlink that will do the "Inc Strength" command
I'd like to know what is enabling this (see above) to work in Pixie's Level Library? Is it the 'notarealturn' or is it the 'hide command bar' or is it due to the 'done command' or is it something else or just an unnoticed error~typo in my code... ???
Is the 'notarealturn' a boolean within the internal coding, dealing with how the engine determines turns, or is it jsut a custom attribute (and then how is it thus working ???) ???
as far as I understand, hiding the command bar, is just preventing turns due to or from the person playing the game from inputing something (which counts as a turn), or is there more to it than just this, and it does have something to do with the value updating in the 'attribute: < value >' msg script?
Pixie wrote:{command:Dec Strength:<} This will display "<", as a hyperlink that will do the "Dec Strength" command
{player.Strength} This will display the value of player.Strength
{command:Inc Strength:>} This will display ">", as a hyperlink that will do the "Inc Strength" command
Pixie wrote:The system tracks turns, and a turn is every time the player does something. Clicking the "<" hyperlink to lower a stat will invoke a command, "Dec Strength". But you do not really want that to count as a proper turn. The "notarealturn" attribute handles that, and is something I added for this system.