Simple Combat Advanced (questions)

Anonynn
So I've been rummaging through the old Quest documents about how to implement combat, but I think some of it might be outdated and possibly not clear enough for people to follow. Specifically, I ran across some instances that might need updating, and since I'm creating my own combat system following the guide I hope someone can help correct me along the way!

The information comes from this page. http://docs.textadventures.co.uk/quest/ ... types.html

Here is my spell.object

<object name="spell">
<inherit name="editor_object" />
<alias> A Fireball Spell</alias>
<drop type="boolean">false</drop>
<take type="boolean">false</take>
<inventoryverbs type="stringlist">
<value>Cast</value>
</inventoryverbs>
<changedtype>spell</changedtype>
<feature_usegive />
<usedefaultprefix type="boolean">false</usedefaultprefix>
<look type="string"></look>
<usestandardverblist />
<displayverbs type="stringlist">
<value>Learn</value>
</displayverbs>
<learn type="script">
</learn>
<cast type="script">



and here is what that guide is telling me to put.

<type name="spell">
'''<learn type="script">'''
'''if (not this.parent = game.pov) {'''
'''this.parent = player'''
'''msg ("How about that? You can now cast " + this.alias + ".")'''
'''}'''
'''else {'''
'''msg ("Er, you already know that one!")'''
'''}
'''</learn>'''
<drop type="boolean">false</drop>
<take type="boolean">false</take>
</type>

Now I'm a noob at programming and coding. There's no question but looking at these two, I can see some obvious differences, especially some that might intimidate a newcomer to Quest. For one, things don't match up.

For example, <type name="spell">

I am going to assume that type name was changed to <object name="spell"> correct? Or have I misinterpreted this?
Also, following these directions, is this correct? The additions are in bold.

<object name="spell">
<inherit name="editor_object" />
<alias> A Fireball Spell</alias>
<learn type="script">
if (not this.parent = game.pov) {
msg ("How about that? You can now cast fireballs " + this.alias + ".")
}
"else {
msg ("Er, you already know that spell!")
}
</learn>

<drop type="boolean">false</drop>
<take type="boolean">false</take>
<inventoryverbs type="stringlist">
<value>Cast</value>
</inventoryverbs>
<changedtype>spell</changedtype>
<feature_usegive />
<usedefaultprefix type="boolean">false</usedefaultprefix>
<look type="string"></look>
<usestandardverblist />
<displayverbs type="stringlist">
<value>Learn</value>
</displayverbs>
<learn type="script">
</learn>
<cast type="script">




Now if that isn't correct, then the tutorials need some updating. Would anyone mind helping me out?

HegemonKhan
ah, Pixie's spells, hehe, you're moving up neonayon!

I looked at these a long time ago, and let's see if I remember enough (lol), to help you.

------

Your question about 'Object' vs 'Type (Object Type)', is a good start, more simple than actually working on implementing the spells correctly, laughs.

Your actual spells (fireball, blizzard, etc) are Objects.

however, since all spells have some universal functionality (such as Pixie's usage of 'learn' and 'cast' Script Attributes ~ Verbs). Thus, you can (want to) create an Object Type, adding these universal functionalities to the Object Type, and then add that Object Type, to your spell Objects, reducing code redundancy.

------

see this example below:

no usage of Object Types (YUCK!):

<object name="orc_1">
<attr name="alias" type="string">orc</attr>
<attr name="strength" type="int">25</attr>
<attr name="endurance" type="int">25</attr>
<attr name="agility" type="int">25</attr>
<attr name="dexterity" type="int">25</attr>
<attr name="speed" type="int">25</attr>
<attr name="luck" type="int">25</attr>
<attr name="fight" type="script">
// blah Scripts
</attr>
</object>

<object name="orc_2">
<attr name="alias" type="string">orc</attr>
<attr name="strength" type="int">25</attr>
<attr name="endurance" type="int">25</attr>
<attr name="agility" type="int">25</attr>
<attr name="dexterity" type="int">25</attr>
<attr name="speed" type="int">25</attr>
<attr name="luck" type="int">25</attr>
<attr name="fight" type="script">
// blah Scripts
</attr>
</object>

<object name="orc_3">
<attr name="alias" type="string">orc</attr>
<attr name="strength" type="int">25</attr>
<attr name="endurance" type="int">25</attr>
<attr name="agility" type="int">25</attr>
<attr name="dexterity" type="int">25</attr>
<attr name="speed" type="int">25</attr>
<attr name="luck" type="int">25</attr>
<attr name="fight" type="script">
// blah Scripts
</attr>
</object>

<object name="orc_chief_1">
<attr name="alias" type="string">orc chief</attr>
<attr name="strength" type="int">50</attr>
<attr name="endurance" type="int">50</attr>
<attr name="agility" type="int">50</attr>
<attr name="dexterity" type="int">50</attr>
<attr name="speed" type="int">50</attr>
<attr name="luck" type="int">50</attr>
<attr name="fight" type="script">
// blah Scripts
</attr>
</object>

<object name="orc_chief_2">
<attr name="alias" type="string">orc chief</attr>
<attr name="strength" type="int">50</attr>
<attr name="endurance" type="int">50</attr>
<attr name="agility" type="int">50</attr>
<attr name="dexterity" type="int">50</attr>
<attr name="speed" type="int">50</attr>
<attr name="luck" type="int">50</attr>
<attr name="fight" type="script">
// blah Scripts
</attr>
</object>

<object name="orc_chief_3">
<attr name="alias" type="string">orc chief</attr>
<attr name="strength" type="int">50</attr>
<attr name="endurance" type="int">50</attr>
<attr name="agility" type="int">50</attr>
<attr name="dexterity" type="int">50</attr>
<attr name="speed" type="int">50</attr>
<attr name="luck" type="int">50</attr>
<attr name="fight" type="script">
// blah Scripts
</attr>
</object>


vs

using Object Types (much better!):

<object name="orc_1">
<inherit name="monster" />
<inherit name="orc" />
</object>

<object name="orc_2">
<inherit name="monster" />
<inherit name="orc" />
</object>

<object name="orc_3">
<inherit name="monster" />
<inherit name="orc" />
</object>

<object name="orc_chief_1">
<inherit name="monster" />
<inherit name="orc_chief" />
</object>

<object name="orc_chief_2">
<inherit name="monster" />
<inherit name="orc_chief" />
</object>

<object name="orc_chief_3">
<inherit name="monster" />
<inherit name="orc_chief" />
</object>

<type name="monster">
<attr name="fight" type="script">
// blah Scripts
</attr>
</type>

<type name="orc">
<attr name="alias" type="string">orc</attr>
<attr name="strength" type="int">25</attr>
<attr name="endurance" type="int">25</attr>
<attr name="agility" type="int">25</attr>
<attr name="dexterity" type="int">25</attr>
<attr name="speed" type="int">25</attr>
<attr name="luck" type="int">25</attr>
</type>

<type name="orc_chief">
<attr name="alias" type="string">orc chief</attr>
<attr name="strength" type="int">50</attr>
<attr name="endurance" type="int">50</attr>
<attr name="agility" type="int">50</attr>
<attr name="dexterity" type="int">50</attr>
<attr name="speed" type="int">50</attr>
<attr name="luck" type="int">50</attr>
</type>


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

so, with spells...

<object name="fireball">
<inherit name="spell" />
<inherit name="fire" />
<attr name="power" type="int">25</attr>
<attr name="mana_cost" type="int">5</attr>
// etc Attributes
</object>

<object name="inferno">
<inherit name="spell" />
<inherit name="fire" />
<attr name="power" type="int">50</attr>
<attr name="mana_cost" type="int">10</attr>
// etc Attributes
</object>

<object name="blizzard">
<inherit name="spell" />
<inherit name="ice" />
<attr name="power" type="int">50</attr>
<attr name="mana_cost" type="int">10</attr>
// etc Attributes
</object>

<object name="iceball">
<inherit name="spell" />
<inherit name="ice" />
<attr name="power" type="int">50</attr>
<attr name="mana_cost" type="int">5</attr>
// etc Attributes
</object>

<type name="fire">
<attr name="elemental" type="string">fire</attr>
// etc Attributes
</type>

<type name="ice">
<attr name="elemental" type="string">ice</attr>
// etc Attributes
</type>

<type name="spell">
<attr name="learn" type="script">
// blah scripts
</attr>
<attr name="cast" type="script">
// blah scripts
</attr>
// etc Attributes
</type>


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

Pixie's spell system is really advanced and ingenius, beyond just the amazing structure-design, Pixie uses an ingenius method with dictionaries to produce the common magic features in RPG games, of:

strong: only half (0.5) damage with this elemental type
weak: (1.5 or double: 2.0) damage with this elemental type
absorb: instead of doing damage, the spell heals (gives life back to) the target
reflect: the spells damage is done to the caster (usually at 1/2), instead of the target
immune: no damage with this elemental type

it took me along time to understand how it worked, laughs :D

(when you're ready, I can try to help you with it)

HegemonKhan
here's Pixie's (original)* Library File, (original)* demo game, and my own practice just with trying to re-create (type in, lol) Pixie's spell library:

* this was Pixie's original standalone spell library and demo game (like from 3 years ago), before the switch from quest's doc wiki site to the current google doc site or whatever it is, and also long before Pixie made his~her 'Simple Combat Library' and merging his~her Spell library into it.

Pixie's Spell Library:

(the Tab~Control stuff is just for being able to set up your game's spells and etc spell stuff, through the GUI~Editor)

<?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>


Pixie's Demo Game:

<?xml version="1.0"?>
<!--Saved by Quest 5.2.4515.34846-->
<asl version="520">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<include ref="SpellLibrary.aslx" />
<game name="In the Lair of the Demon Witch">
<gameid>9b1b2320-14a1-4ae7-903c-5dd29b2c66ff</gameid>
<version>1.0</version>
<autodescription />
<statusattributes type="stringdictionary"></statusattributes>
<start type="script">
msg ("You open you eyes, and wonder where you are... And who you are...")
msg (" ")
</start>
<showscore />
<showhealth />
<autodescription_youcango type="int">3</autodescription_youcango>
<autodescription_youcansee type="int">4</autodescription_youcansee>
<autodescription_description type="int">2</autodescription_description>
<autodescription_youarein_useprefix type="boolean">false</autodescription_youarein_useprefix>
</game>
<object name="nowhere">
<inherit name="editor_room" />
<object name="parchment">
<inherit name="editor_object" />
<inherit name="surface" />
<hidechildren />
<listchildren />
<take />
<look type="script"><![CDATA[
if (unlock_spell.parent = parchment) {
msg ("The parchment is very high quality, thick and smooth, with neat writting on one side. Somehow you know the writing is an <i>Unlock</i> spell; it is almost buzzing with power. Further, you sense that the spell wants to become part of you. Is it possible you could... learn the spell?")
}
else {
msg ("The parchment is very high quality, thick and smooth, and blank on both sides.")
}
]]></look>
<object name="unlock_spell">
<inherit name="editor_object" />
<inherit name="nonattackspell" />
<alias>Unlock</alias>
<spelleffect type="script">
flag = False
foreach (ex, ScopeExits ()) {
if (GetBoolean (ex, "locked")) {
ex.locked = False
flag = True
msg ("...The door " + ex.alias + " magically unlocks!")
}
}
if (not flag) {
msg ("...There were no doors locked")
}
</spelleffect>
</object>
</object>
</object>
<object name="cell">
<inherit name="editor_room" />
<usedefaultprefix type="boolean">false</usedefaultprefix>
<alias>A cell</alias>
<description>A small cell, with stone walls, arching to form a ceiling above your head. The only furniture are a bucket, and a shelf; the only exit the iron door to the east. The only light comes from a narrow window above the door.</description>
<object name="player">
<inherit name="defaultplayer" />
<status>-</status>
<statusattributes type="stringdictionary">status = </statusattributes>
</object>
<object name="spellbook">
<inherit name="editor_object" />
<inherit name="container_open" />
<open />
<close />
<transparent type="boolean">false</transparent>
<hidechildren />
<isopen type="boolean">false</isopen>
<listchildren />
<listchildrenprefix>On it:</listchildrenprefix>
<take />
<inventoryverbs>Look at; Use; Drop; Open; Close</inventoryverbs>
<object name="fireball_spell">
<inherit name="editor_object" />
<inherit name="attackspell" />
<inherit name="fire_type" />
<alias>Fireball</alias>
<powerrating type="int">6</powerrating>
<description>A huge ball of fire envelops the entire room!</description>
</object>
<object name="aura_spell">
<inherit name="editor_object" />
<inherit name="spell" />
<inherit name="lastingspell" />
<alias>Aura</alias>
<status>Glowing</status>
<description>Suddenly you are glowing.</description>
<spelleffect type="script">
player.glowing = True
</spelleffect>
<terminate type="script">
player.status = "-"
</terminate>
</object>
</object>
<exit name="cell_door" alias="east" to="hall_of_cells">
<inherit name="eastdirection" />
<first />
<script type="script">
if (cell_door.first) {
msg ("The door is locked. Not surprising but it had to be worth a try.")
if (parchment.parent = nowhere) {
msg ("A piece of parchment is slipped under the door, and a voice, perhaps familiar you think, say; 'Use this.'")
parchment.parent = cell
cell_door.locked = True
cell_door.first = False
}
}
else {
MoveObject (player, hall_of_cells)
}
</script>
</exit>
</object>
<object name="hall_of_cells">
<inherit name="editor_room" />
<description>This is where the prison guard sits as he watches the cells. There are six cells on one side, and another six on the other side, but the only important one is yours, to the east.</description>
<usedefaultprefix type="boolean">false</usedefaultprefix>
<alias>Hall of Cells</alias>
<exit alias="west" to="cell">
<inherit name="westdirection" />
</exit>
<object name="frostguard">
<inherit name="editor_object" />
<inherit name="monster" />
<inherit name="male" />
<inherit name="frost_type" />
<alias>Frostguard</alias>
<usedefaultprefix />
<hitpoints type="int">20</hitpoints>
<hurt>The troll staggers back, clearly damaged, but still alive.</hurt>
<death>The troll falls to the ground; it is dead.</death>
<hurtbyelement>The troll staggers back, its skin blackened; it is unable to regenerate the fire damage.</hurtbyelement>
<deathbyelement>The troll falls to the ground burning; it is dead.</deathbyelement>
<ignoreselement>The troll is immune to the effects of frost.</ignoreselement>
</object>
<object name="imp">
<inherit name="editor_object" />
<inherit name="monster" />
<inherit name="male" />
<inherit name="fire_type" />
<alias>Imp</alias>
<usedefaultprefix />
<hitpoints type="int">6</hitpoints>
<hurt>The imp staggers back, clearly damaged, but still alive.</hurt>
<death>The imp falls to the ground; it is dead.</death>
<hurtbyelement>The imp staggers back, its fiery skin has darkened, cooled by your spell.</hurtbyelement>
<deathbyelement>The imp falls to the ground, no longer burning; it is dead and cold.</deathbyelement>
<ignoreselement>The imp ignores the magical fire.</ignoreselement>
</object>
<object name="goblin">
<inherit name="editor_object" />
<inherit name="female" />
<inherit name="monster" />
<alias>Goblin Skulker</alias>
<hurt>The goblin recoils from the blast, hurt, but still very much alive.</hurt>
<death>The goblin lies dead.</death>
<hitpoints type="int">12</hitpoints>
<lookwhendead>It is a dead goblin</lookwhendead>
</object>
</object>
<function name="TestFunction" parameters="obj">
if (DoesInherit (obj, "spell")) {
msg ("This is a spell")
}
</function>
<walkthrough name="test">
<steps type="list">
open spellbook
learn fireball
e
x parchment
cast unlock
learn unlock
cast unlock
e
cast unlock
e
cast fireball
west
learn aura
cast aura
cast unlock
cast aura
east
</steps>
</walkthrough>
</asl>


HK's simple re-creation practice (typing it in, with slight modifications, lol) of Pixie's Spell Library:

<library>

<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 are 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="SpellLearned"><![CDATA["You have learned, and can now cast <i>" + GetDisplayAlias(object) + "</i> spell."]]></dynamictemplate>

<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>

<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_structure.opposedelements, element) + "_type")) {
monster.hitpoints = monster.hitpoints - 2 * 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>

<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>

<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>

<function name="GetElement" parameters="obj" type="string"><![CDATA[
result = Null
foreach (element, element_structure.elements) {
type = element + "_type"
if (DoesInherit (obj, type)) {
result = element
}
}
return (result)
]]></function>

<function name="DescribeCast" parameters="spell"><![CDATA[
if (HasString (spell, "description")) {
msg (DynamicTemplate("SpellCast", spell) + " " + spell.description)
}
else {
msg (DynamicTemplate("SpellCast", spell))
}
]]></function>

<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("SpellLearned", this))
}
else {
msg ("[SpellAlreadyKnown]")
}
]]></learn>
</type>

<type name="attackspell">
<inherit name="spell"/>
<cast type="script"><![CDATA[
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="water_type">
</type>
<type name="air_type">
</type>
<type name="earth_type">
</type>
<type name="dark_type">
</type>
<type name="light_type">
</type>

<type name="monster">
</type>

<object name="element_structure">
<elements type="list">fire; water; air; earth; dark; light</elements>
<opposedelements type="stringdictionary">fire = water;water = fire;air = earth;earth = air;dark = light;light = dark</opposedelements>
</object>

<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>Cancel 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; water_type=Water; air_type=Air; earth_type=Earth; dark_type=Dark; light_type=Light</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; water_type=Water; air_type=Air; earth_type=Earth; dark_type=Dark; light_type=Light</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>

The Pixie
Neonayon wrote:So I've been rummaging through the old Quest documents about how to implement combat, but I think some of it might be outdated and possibly not clear enough for people to follow. Specifically, I ran across some instances that might need updating, and since I'm creating my own combat system following the guide I hope someone can help correct me along the way!

The information comes from this page. http://docs.textadventures.co.uk/quest/ ... types.html

Here is my spell.object

<object name="spell">
<inherit name="editor_object" />
<alias> A Fireball Spell</alias>
<drop type="boolean">false</drop>
<take type="boolean">false</take>
<inventoryverbs type="stringlist">
<value>Cast</value>
</inventoryverbs>
<changedtype>spell</changedtype>
<feature_usegive />
<usedefaultprefix type="boolean">false</usedefaultprefix>
<look type="string"></look>
<usestandardverblist />
<displayverbs type="stringlist">
<value>Learn</value>
</displayverbs>
<learn type="script">
</learn>
<cast type="script">



and here is what that guide is telling me to put.

<type name="spell">
'''<learn type="script">'''
'''if (not this.parent = game.pov) {'''
'''this.parent = player'''
'''msg ("How about that? You can now cast " + this.alias + ".")'''
'''}'''
'''else {'''
'''msg ("Er, you already know that one!")'''
'''}
'''</learn>'''
<drop type="boolean">false</drop>
<take type="boolean">false</take>
</type>

Now I'm a noob at programming and coding. There's no question but looking at these two, I can see some obvious differences, especially some that might intimidate a newcomer to Quest. For one, things don't match up.

For example, <type name="spell">

I am going to assume that type name was changed to <object name="spell"> correct? Or have I misinterpreted this?
Also, following these directions, is this correct? The additions are in bold.

[quote]<object name="spell">
<inherit name="editor_object" />
<alias> A Fireball Spell</alias>
<learn type="script">
if (not this.parent = game.pov) {
msg ("How about that? You can now cast fireballs " + this.alias + ".")
}
"else {
msg ("Er, you already know that spell!")
}
</learn>

<drop type="boolean">false</drop>
<take type="boolean">false</take>
<inventoryverbs type="stringlist">
<value>Cast</value>
</inventoryverbs>
<changedtype>spell</changedtype>
<feature_usegive />
<usedefaultprefix type="boolean">false</usedefaultprefix>
<look type="string"></look>
<usestandardverblist />
<displayverbs type="stringlist">
<value>Learn</value>
</displayverbs>
<learn type="script">
</learn>
<cast type="script">




Now if that isn't correct, then the tutorials need some updating. Would anyone mind helping me out?[/quote]
A type is different to an object. A type describes a set of objects, in this case spells. Your object is a fireball spell, a specific instance of the spell type. To set a fireball spell to be of the type spell, you need a line like this:
    <inherit name="spell" />

Once you have that, then any settings for the spell type will also apply to the fireball object, unless you set them otherwise. That means you can have a LEARN verb on the spell type, and that applies to all the spells.

Anonynn

A type is different to an object. A type describes a set of objects, in this case spells. Your object is a fireball spell, a specific instance of the spell type. To set a fireball spell to be of the type spell, you need a line like this:


<inherit name="spell" />



Does this replace the <inherit name="editor_object" /> ?

I tried to add the <inherit name="spell" /> underneath the editor object thing but it ended up causing the game not to work so I had to remove it.

I understand the concept better too, I'm just not sure where to add what in terms of this...

<object name="spell">
<inherit name="editor_object" />
<alias> A Fireball Spell</alias>
<drop type="boolean">false</drop>
<take type="boolean">false</take>
<inventoryverbs type="stringlist">
<value>Cast</value>
</inventoryverbs>
<changedtype>spell</changedtype>
<feature_usegive />
<usedefaultprefix type="boolean">false</usedefaultprefix>
<look type="string"></look>
<usestandardverblist />
<displayverbs type="stringlist">
<value>Learn</value>
</displayverbs>
<learn type="script">
</learn>
<cast type="script">

Since this is where the webpage I linked before was saying to place it.

Also, thank you HK and Pixie yet again! You guys are my heroes! And yes, HK I would love help, just keep it simple lol!

Oh, Pixie did you get my email a few days ago? Sorry to pester you, just wondering.

HegemonKhan
simplified examples for placement (only the indenting alignment matters, where you place the 'creation' tag blocks vertically, doesn't matter for the most part: the vertical placement of your 'creation' tag blocks doesn't matter after~below the 'game' Object 'creation' tag block):

Using Object Types:

<asl version="550">

<include ref="English.aslx" />
<include ref="Core.aslx" />

<game name="xxx">
<gameid>xxx</gameid>
<version>1.0</version>
</game>

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

<object name="player">
<inherit name="editor_object" />
<inherit name="editor_player" />
<attr name="parent" type="object">room</attr>
</object>

<object name="fireball">
<inherit name="editor_object" />
<inherit name="spell" />
<inherit name="fire" />
<attr name="parent" type="object">xxx</attr>
<alias>A Fireball Spell</alias>
<drop type="boolean">false</drop>
<take type="boolean">false</take>
<feature_usegive />
<usedefaultprefix type="boolean">false</usedefaultprefix>
<look type="string"></look>
<usestandardverblist />
</object>

<type name="fire">
<attr name="elemental" type="string">fire</attr>
</type>

<type name="spell">
<learn type="script">
// blah scripts
</learn>
<cast type="script">
// blah scripts
</cast>
<inventoryverbs type="stringlist">
<value>Cast</value>
</inventoryverbs>
<displayverbs type="stringlist">
<value>Learn</value>
</displayverbs>
</type>

</asl>


NOT using Object Types:

<asl version="550">

<include ref="English.aslx" />
<include ref="Core.aslx" />

<game name="xxx">
<gameid>xxx</gameid>
<version>1.0</version>
</game>

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

<object name="player">
<inherit name="editor_object" />
<inherit name="editor_player" />
<attr name="parent" type="object">xxx</attr>
</object>

<object name="fireball">
<inherit name="editor_object" />
<attr name="parent" type="object">xxx</attr>
<alias>A Fireball Spell</alias>
<drop type="boolean">false</drop>
<take type="boolean">false</take>
<feature_usegive />
<usedefaultprefix type="boolean">false</usedefaultprefix>
<look type="string"></look>
<usestandardverblist />
<attr name="type_of_object" type="string">spell</attr>
<attr name="elemental" type="string">fire</attr>
<learn type="script">
// blah scripts
</learn>
<cast type="script">
// blah scripts
</cast>
<inventoryverbs type="stringlist">
<value>Cast</value>
</inventoryverbs>
<displayverbs type="stringlist">
<value>Learn</value>
</displayverbs>
</object>

</asl>

The Pixie
Neonayon wrote:Oh, Pixie did you get my email a few days ago? Sorry to pester you, just wondering.

I did. the issue about inventory limits looks to be a bug to me, and I am trying to get is acknowledged as such, without much success!
https://github.com/textadventures/quest/issues/816

I will reply properly soon(ish).

Anonynn

Neonayon wrote:
Oh, Pixie did you get my email a few days ago? Sorry to pester you, just wondering.


I did. the issue about inventory limits looks to be a bug to me, and I am trying to get is acknowledged as such, without much success!
https://github.com/textadventures/quest/issues/816

I will reply properly soon(ish).



Sorry, power was out for most of the day, so I apologize for the delayed response!

Wow, is this really the first time it's come up? I would think that it was a strange equipment fluke. Well, if it's too much trouble, Pix you don't have to stress yourself about it. If the option isn't available, or is far too difficult to implement, I can try and figure something else out. I think it would be worth delving into and get it solved but I don't want to cause any shenanigans.

I appreciate you letting me know, and all your research and work! You should have said this was an issue earlier lol! I had no idea I was causing problems.
_____________________________

@HK

I'll take a look and compare what I have to what you put. I definitely want to use types though. It will be far easier in the long run.

I wish I could just create an object "Spell"
and then make a bunch of children, "Fire Ball", "Ice Blast", "Earth Quake", "Shadow Slice", "Luminaire" and "Wind Concussion"

Although, from what it sounds like, that is exactly what types do.

HegemonKhan
you can probably do it that way too, using just (nested) Objects. There's really not too much different in the various designs~methods (Objects, Object Types, Scripting, etc), at least for us, noob coders, but the subtle differences make a big difference if you were trying to make a big professional game.

The Pixie
Neonayon wrote:I wish I could just create an object "Spell"
and then make a bunch of children, "Fire Ball", "Ice Blast", "Earth Quake", "Shadow Slice", "Luminaire" and "Wind Concussion"

Although, from what it sounds like, that is exactly what types do.

It is. This is how Quest implements the object-orientated paradigm.

One approach is to create your fireball spell, and check it is doing all it should. Then create your spell type. Go into code view and find all the bits in fireball that are the same for all spells. Cut-and-paste those into the spell type (just be carefuil to get the star and end tags of the XML). Back to the GUI, set the fireball spell to have the spell type, and check it all works.

Anonynn
So the first step is to create a "Spell Object"?

or for a weapon maybe a "Melee Object"?

HegemonKhan
you make an container Object that will hold the individual spell Objects:

(just as you make a Room Object that holds various Objects, like a table or a bed or etc)

'fire_spellbook' Object // Pixie's magic design concept: a 'spellbook', which holds, 'spells'
-> 'fireball_spell' Object
-> 'inferno_spell' Object
-> 'armageddon_spell' Object

'air_spellbook' Object
-> 'tornado_spell' Object
-> 'gale_spell' Object
-> etc etc etc

etc etc etc

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

so, this first step, is easy, add objects, just like any other objects that have objects inside of them. Nothing special here for this first step.

----------

OR....

if you want to use Object Types, you can do so instead of making 'container' Objects for your spells... though wait for Pixie, to decide which to do for you, if he~she is willing to help you with this stuff.

Using Objects as containers is actually a more powerful~better method, than using Attributes and~or Object Types, as Objects give you the most functionality, compared to Attributes and Object Types, but this for a high-level of design, that Pixie and other good programmers would set up. And, using Objects is easier to understand and work with than Object Types and~or Attributes, but maybe using Object Types and Attributes may work better for you. I'd personally wait for ~let~ Pixie to decide on what would be the best design approach for you to use.

I myself still have an 'Attribute and Object Type' usage mindset still, when I should be converting over to using Objects instead, as they offer more+better functionality, but I've not had the time to do so currently (school work, laughs), but when I get the time, I should start to transition to using Objects.

Anonynn
I have the container ready "spell book" :)

But yes, Object seem pretty straight forward to use. They feel more physical...I'm not sure how to explain that. lol

I'll wait for Pixie though.

HegemonKhan
that's a really good analogy to use, which is very helpful if you're learning to program with the actual languages, when you get to learning about 'Classes' and 'Instantiating instance Objects", laughs.

Think of a Class (or for quest, at the user level, anyways: Object Types), as an imaginary (let's say~use) 'book'. All books have a (keeping this simple) 'maximum_page' and 'current_page' data, and a 'turn_page' action. Now this is an imaginary 'book' Class, so it's kind of hard for me to hold it up to you, and for you to turn its pages, lol. To give our 'book' Class, 'conceptually:physical form' and thus be able to act upon it or use it, we construct (build-up) an Object using the imaginary 'book' Class through special methods (similar to quest's 'Script' Attributes) called a 'constructor' instance method. So, we can create a~n "english_book" Object, a "history_book" Object, a "math_book" Object, and etc. Each of these 'book' Objects will have their 'maximum_pages' set, let's say: english:1000 ~ math: 500 ~ history: 2000, and etc. Maybe you get the idea... kinda... lol. This is somewhat similar to quest's use of the user-level of: Object Types (or shortened form: Types) and Objects.

Classes are just like real classes in real life:

the 'dog' class: all dogs have 4 legs, fur, slobbery mouths, smelly breath~mouths, and etc, ... lol..., and etc

the 'worker' class: all workers have similar conditions

the 'rich', the 'poor', the 'clergy', the 'royal', the 'noble', the 'military', the 'merchants', the 'servants', the 'slaves', the 'people~masses', the 'miners', the 'agrarians~farmers', the 'fishermen', the 'academy~school~university', the 'police', the 'entertainers', the 'scientists', the 'builders~engineers', etc etc etc ...

the 'white' class: all whites have similar conditions

the 'black' class: all blacks have similar conditions

the 'male' class: all males have similar conditions

the 'female' class: all females have similar conditions

etc etc etc

but each individual or unit of these classes, also has unique characteristics or conditions, too

---------

if this scares you, be glad for quest! I would be dead in my 3 programming classes if it wasn't for quest teaching me all of this programming stuff, which I am now able to see quest's similar design~connection to this confusing programming language design, laughs.

I can empirically say that quest is the best way to initially learn to program, as it really helps you to transition into learning the actual languages' designs.

Anonynn
I'm still not sure how to create "types" though.

I mean, I have weapon objects.
Machete
Scissors

and a spell object

but the types is what is confusing. That's why I asked about making group objects like "Melee" and "Spell"

I imagine you make an object type in the attribute part but I'm not sure.

HegemonKhan
you can use Types (Object Types), or instead just Objects (eg: a 'spell_book' container Object, holding 'fireball', 'luminaire', 'etc spell' Objects).

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

if, you want to use the Type (Object Types), an example:

Advanced -> Object Types -> Add -> Name: monster

Advanced -> Object Types -> monster -> Attributes -> Add -> (see below)

(Types ~ Object Types, are just like Objects, except think in terms of broadly, SHARED, group Attributes, we do NOT want any individualistic Attributes)

(Object Type ~ Type, Name: monster)
Attribute Name: dead
Attribute Type: boolean
Attribute Value: false
// 'dead' Boolean is a shared group Attribute, as (we want) all monsters can be killed (alive vs dead states).

we can also add verbs (Script Attributes) too:

(Object Type ~ Type, Name: monster)
Attribute Name: fight
Attribute Type: script
Attribute Value: (blah scripts)
// 'fight' Verb is a shared group Attribute, as (we want) all monsters can be fought against.

---------

now, let's create an individual monster (an Object):

'room' Room Object -> 'Objects' Tab -> Add -> Name: orc_1

-------

now, let's set our individual Object (orc_1) to the 'monster' Type~Object Type, getting all of the Attributes from the 'monster' Type~Object Type:

'room' Room Object -> 'orc_1' Object -> 'Attributes' Tab -> Inherited Attributes -> Add -> monster // type in 'monster' or look for it in the drop down list

now, our 'orc_1' will have the 'dead' and 'fight' Attributes.

------

this was a very brief~simplistic example, but you can add way more Attributes, and have layers of Types~Object Types, for an example:

we could create another Type ~ Object Type, called 'orcs', and Add 'maximum_life' and 'current_life' Int Attributes with the values of '100' and '100, to this 'orc' Type ~ Object Type. These are shared Attributes, as (we want) all orcs have the same initial current life and maximum life at 100.

we then would need to set our 'orc_1' (and additional Objects: 'orc_2', 'orc_3', 'etc ~ which have already been set to the 'monster' Type ~ Object Type) to the 'orcs' Type ~ Object type, as well. Now, our 'orc_1' (and additional 'orc_x' Objects), have 'dead' and 'fight' from the 'monster' Type ~ Object Type, and the 'current_life=100' and 'maximum_life=100' from the 'orcs' Type ~Object Type.

and we want to make another type of monster, say a 'dragon'.

so we create~add our 'dragon_1' Object, and we set it to the 'monster' Type ~ Object Type, as (we want) can fight ('fight') and kill ('dead') all dragons.

however, we don't want dragons to be as fragile~weak as our orcs... so let's make a 'dragon' Type~Object Type, and Add the same 'current_life' and 'maximum_life' to that 'dragon' Type ~Object Type, HOWEVER, we set the Values of 'current_life' and 'maximum_life' to '1000000', instead of '100'.

we then set our 'dragon_1' (and additional 'dragon_x' Objects) to the 'dragon' Type Object Type. So, our 'dragon_1' (and additional 'dragon_x' Objects) have 'dead' and 'fight' from the 'mosnter' Type ~ Object Type, and 'current_life=1000000' and 'maximum_life=1000000' from the 'dragon' Type ~ Object Type.

---------

or, instead of setting our 'orc_x' and 'dragon_x' Objects to the 'monster' Type ~ Object Type, we can set the 'monster' Type ~ Object Type, to the 'dragon' and 'orcs' Types ~ Object Types:

Advanced -> Object Types (Types) -> dragon -> Inherited Attributes -> Add -> (type in 'monster', or find it in the drop down list)

Advanced -> Object Types (Types) -> orcs -> Inherited Attributes -> Add -> (type in 'monster', or find it in the drop down list)

and we'd just set our 'orc_1' to the 'orcs' Type ~ Object Type, and our 'dragon_1' to the 'dragon' Type ~ Object Type

since the 'monster' Type is set~added~inside_of the 'dragon' and 'orcs' Types, the dragon_1 and orc_1 get the 'monster' Type's Attributes, along with their 'dragon' (for the dragon_1) Type's or 'orcs' (for the orc_1) Type's Attributes.

Anonynn
Alrighty! So I did all of that.

Basically I did "Add Object Type", it appeared in the tree of things.

I wrote...

enemy
goblin
naga
centaur
zombie
skeleton
slime
minotaur
animal
human
neko
demon
plant

and gave them all max_life, and current_life ---

Right now, I made them all the same, even though each "specific enemy" will have to be individually added, and adjusted later. For example...

goblin peasant, max_health Int 10
and
goblin warrior max_health Int 10 etc.

Eventually those types will have different health, but it's a start for now.

I also set up the "enemy" thing so they can all "die"

Can I give them strength and defense? How does it calculate how much damage is done etc?


BTW appreciate the walkthrough, that was incredibly clear Mr.HK.

HegemonKhan
one small thing that I forgot, that's really important:

for your Types (and Objects too), use 'this' for the 'Object_name' in your Attribute syntaxes (Object_name.Attribute_name), as 'this' gets the parent~corresponding~correct object for you. It's too hard to explain why (I'm having trouble with figuring out how to explain it)... so just do it!, laughs.

-------

oh yes, you can certainly add in whatever Attributes that you want, strength, defense, (whatever verbs), and etc...

------

your Object's Attributes (adding attributes normally to the object: 'whatever' Object -> 'attributes' Tab -> Attributes -> Add) will OVER-RIDE the Attributes it gets from its Type. So, you can certainly have the Type's strength attribute be set to say 50 (as script: this.strength = 50) (as creation tag: <attr name="strength" type="int">50</attr>), but for one of your individual Objects, you can add a "strength" Attribute, setting it at say 100, which will OVER-RIDE ~ REPLACE the 'strength = 50' from its Type. The Object will have 'strength = 100'.

In looking at this and understanding it, hopefully you can see that there's not too much reason to add an Attribute to your Type, if it's just going to be OVER-RIDDEN by every Object that uses that Type, right? There can be some special-specific such cases, but they are extremely rare. So, this is why you only want to add SHARED CONSTANT Attributes to your Types, as if they're going to be changed on each individual Object anyways (meaning that they're not being used as CONSTANT Attributes), then there's no reason for them on the Type, you just add and set them on your Objects, as they're going to have different values for each Object, and not the same Values, which is the reason of why you have Types to add such Attributes too, so that they can be distributed to all of the Objects that you set to that Type.

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

take for example a 'european' Type:

I add the attribute '<attr name="race" type="string">european</attr>' to the 'european' Type, as all europeans are the race: european
On all of my european npc Objects, I'm not going to change their 'race' to over 'asian' or 'african' or 'american' or 'arabian'.
Thus ' this.race="european" ' is a SHARED CONSTANT, which is a Type's Attribute.

now, let's take the Attribute 'hair_color', do all europeans have the same hair color? NO! european npc1 might have black hair color, european npc2 might have brown hair color, european npc3 might have yellow hair color, etc etc etc. Thus, I'm going to be setting the 'hair color' on each Object.
There's no reason to create a 'hair color' Attribute on my 'european' Type. If I were to do so, and say I set it to "black", then on all of my individual european npc Objects, whom I don't want to have "black" hair, I need to add a "hair color" Attribute anyways to them, and set it to "yellow", "brown", "red", "orange", or whatever that I want each of those european npcs to have. So, there's not really too much reason to create~add that 'hair color=black' on your 'european' Type....

Now, if 95% of your 100 european npc Objects all have "yellow hair" (95 with yellow hair) and the remaining 5% (5) european npc Objects with "black hair", then you would want to add the "hair color=yellow" to your 'european' Type, as you don't want to be adding "hair color = yellow" 95 times (each of your 95 european objects that you want having yellow hair), lol. Only having to add 'hair color=black' to your remaining 5 european npcs.

but if each of those 100 european npcs had a different color hair (pretend along with me, laughs: 100 different colors of hair), then there's no reason to add a 'hair color' attribute to your 'european' Type.

Anonynn
Ooooh, I guess that makes a lot of sense.

Object Types Individual > Object Types Overall

Object Type Overall are useful for universal traits that are shared. Gotcha!

So if you have something like

"Attack"

"Defence"

How does that...get used in the game?

Anonynn
Alrighty! So I made it through the first page, and figured out how to do everything but...

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

On this page which is the page that comes after the "Using Types" tutorial, it's showing the data, and the new modified versions for this particular page. My scripting and such look exactly the same, except for...

<learn type="script"><![CDATA[

^--- what does this line function as?

Also, learn type.

Now in the previous section, here's a link: http://docs.textadventures.co.uk/quest/ ... types.html

it mentions that there are verbs: Learn, and Cast that should be added to each "Spell Type" and I have all of that set up, but is it asking now to make a "Learn Type"?

The Pixie
Quest uses XML to store data. The data is stored as elements, where each element has a name and some content, and can also have a set of attributes (related to, but not the same as the atributes we use in Quest). Each attribute consists of a name and a value. An element might look like this:
<elementname name1="value1" name2="value2">The content</elementname>
^^^^^^^start tag wiith attributes^^^^^^^^^^ ^^^^end tag^^^

So the first bit of that code is the start tag:
<learn type="script">

The element is called learn, and it has one attribute, type, with the value script. The type here has a different meaning to what was discussed earlier. It is telling Quest what type of thing "learn" is, in this case a script. If you look at Quest code you will also see boolean, int, etc. If there is no type attribute, the default is a string.

The second part:
<![CDATA[

This is a special XML code tells Quest that what follows is CDATA. In XML, CDATA is text that contain special characters, most importantly the less-than sign, <. Without that, any less-than sign would be considered part of an XML tag.

If you look to the end of the script, you will see this:
]]></learn>

The first three characters tell Quest the CDATA has ended, and less-than signs are to be treated as part of XML. Then there is the end tag.

Generally you can ignore all this. Quest puts in the CDATA thing when required and sets the type.

Anonynn
Ah, thanks a ton, Pixie! Appreciate it. That's some really complicated stuff!! Wow. I can't believe you guys can read all that and know what the hell is happening. Blows my mind.

Of course, at the same time, there are a lot of scripts and things that I understand easily now that I didn't before. It's been a very steep uphill battle but I'm getting there thanks to everyone's generosity and patience, probably especially so with Pix, and Hk.

I discovered another hard to understand spot. In this link: http://docs.textadventures.co.uk/quest/ ... nced_.html

It says on the player.object you have to add these lines...

<statusattributes type="stringdictionary">status = ;equippedstatus = !</statusattributes>
<equippedstatus>Wielding: nothing</equippedstatus>

Now I know how to do "Status Attributes" on the player.object, and I understand the equippedstatus = ! part (that will show up on the right pane in game, and display whatever you put in that slot, essentially.

But I don't understand how to get the "Status Attributes" to display a string dictionary, and I'm not clear if the equippedstatus is something entirely different or not. See..

In the player.object, Status Attributes it has...

Key Value
strength Strength: ! <--- and this displays on the right pane in game.

So my question is...

Is this set up like this?

Key Value
equippedstatus equippedstatus: !

I apologize...just really confused by this part.

HegemonKhan
the built-in 'statusattributes' (the GUI~Editor's STATUS ATTRIBUTES) is a Stringdictionary Attribute.

Attribute Types: string, int (integer), double, object (not to be confused with the Object Element), script, boolean, list (stringlist and objectlist), dictionary (stringdictionary, objectdictionary, scriptdictionary), and etc

see if this thread help you (scroll down a ways for the part on dictionaries ~ you may need to read the list part too, as I do most of my explaining in the lists part, dictionaries are somewhat similar to lists):

viewtopic.php?f=18&t=5137

-------

I'm not sure what you are asking about with 'attack' and 'defense' ??? in regards to using Types, or just about their usage as integer~double Attributes?

sorry, I didn't respond to this earlier.

-----

in code, there's the 'creation' tag code lines~blocks, for example:

<object name="xxx">
// body~contents
</object>


in code, to tell quest that you want to use the '<', '>', and etc symbols, for 'greater than' and 'lesser than' instead of for~as the 'creation' tags, you need to enclose them within this:

<![CDATA[
// scripting with the '< (lesser than)' and '> (greater than)' symbols used for logic-math comparisons
]]>


for example, no need for the 'CDATA' tags:

<function name="addition_function" type="int" parameters="A,B">
return (A+B)
</function>
// function call: addition_function(5,10)
// outputs~returns: 15


whereas, the need for the 'CDATA' tags:

<function name="game_over_function"><![CDATA[
if (player.current_life <= 0) {
msg ("You died.")
msg ("GAME OVER")
finish
}
]]></function>

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

using these examples:

<statusattributes type="simplestringdictionary">status = ;equippedstatus = !</statusattributes>

the KEY is to the left of the equals (=) sign.
the VALUE~EXPRESSION is to the right of the equals (=) sign.
the semicolon separates the items (KEY1=VALUE1; KEY2=VALUE2; etc etc etc)

KEYS:

status
equippedstatus

VALUES:
(empty, default Value display)
! (represents the Attribute's Value)

---

strength Strength: !

<statusattributes type="simplestringdictionary">strength = Strength: !</statusattributes

KEY:

strength

VALUE~EXPRESSION:

Strength: !

-----

for horizontal form, you use: type="simplestringdictionary"
for vertical form, you use: type="stringdictionary"

------

this:

<equippedstatus>Wielding: nothing</equippedstatus>

is a String Attribute, not a Stringdictionary Attribute.

unless it is a special scripting (like the special "changed" script), it's been a long time since I've worked with Status Attributes, and Equipment Stuff ~ Libraries of Pixie~Chase~Pertex.

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

Lists and Dictionaries are a way to store multiple values into a single Variable name:

[code]<attr name="color_list" type="simplestringlist">red;blue;yellow;green;orange;purple;black;white</attr>

// conceptually:

color_list = {
red
blue
yellow
green
orange
purple
black
white
}

<attr name="season_dictionary" type="simplestringdictionary">january=winter; february=winter; march=spring; april=spring; may=spring; june=summer; july=summer; august=summer; september=autumn; october=autumn; november=autumn; december=winter</attr>

// conceptually:

season_dictionary = {
january = winter
february = winter
march = spring
april = spring
etc etc etc
}


whereas all of the other Attribute Types only store a single Value into a single Variable name, for examples:

<attr name="alias" type="string">HK</attr>
<attr name="dead" type="boolean">false</attr>
<attr name="strength" type="int">100</attr>
<attr name="right_hand" type="object">sword</attr>

Script Attributes, are well, Scripts ~ Scripting, so they're different from the other Attributes.

--------

by having multiple Values, you can iterate~cycle~select the Value that you want, letting you do lots of really cool things, lots of application usage.

https://docs.oracle.com/javase/tutorial ... rrays.html (1 row arrays are lists: 1 row tables)
https://chortle.ccsu.edu/java5/Notes/ch ... 49C_3.html (2+ row arrays are similar to dictionaries. 2 row tables: a normal table, like a multiplication table)
http://www.tutorialspoint.com/python/py ... ionary.htm (sorry, this is a code-technical explanation of dictionaries, will probably be hard to understand ~ and the syntax is obviously different than quest is at the user's level)

------

Python is much more popular in Europe, and Quest (being european made, lol) seems to follow a lot of Python's language structure, as I'm just learning through my Python school class.

Anonynn
Thanks for the response, HK. I'm like all over the forum boards right now with a million questions. I can't wait to get the last of these systems in place so I can just focus on the game and it's content. Ugh!

Anyway! So I followed all of that so far, and read more of the page: http://docs.textadventures.co.uk/quest/ ... nced_.html

But I'm stuck again, naturally.

I have four "types" right now...

enemy (Monster)
spell (Spells)
melee (Physical Weapons)
attackspell (Attack Spells)

and three weapons...

Fists
Scissors
Rickety Machete

and a couple of spells...

fire ball
ice blast
earth quake
shadow slice
luminaire
wind concussion
minor heal

I've followed the page link above pretty closely, except where it mentions setting up tabs because that is way out of my scope of understanding at the moment, but I am still getting a lot of errors, and items still aren't working. Like, for example...

Error running script: Error compiling expression '"You put away your " + game.pov.equipped.alias + " and draw your " + this.alias + "."': Object reference not set to an instance of an object.

I got to the part on the linked page where it talks about "fists" and the four control types. It says everything should be working but it doesn't. Sigh.

I think I need Pixie to look over those items and see what I'm doing wrong.

HegemonKhan
your weapons are individual Objects right?

<object name="Fists">
<inherit name="melee" />
<attr name="alias" type="string">fists</attr>
</object>

<object name="Scissors">
<inherit name="melee" />
<attr name="alias" type="string">scissors</attr>
</object>

<object name="Rickety_Machete">
<inherit name="melee" />
<attr name="alias" type="string">machete</attr>
</object>

// and for your 'player' Object:

<object name="player">
<attr name="equipped" type="object">Fists</attr>
// or, you may want~need to use an Objectlist Attribute, as I believe you're not using a single equipment item for your character, right?:
// <attr name="equipped" type="objectlist">Fists;Shirt;Pants;Socks;Shoes</attr>
// we can help you with using Objectlists Attributes.
</object>


game.pov.equipped: your 'player' Player Object needs the "equipped" Object Attribute added to it, else ERROR!
game.pov.equipped.alias: your weapon Object needs an 'alias' String Attribute added to it, else ERROR!

--------

also, if you use 'game.pov' then you need to in the GUI~Editor (or code), to set (and maybe toggle on, too) the 'pov' to the 'player' Player Object. I believe its within the 'features' and~or 'player' Tab(s) of the Game Object and~or in the Player Objects, within the 'features' and~or 'player' Tab(s)

game.pov <=== your currently controlled Player Object, which is usually (and only) the default 'player' Player Object,

http://docs.textadventures.co.uk/quest/ ... bject.html (looking to see if there's a better, more informative link on the 'pov' feature)

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

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

http://blog.textadventures.co.uk/2012/1 ... available/ (scroll down to the section: Game Behavior ~ New Things)

http://blog.textadventures.co.uk/2012/0 ... quest-5-3/ (here's the notes about it)

--------

the error code is saying that your scripting requires Objects (for the 'this' to get~represent the parent~corresponding Object: this.alias, or: game.pov.equipped.alias), and you don't have those Objects (or don't have the Attributes added to those Objects).

-------

The 'Controls~Tabs' are for creating the GUI~Editor's Tabs (just like the default GUI~EDitor's Tabs allow you to add Objects, Attributes, Functions, Exits, Room types, container types, edible-ness, switchable: on-off, open~close-able, and etc), which you can then use to build up your game, through Pixie's created GUI~Editor's Tabs for equipment and spells and etc. Instead of coding in your entire game equipment and magic and etc systems, Pixie sets up the Controls~Tab for being able to use the GUI~Editor.

Anonynn
Yup, all the weapons are individual objects, and all of them have aliases.

The Player.Object has an "Attribute" ---> 'equipped" and for the value of that it reads: fists, rickety_machete, scissors.

The only single equipment I am using is for the weapons. The player is allowed one weapon at a time; either a melee weapon or the spellbook if/when they acquire it.

Clothing is handled with Chase's Wearables Library (which has been fixed)

game.pov.equipped.alias: your weapon Object needs an 'alias' String Attribute added to it, else ERROR!


^----- is this the weapon alias? If not, I'm not sure what that is or how to find it.

And I think the game.pov is set to the Player Object. In the Game.Object under "Attributes" it says, pov ----> Object: player
There is another one too. "Attributes" it says, changedpov ----> InitPOV (oldvalue, game.pov) which is a function.

the error code is saying that your scripting requires Objects (for the 'this' to get~represent the parent~corresponding Object: this.alias, or: game.pov.equipped.alias), and you don't have those Objects (or don't have the Attributes added to those Objects).



Here's what I have in each "melee type" object.

Equip

if (this.parent = game.pov) {
if (not game.pov.equipped = fists and not game.pov.equipped = null) {
msg ("You put away your " + game.pov.equipped.alias + " and draw your " + this.alias + ".")
}
else {
msg ("You draw your " + this.alias + ".")
}
game.pov.equipped = this
this.inventoryverbs = Split ("Look at;Drop;Unequip", ";")
game.pov.equippedstatus = "Wielding: " + this.alias
}
else {
msg ("<br/>You dont have it.<br/>")
}


and Unequip

if (this.parent = game.pov) {
msg ("You put away your " + game.pov.equipped.alias + ".")
game.pov.equipped = fists
this.inventoryverbs = Split ("Look at;Drop;Equip", ";")
game.pov.equippedstatus = "Wielding: nothing"
}
else {
msg ("You don't have it.")
}


I also have this for my player.object "Status Attributes" regarding the equipped status'

equippedstatus -----> wielding: nothing

status ------> equippedstatus: !

^--- but those aren't working either.

HegemonKhan
sighs... it's been awhile since I studied Pixie's equipment~combat library... it'd be faster for Pixie to help you with this stuff, as I'd have to re-study it, which I don't have the time for right now... (mid-terms + school work~labs).

it seems that the 'equipped' Attribute is an Object Attribute, meaning it can only hold 1 equipment item at a time, which would work fine, if you use it only for your weapons, and let Chase's Attributes~etc handle your armor~clothing.

so, for this:

The Player.Object has an "Attribute" ---> 'equipped" and for the value of that it reads: fists, rickety_machete, scissors.

first, you need to find its 'creation' tag in Pixie's library, to find what Attribute Type it is (as I can't tell from the line above):

<attr name="equipped" type="object">xxx</attr> ~~~~ Object Attribute (see the: type="object"): can only hold 1 item: you got to delete out the other two weapons, as it's not a List Attribute
~OR~
<attr name="equipped" type="objectlist">xxx</attr> ~~~~ Object LIST Attribute (see the: type="objectlist"): this makes it a list, which means you can hold multiple items in it, and have to use the 'list add' and 'list remove' Scripts to add~remove items to~from the list.

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

"game.pov.equipped.alias: your weapon Object needs an 'alias' String Attribute added to it, else ERROR! (HK)"

"^----- is this the weapon alias? If not, I'm not sure what that is or how to find it. (Neonayon)"

yes, this would be the weapon Object's 'alias' Attribute, so just make sure each of your weapon Objects have an 'alias', as this script checks for it, so if it's (the alias) not there~added to your weapon Object, you get an Error.

think of the script ( game.pov.equipped.alias ) as this:

player's weapon's alias

--------

yep, looks like you got the game.pov ~ pov set up correctly.

-------

the last thing that can cause the errors, is that your 'equippedstatus' String Attribute (or whatever it is, Pixie's got to help you with this, as I'm not sure what is going on with it) and~or the 'equipped' (object or objectlist) Attribute isn't set up right, which it needs to be, as the scripts use it for checking.

Anonynn
Oh, I'm not using Pixie's Combat Library. Although, he/she has the library set-up really well, I need something a little more simple, that I can manage. I couldn't even make heads or tails of Pix's library the last time I looked at it. He/she really knows his stuff. I think I annoyed the crap out of him/her with questions about Quest though...

I just started from the Quest libraries the "Simple Combat Advanced" as well as the "Types Page" and the other. I'm about halfway down the Simple Combat Advanced page now. But yes, I essentially just wanted Chase's library to handle clothing, and armor, while the one I'm making now will handle weapons and combat.

Error running script: Error compiling expression '"You put away your " + game.pov.equipped.alias + " and draw your " + this.alias + "."': Object reference not set to an instance of an object.

^--- still getting this error as well. It sounds like it's referring to something that is supposed to be there after the equipped weapon is sheathed...which should be fists.

The player.object "status attributes" are...

equippedstatus -----> wielding: nothing
status ----------------> equippedstatus: !

And here is the coding for what it's talking about in the error.

This is the "Unequip Verb"
if (this.parent = game.pov) {
msg ("You put away your " + game.pov.equipped.alias + ".")
game.pov.equipped = fists
this.inventoryverbs = Split ("Look at;Drop;Equip", ";")
game.pov.equippedstatus = "Wielding: nothing"
}
else {
msg ("You don't have it.")
}


"Equip Verb"
if (this.parent = game.pov) {
msg ("You put away your " + game.pov.equipped.alias + ".")
game.pov.equipped = fists
this.inventoryverbs = Split ("Look at;Drop;Equip", ";")
game.pov.equippedstatus = "Wielding: nothing"
}
else {
msg ("You don't have it.")
}


Can't see to figure it out...

HegemonKhan
the 'Simple Combat Advanced' and 'Type Page' on the quest doc site, are also Pixie's writings :lol:

so, Pixie is more able to help you then I am, as he~she is familar with this design structure, as it's his~her own, lol.

(we may need to see your entire game code, to be able to help you fix up these issues)

the below probably won't help with your main issues, these are just a some other things that I've noticed.

---------

in your PLAYER'S* STATUS ATTRIBUTES, change it to this:

* (I'm just making sure you're not using the: 'game' Object -> 'attributes' tab -> Status Attributes)

equippedstatus -----> !

aka:

key: equippedstatus
value: !

-------

for the 'unequip' Verb, change it to this:

if (this.parent = game.pov) {
msg ("You put away your " + game.pov.equipped.alias + ".")
game.pov.equipped = this.name
this.inventoryverbs = Split ("Look at;Drop;Unequip", ";")
game.pov.equippedstatus = "Wielding: " + this.alias
}
else {
msg ("You don't have it.")
}

Anonynn

in your PLAYER'S* STATUS ATTRIBUTES, change it to this:

* (I'm just making sure you're not using the: 'game' Object -> 'attributes' tab -> Status Attributes)



Hey, never hurts to check. Like I.T guys who ask the people if the computer is plugged in! LOL.

So I applied all your changes...but still none of the equip or unequip features, nor the Status Attributes is working.

Here is the equip error code.

Error running script: Error compiling expression '"You put away your " + game.pov.equipped.alias + " and draw your " + this.alias + "."': Object reference not set to an instance of an object.

and here is the unequip error code.

Error running script: Error compiling expression '"You put away your " + game.pov.equipped.alias + "."': Object reference not set to an instance of an object.

Also, equipped status -----> ! (isn't showing up on the user pane.

The Pixie
Sounds like game.pov.equipped has not been set. Might be worth checking the spelling of "equipped" where it is supposed to be set. You could also put in a "msg" after the line where equipped is supposed to get set, to see if Quest gets to that line.

Pertex
No, this can't work. "game.pov.equipped" is a string attribute and does not have an alias attribute. Try the following

if (this.parent = game.pov) {
x=GetObject(game.pov.equipped)
msg ("You put away your " + x.alias + ".")
...

Anonynn

Sounds like game.pov.equipped has not been set. Might be worth checking the spelling of "equipped" where it is supposed to be set. You could also put in a "msg" after the line where equipped is supposed to get set, to see if Quest gets to that line.



I double checked just now and everything seems to be spelled correct in all the right places. I've been extra careful about spelling after all the help you've given me :)

No, this can't work. "game.pov.equipped" is a string attribute and does not have an alias attribute. Try the following

Code: Select all
if (this.parent = game.pov) {
x=GetObject(game.pov.equipped)
msg ("You put away your " + x.alias + ".")
...



I tried to apply that in both the "Equip" and "Unequip" verbs but this error came up...

Equip
Error running script: Error compiling expression 'GetObject(game.pov.equipped)': FunctionCallElement: Could find not function 'GetObject(QuestList`1)'

and the same error for "Unequip"

Here are the codes just in case I filled it in incorrectly...
Unequip
if (this.parent = game.pov) {
x = GetObject(game.pov.equipped)
msg ("You put away your " + x.alias + ".")
game.pov.equipped = this.name
this.inventoryverbs = Split ("Look at;Drop;Unequip", ";")
game.pov.equippedstatus = "Wielding: " + this.alias
}
else {
msg ("You don't have it.")
}


Equip

if (this.parent = game.pov) {
x = GetObject(game.pov.equipped)
msg ("You put away your " + x.alias + ".")
game.pov.equipped = this.name
this.inventoryverbs = Split ("Look at;Drop;Unequip", ";")
game.pov.equippedstatus = "Wielding: " + this.alias
}
else {
msg ("You don't have it.")
}


Sorry about all the trouble :( I'm sure it's a very tiny error happening on my part.

Pertex
Then there must be another place where game.pov.equipped is set. The error message "Could find not function 'GetObject(QuestList`1)'" says that equipped is a list, but if you set
game.pov.equipped = this.name

equipped is a string

HegemonKhan
I think neonayon wanted to use the 'equipped' as an Object Attribute, as this is only going (is supposed to) hold a single weapon. Also, working with lists (objectlists) would probably be too difficult for her currently, I think (I'd love to be wrong, impress me neonayon!, lol, hehe).

I told her to use the '= this.name' (or would it just be: this, and not this.name ???) as I thought 'equipped' was an Object Attribute.

I didn't know that the 'equipped' is currently setup as a (Stringlist or Objectlist, which is it?), my apologies, neonayon!

would it (aka: game.pov.equipped.alias) work if 'equipped' was setup as an Object Attribute ???

------

also, in the code you posted, you can't have both your 'unequip' and 'equip' Verbs setting your 'inventoryverbs' to 'unequip' (or to 'equip'), the 'equip' verb must set the 'inventoryverb' to 'unequip' and the 'unequip' verb must set the 'inventoryverb' to 'equip'

think of it this way:

if you just put on your top (you just clicked on the 'equip' verb of your top), your (new) choice-option-verb with the (now worn~wearing) top is to now be able to take off your top, obviously (if you already got your top on, it's impossible to put your top on again, as it is already on you, lol).

if you just took off your top (you just clicked on the 'unequip' verb of your top), your (new) choice-option-verb with the (now removed-unworn) top is to now be able to put on your top, obviously (if you aren't wearing the top, then it's impossible to take off the top, as it is already off of your body, lol)

as you put on and take off your top, we need to switch-replace between the verbs 'equip' and 'unequip'

think of it as a circle, allowing us to continually be able to equip and unequip, which is what we obviously want, lol

go in clockwise direction (and draw a diagonal line from the upper left to the lower right ~ too hard for me to try to draw it via typing, lol):

conceptual:

............... wearing top
............../...............\
equip verb.................unequip verb
..............\................/
..............not wearing top

code implementation:

...........................wearing top.
......................../.................\
....add equip verb.....................add unequip verb
............and................................and
remove unequip verb.............remove equip verb
.........................\................../
..........................not wearing top

diagonal line example (best I can do, lol):

\.... wearing top
.\.................\
..\.................unequip verb
...\................/
....\
.....\
......\
.......\
........\
.........\
..........\
...........\
............\
.............\
..............\
...............\
................\
equip verb.\
.....\............\/
not wearing.\
top................\

(apply the same cut, to the 'code implementation' drawing too)

The Pixie
HegemonKhan wrote:I think neonayon wanted to use the 'equipped' as an Object Attribute, as this is only going (is supposed to) hold a single weapon. Also, working with lists (objectlists) would probably be too difficult for her currently, I think (I'd love to be wrong, impress me neonayon!, lol, hehe).

I told her to use the '= this.name' (or would it just be: this, and not this.name ???) as I thought 'equipped' was an Object Attribute....

It should be:
game.pov.equipped = this

While "this" indicates the object itself, this.name is a string containing its name.

No need for a list here; Pertex was pointing out that for some reason game.pov.equipped is already getting to to a list.

It looks like this line:
x = GetObject(game.pov.equipped)

... is generating this error:
Error running script: Error compiling expression 'GetObject(game.pov.equipped)': FunctionCallElement: Could find not function 'GetObject(QuestList`1)'

... which indicates game.pov.equipped is currently a list.

Anonynn
Okay! So I tried to fix the problem by redoing the code before Pertex suggested that I used the other way the "x = etc."

Here are the current...
Equip

if (this.parent = game.pov) {
x = GetObject(game.pov.equipped)
if (not game.pov.equipped = fists and not game.pov.equipped = null) {
msg ("You put away your " + x.alias + " and draw your " + x.alias + ".")
}
else {
msg ("You draw your " + x.alias + ".")
}
game.pov.equipped = this
this.inventoryverbs = Split ("Look at;Drop;Unequip", ";")
game.pov.equippedstatus = "Wielding: " + x.alias
}
else {
msg ("<br/>You dont have it.<br/>")
}


Error running script: Error compiling expression 'GetObject(game.pov.equipped)': FunctionCallElement: Could find not function 'GetObject(QuestList`1)'

Unequip

if (this.parent = game.pov) {
x = GetObject(game.pov.equipped = this)
msg ("You put away your " + x.alias + ".")
game.pov.equipped = this.name
this.inventoryverbs = Split ("Look at;Drop;Unequip", ";")
game.pov.equippedstatus = "Wielding: " + this.alias
}
else {
msg ("You don't have it.")
}


Error running script: Error compiling expression 'GetObject(game.pov.equipped = this)': FunctionCallElement: Could find not function 'GetObject(Boolean)'

Argh!

I did copy-paste the code directly from this page: http://docs.textadventures.co.uk/quest/ ... nced_.html

if (this.parent = game.pov) {
if (not game.pov.equipped = fists and not game.pov.equipped = null) {
msg ("You put away your " + game.pov.equipped.alias + " and draw your " + this.alias + ".")
}
else {
msg ("You draw your " + this.alias + ".")
}
game.pov.equipped = this
this.inventoryverbs = Split ("Look at;Drop;Unequip", ";")
game.pov.equippedstatus = "Wielding: " + this.alias
}
else {
msg ("You don't have it.")
}
]]></equip>
<unequip type="script"><![CDATA[
if (this.parent = game.pov) {
msg ("You put away your " + game.pov.equipped.alias + ".")
game.pov.equipped = fists
this.inventoryverbs = Split ("Look at;Drop;Equip", ";")
game.pov.equippedstatus = "Wielding: nothing"
}
else {
msg ("You don't have it.")
}

Does this help everyone figure out what idiotic error I made :( ?

The Pixie
I have added comments to you code to tell you what you need to correct.
if (this.parent = game.pov) {
// you do not need the next line (or any reference to x)
// the error is because GetObject expects a string, and you have sent it an object
x = GetObject(game.pov.equipped)
if (not game.pov.equipped = fists and not game.pov.equipped = null) {
// in the next line you are telling player he puts something away, and then draws the same thing here!
msg ("You put away your " + x.alias + " and draw your " + x.alias + ".")
// he should be putting away player.pov.equipped.alias
// and drawing this.alias
}
else {
// again, he should be drawing this.alias
msg ("You draw your " + x.alias + ".")
}
// next to lines you get it right
game.pov.equipped = this
this.inventoryverbs = Split ("Look at;Drop;Unequip", ";")
// but again, he should be drawing this.alias
game.pov.equippedstatus = "Wielding: " + x.alias
}
else {
msg ("<br/>You dont have it.<br/>")
}

You need to keep straight what are objects and what are strings, and what objects you are dealing with. The game.pov.equipped attribute is an object, so you do not need to use GetObject to get te object.

What was wrong with what you copy-and-pasted that made you change it?

HegemonKhan
ah, I think the original culprit in all of this was that initially neonayon was using this:

(Pixie's comment on noticing this error: // in the next line you are telling player he puts something away, and then draws the same thing here!)
msg ("You put away your " + x.alias + " and draw your " + x.alias + ".")

which Pertex tried to fix the error of it (from looking at the game.pov.equipped.alias that got messed up from the above line of neonayon's), and then I further messed up neonayon too with my posts. If I got down the correct history of our attempt at fixing this issue for neonayon, lol.

Anonynn
Well.....one part of the problem is kind solved but something is still pretty wonky.

So the equip still isn't working. It's saying...

Equip

if (this.parent = game.pov) {
if (not game.pov.equipped = fists and not game.pov.equipped = null) {
msg ("You put away your " + player.pov.equipped.alias + " and draw your " + this.alias + ".")
}
else {
msg ("You draw your " + this.alias + ".")
}
game.pov.equipped = this
this.inventoryverbs = Split ("Look at;Drop;Unequip",";")
game.pov.equippedstatus = "Wielding: " + this.alias
}
else {
msg ("<br/>You dont have it.<br/>")
}


Error running script: Error compiling expression '"You put away your " + player.pov.equipped.alias + " and draw your " + this.alias + "."': Object reference not set to an instance of an object.

The Unequip works, only there are two verbs of it...and then once I click "Unequip" the "Status Attribute" equippedstatus: Wielding: nothing suddenly appears and becomes... equippedstatus: Wielding: Rickety Machete

So that is a little backwards I guess?

Here's the code for Unequip.

if (this.parent = game.pov) {
if (not game.pov.equipped = fists and not game.pov.equipped = null) {
msg ("You put away your " + player.pov.equipped.alias + " and draw your " + this.alias + ".")
}
else {
msg ("You draw your " + this.alias + ".")
}
game.pov.equipped = this
this.inventoryverbs = Split ("Look at;Drop;Unequip",";")
game.pov.equippedstatus = "Wielding: " + this.alias
}
else {
msg ("<br/>You dont have it.<br/>")
}

The Pixie
Do you have a fists object? If you do, make sure player.equipped is set to that object on the attributes tab. If not create one, and then set it.

With regards to unequip, you have a line:
game.pov.equippedstatus = "Wielding: " + this.alias
So if you unequip something with the alias "Rickety Machete", the status will become "Wielding: Rickety Machete"

Again I have to ask, what was wrong with what you copy-and-pasted that made you change it? Because a lot of your errors seem to be due to those changes.

Anonynn
Sorry to give you headaches, Pixie. But at least I'm learning a lot of coding very quickly!

I originally tried to get help with the coding because this...

Equip
if (this.parent = game.pov) {
if (not game.pov.equipped = fists and not game.pov.equipped = null) {
msg ("You put away your " + game.pov.equipped.alias + " and draw your " + this.alias + ".")
}
else {
msg ("You draw your " + this.alias + ".")
}
game.pov.equipped = this
this.inventoryverbs = Split ("Look at;Drop;Unequip", ";")
game.pov.equippedstatus = "Wielding: " + this.alias
}
else {
msg ("<br/>You dont have it.<br/>")
}


Unequip

if (this.parent = game.pov) {
msg ("You put away your " + game.pov.equipped.alias + ".")
game.pov.equipped = fists
this.inventoryverbs = Split ("Look at;Drop;Equip", ";")
game.pov.equippedstatus = "Wielding: nothing"
}
else {
msg ("You don't have it.")
}


Weren't working at all, and were producing this error....

Error running script: Error compiling expression '"You put away your " + game.pov.equipped.alias + " and draw your " + this.alias + "."': Object reference not set to an instance of an object.

And people were suggesting a few different options.

Do you have a fists object? If you do, make sure player.equipped is set to that object on the attributes tab. If not create one, and then set it.



I do have a "fists" object.

and the player.equipped (attribute) reads: fists, rickety_machete, scissors

Should it just be "fists"?

game.pov.equippedstatus = "Wielding: " + this.alias



Just curious...but if I "unequip" a weapon, the game shouldn't think that I still have that weapon wielded, right? It should default to "fists." I imagine this script should happen when I equip something...not unequip. Just trying to understand! :D

I thought I might have two "unequips" because I made the verbs: equip and unequip on the weapons, and in the coding it has...

this.inventoryverbs = Split ("Look at;Drop;Unequip",";")

So I thought that might be causing two different unequips to show up?

The Pixie

...
and the player.equipped (attribute) reads: fists, rickety_machete, scissors
...


Somehow player.equipped is a list. The code you have shown us only sets it to an object, so there is something else messing it up. Try going to tools - Code view, then do [CTRL]-F, and search for equipped, and see if anything else is giving it a value.

Anonynn
I don't see anything else giving it a value except for...

<equipped type="stringlist">
<value>fists</value>
<value>rickety_machete</value>
<value>scissors</value>
</equipped>

the rest of the <i>equipped</i> mentions are either in description text of items, or have to do with the equip or unequip of the weapons themselves that we've been working on.

The Pixie
That is it. You are setting up to be a string list. Look at the attributes tab of the player object, you will see it there. Change it to be an object, than point it at your fists object.

Anonynn
> equip Rickety Machete
Error running script: Error compiling expression '"You put away your " + player.pov.equipped.alias + " and draw your " + this.alias + "."': Object reference not set to an instance of an object.

But the Status Attribute works, although when I unequip the machete it still doesn't replace machete with fists.

I changed the fists thing too like you said.

So this error says that .....I need to set something else as an Object?

The Pixie
"You put away your " + player.pov.equipped.alias + " and draw your " + this.alias + "."

It is game.pov.equipped.alias or player.equipped.alias, not player.pov.equipped.alias (and if you are doing it for yourself and will never want to swap characters in game, I would stick to player, rather than game.pov)

Anonynn
Fantastic! That fixed the equip and unequip, thank you so much Pix! I don't see anymore errors happening, except, the "Status Attribute" even when the item dropped reads that the item is still being "wielded"

Here's the coding for that.

equippedstatus !


Is there a reason the machete is staying in the slot and not defaulting to "fists?"

HegemonKhan
it seems like you got everything working, except when you change your weapons, you don't have all of the correct 'equippedstatus' msg scripts included.

the 'Fists' weapon Object is (or is suppose to be) your default~"naked ~ no-weapon" weapon Object.

your initial setting (presuming~asssuming) should be to have your Fists equipped (and you'll find the knife, machete, etc later on in game progression):

<object name="player">
<attr name="equipped" type="object">Fists</attr>
</object>


Equip Fists:

player.equipped = Fists

player.equippedstatus = this.alias + "(Equipped)"
// output: Fists (Equipped)

Unequip Fists:

(this should not exist)

Equip Knife:

player.equipped = Knife

player.equippedstatus = this.alias + "(Equipped)"
// output: Knife (Equipped)

Unequip Knife:

player.equipped = Fists

player.equippedstatus = this.alias + "(Equipped)"
// output: Fists (Equipped)

Equip Machete:

player.equipped = Machete

player.equippedstatus = this.alias + "(Equipped)"
// output: Machete (Equipped)

Unequip Machete:

player.equipped = Fists

player.equippedstatus = this.alias + "(Equipped)"
// output: Machete (Equipped)

Anonynn

Equip Fists:

player.equipped = Fists

player.equippedstatus = this.alias + "(Equipped)"
// output: Fists (Equipped)

Unequip Fists:

(this should not exist)



So I went ahead and deleted the "equip" code on the fists and replace it with...

player.equipped = "fists"
player.equippedstatus = this.alias + "(equipped)"

Is this correct?


Equip Knife:

player.equipped = Knife

player.equippedstatus = this.alias + "(Equipped)"
// output: Knife (Equipped)

Unequip Knife:

player.equipped = Fists

player.equippedstatus = this.alias + "(Equipped)"
// output: Fists (Equipped)



if (this.parent = game.pov) {
if (not game.pov.equipped = fists and not game.pov.equipped = null) {
msg ("You put away your " + player.pov.equipped.alias + " and draw your " + this.alias + ".")
}
else {
msg ("You draw your " + this.alias + ".")
}
game.pov.equipped = this
this.inventoryverbs = Split ("Look at;Drop;Unequip",";")
game.pov.equippedstatus = "Wielding: " + this.alias
}
else {
msg ("<br/>You dont have it.<br/>")
}


^ do I add that "knife" example into the machete? Not the actual knife part but replace knife with machete?

HegemonKhan
oops... my bad...

replace my usage of: player.equippedstatus = this.alias + "(equipped)"
// output: (Fists or Knife or Machete) (equipped)

with your usage of: game.pov.equippedstatus = "Wielding: " + this.alias
// output: Wielding: (Fists or Knife or Machete)

(both are just different ways of saying the same thing)

I forgot that your 'equippedstatus' was the: "Wielding: " + this.alias, and for some reason thought it was: this.alias + "(equipped)", lol

-----------

Neonayon wrote:if (this.parent = game.pov) {
if (not game.pov.equipped = fists and not game.pov.equipped = null) {
msg ("You put away your " + player.pov.equipped.alias + " and draw your " + this.alias + ".")
}
else {
msg ("You draw your " + this.alias + ".")
}
game.pov.equipped = this
this.inventoryverbs = Split ("Look at;Drop;Unequip",";")
game.pov.equippedstatus = "Wielding: " + this.alias
}
else {
msg ("<br/>You dont have it.<br/>")
}


'Equip' Verb (use this code for all of your weapons'  'Equip' Verbs):

if (this.parent = game.pov) {
if (not game.pov.equipped = Fists) {
previous_weapon_alias = game.pov.equipped.alias
game.pov.equipped = this
game.pov.equippedstatus = "Wielding: " + game.pov.equipped.alias
this.inventoryverbs = Split ("Look at;Drop;Unequip",";")
msg ("You put away your " + previous_weapon_alias + " and draw your " + game.pov.equipped.alias + ".")
} else {
msg ("You already are equipped with just your " + Fists.alias + ".")
}
}
else {
msg ("<br/>You dont have it.<br/>")
}


and

'Unequip' Verb (use this code for all of your weapons'  'Unequip' Verbs, EXCEPT for your 'FISTS' weapon as it doesn't have an 'Unequip' Verb*):

// * Whenever you unequip your other weapons, their 'Unequip' Verb's code, will equip the 'Fists' weapon, so this is why there's no 'Unequip' Verb for the 'Fists' weapon

if (this.parent = game.pov) {
// I removed the if, as it's not needed, due to the verb in 'inventoryverbs'
game.pov.equipped = Fists
game.pov.equippedstatus = "Wielding: " + game.pov.equipped.alias
this.inventoryverbs = Split ("Look at;Drop;Equip",";")
msg ("You put away your " + this.alias + " and draw your " + game.pov.equipped.alias + ".")
// I removed the else, as it's not needed, due to switching the verb in 'inventoryverbs'
}
else {
msg ("<br/>You dont have it.<br/>")
}

Anonynn

if (this.parent = game.pov) {
if (not game.pov.equipped = Fists) {
previous_weapon_alias = game.pov.equipped.alias
game.pov.equipped = this
game.pov.equippedstatus = "Wielding: " + game.pov.equipped.alias
this.inventoryverbs = Split ("Look at;Drop;Unequip",";")
msg ("You put away your " + previous_weapon_alias + " and draw your " + game.pov.equipped.alias + ".")
} else {
msg ("You already are equipped with just your " + Fists.alias + ".")
}
}



> equip machete
You already are equipped with just your Fists.

Wielding: Fists

> unequip machete
You put away your Rickety Machete and draw your Fists.

Wielding: Fists

I feel like we're almost there. :P And how dare you insinuate that I cannot unequip my fists!! Hahah!

It's like...the game is saying the weapon is equipped when it isn't.

And the "Wielding: !" doesn't even appear until I try to equip something. LOL

Anonynn
Anyone around to help :D ?

HegemonKhan
I know my code in your other post didn't work, and you need help with this thread's topic too, but I just can't help you right now, as I'm nearing my school's finals, which means I got a few last projects and homeworked dumped upon me, argh, as well as studying for the finals. Only a few more weeks of school left before finals. After school's over, I can give more time and effort to helping you.

Anonynn
It's alright! I know people are busy (or sick of me) so I totally understand. Concentrate on your finals and kick some ass in your classes! Hope all is well!

HegemonKhan
I just wanted to let you know that I'm not ignoring nor sick of you (as that was the intent of my previous post), I'm just too busy with school, to figure out what I did wrong, how to fix it, and then how to help you with getting it to work for your game. After school~finals ends, then I can do so. I'm not sick of answering you, I like helping, as it helps me with getting better at programming too. And I pestered everyone with a lot more questions than you! (so, you still got a ways to go before you out pester me!, hehe)

Anonynn
It's alright, HK. I know classes and real life take priority! It's not a problem at all! I'm sure when someone has time they will help me through this last part so I can continue trying to figure it out on my own lol.

sophia107
simplified examples for placement etuicoquesamsung.com www.etuicoquesamsung.com

Anonynn
if (this.parent = game.pov) {
if (not game.pov.equipped = Fists) {
previous_weapon_alias = game.pov.equipped.alias
game.pov.equipped = this
game.pov.equippedstatus = "Wielding: " + game.pov.equipped.alias
this.inventoryverbs = Split ("Look at;Drop;Unequip",";")
msg ("You put away your " + previous_weapon_alias + " and draw your " + game.pov.equipped.alias + ".")
} else {
msg ("You already are equipped with just your " + Fists.alias + ".")
}
}



> equip machete
You already are equipped with just your Fists.

Wielding: Fists

> unequip machete
You put away your Rickety Machete and draw your Fists.

Wielding: Fists

I feel like we're almost there. :P And how dare you insinuate that I cannot unequip my fists!! Hahah!

It's like...the game is saying the weapon is equipped when it isn't.

And the "Wielding: !" doesn't even appear until I try to equip something. LOL


If anyone has a second :D

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

Support

Forums