One Word Commands

Forgewright
I have spent several days trying to add a flying ability to my player character. I am a newbie(yay)to Quest. I thought an easy way would be to make the player switchable (on/off). I want to make a one word command (fly) but have no idea of the command pattern. Every example I find here or by googling lacks enough explanation for a newb like myself.
Capturequest.PNG


I wanted to try attributes like playerstatus or playeraction but have not figured out how or where to use them.
I don't want the user to enter (fly Eanatas) just (fly), but commands want a subject, hence my head banging.

It's hard to find examples for this and any explanations are just a bit to vague and/or use terms that I don't understand(yet)

When I type in "fly" I get (I do not understand your command)

HegemonKhan
the built-in 'switchable' Boolean Attribute is for on:(true)~off:(false)

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

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

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

here's how it looks in code (and the 'if' logic):

<game name="xxx">
<pov type="object">player</attr>
</game>

<object name="player">
<attr name="flying_boolean" type="boolean">false</attr>
</object>

<command name="fly_command">
<pattern>fly</pattern>
<script>
if (game.pov.name = "Eanatas") {
if (game.pov.flying_boolean = true) {
msg ("You're already flying, silly.")
} else if (game.pov.flying_boolean = false) {
game.pov.flying_boolean = true
msg ("You're flying now!")
}
}
</script>
<


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

you may not be able to have both your Command's 'NAME' and your Command's 'PATTERN' as 'fly'. Keep the 'PATTERN' (this is what you type in during game play to activate the Command) as 'fly'.

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

for your 'flying' Attribute, there's 3 Attribute Types you can use:

Boolean (true~false flag) Attribute, String Attribute, or String List Attributes

-------

Boolean Attribute is the easiest:

player.flying = false
player.flying = true

if (player.flying_boolean) {
-> // scripts1
} else {
-> // scripts2
}

'player' Player Object -> Attributes Tab -> Attributes (NOT 'Status Attributes', as it is completely different) -> Add -> (see below)

(Object Name: player)
Attribute Name: flying_boolean (I like using underscores and describing what is, as it helps me with organization and labeling unique-ness. But, you can call~name~label it whatever~however you want)
Attribute Type: boolean
Attribute Value: false (we want to start off non-flying:false, if you want to start off as flying, then have it as 'true' instead of 'false' )

---------

however, Booleans can get very combersome, for example:

RPG Status Effects:

player.poisoned = false
player.petrified = false
player.paralyzed = false
player.silenced = false
player.confused = false

so, we can use a String Attribute instead:

player.condition_string = "name_of_the_status_effect"

if (player.condition_string = "poisoned") {
player.life_integer = player.life_integer - 50
} else if (player.condition_string = "paralyzed") {
// script(s)
} else if (player.condition_string = "petried") {
// script(s)
}
// etc etc etc


so, for your example:

flying, running, walking, falling, jumping, floating, swimming, climbing, crawling, sneaking, etc etc etc

player.action_string = "xxx"

if (player.action_string = "walking") {
// script(s)
} else if (player.action_string = "flying") {
// script(s)
} else if (player.action_string = "running") {
// script(s)
}
// etc etc etc


----------

lastly, is a String List, which is the same as the String Attribute example above, except a String List can contain multiple things, whereas a String, just one, for examples:

player.locomotion_stringlist = split ("bipedal;walking;sneaking", ";")
~OR~
player.action_stringlist = split ("walking;sneaking", ";")

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

if (ListContains (player.action_stringlist, "walking") and ListContains (player.action_stringlist, "sneaking") ) {
-> msg ("You successfuly sneak past the guard.")
} else if (ListContains (player.action_stringlist, "running") and ListContains (player.action_stringlist, "sneaking") ) {
-> msg ("It's not a good idea to run, when you want to sneak... The guard hears you, catches you, and throws you in jail.")
}

-----------

as for your attempt:

you almost got it right... except you got your indenting (nesting) wrong. You need to click on the correct 'add a script' circle buttons in the GUI~Editor, and also, you're 'if' logic is a bit off... too. Also, maybe you can use the 'switchable', but I'd personally create my own custom Attribute (Boolean, String, or String List ~ this one is a bit more advanced though for a new person to quest, and especially to coding in general)

jaynabonne
The game you've posted won't even run, as there is a script error in the "fly" command. (It doesn't match what you have shown.) You have a line where you're trying assign something to "0", which is not legal. (In other words, delete that first "set variable" line.)

Once you delete that line, then it executes the script when you type "fly". The way you have it set up should work. You have the pattern right. You just need to get the script doing something. (When I remove that erroneous line, the fly command does nothing, as you don't have the "if" doing anything.)

Forgewright
Jaynabonne, I must have corrected that "0" issue and forgot to save the file. Then attached the non-loading copy. Sorry about that.

I thought I could skip the "add new script" from the "if" line and go to "else if" because I only wanted an action after all criteria were met or sorted out. I'm trying to do more than I should but I know this GUI is capable of so much I jumped in with both feet. Clueless but determined.

HegemonKhan, The examples will go a long way for me. It's a copy and paste world nowadays. Since I have not figured out the attributes panel yet I looked for some other method the use. The on/off was simple to use in an "if" script to allow a player to cross a lake of lava without dying. The command pattern line threw me. All the examples I found were pattern this and simple that and I could not figure out what was example name or actual code. After several days of trying to get my player character to fly over some lava I turned to the good folks here on the forum.

Thank you guys for your time.

HegemonKhan
read through this thread, as I explain how to use the 'statusattributes' (which cause the displayment in the status pane during game play) and Commands and other useful stuff too, in it:

viewtopic.php?f=10&t=5018
viewtopic.php?f=10&t=5018&start=15#p35171 (my 'statusattributes' step by step guide post, from in the above link)

Are you still having trouble with getting your 'fly' effect to work? if you are, let me know, and I'll help you get it working.

Forgewright
I resolved the Flying issue after I straightened out my (if) script. It works for this instance and I can't see why it wouldn't in any other instance. I just have to check the on/off status and it should be usable anywhere. I don't completely understand the other method you described yet. I only have an hour or two each day to fool with the coding so it will take a bit to advance.

I have a complete book written and I thought this would be a fun way to see it in action. Plus the added bonus of learning to code. I learned a lot of MS-DOS back in the day when computers first came out on the market for home use and would tear the write protect tab off of floppy's and make changes to game coding to see what each line did. That was 30 years ago and long forgotten.

I'm an old D&D fan so my next step is coding characters and combat. From what I see here it will be a battle in itself to learn. Either I will find enjoyment and satisfaction in doing it or I will look for another way to occupy my time. My work has my mind filled with learning manufacturing processes and I need to stick to something easier like this program for now but I should gain in coding ability using Quest.

Thanks again for your guidance. I'm sure I'll be boo hooing again soon and begging for help.

Forgewright
Well I didn't care for Flying: false or Flying:True as a status so after 18 hours I got:
flyingsnipet.PNG

And
flyingsnipet.PNG


True and false can be entered as a value without Quotation marks. But using a different string value requires Quotation marks.

Every example I found wanted player.attribute = value as an expression. Never once said put Quotation marks around the value. Whats great about finding something out after 18 hours is you will never forget. I'm sure I took the long road in my coding but it says and does what I wanted.
You are: Flying
You are: Walking

Thanks to download/file.php?id=1153 I found out how to word a players attribute (statusattributes) to control the Actual Player's (Status Attributes)

Color me tickled........ Literal varibles need quotation marks. On to the next nightmare.

Forgewright
Now I get

flyingstatus.PNG


when I type "Fly"
and

walkingstatus.PNG


When I type "Land"

I am <-----"The man"

jaynabonne
In case it makes life easier for you - especially since you're using the GUI editor - if you are just checking one state (e.g. whether a flag is set as above), and you want to handle both cases, you don't have to check for the opposite in an "else if". You can just use an "else" (as it can't be anything other than the opposite anyway, so the extra "else if" check is superfluous). So instead of:

if (some condition) {
} else if (opposite of some condition) {
}

you can just do:
if (some condition) {
} else {
}

Forgewright
Thanks Jay. Works just like you said it would.

Silver
Unless you're using the text processor which doesn't have an else.

jaynabonne
Nor an else if :)

Silver
:D

HegemonKhan
ah, super sorry Forgewright!!! :( :( :(

quest's syntax~format~structure has some differences compared to other languages...

for one example, the quest engine is able to parse your code lines in whether they're '=' or '==', so for quest, there's no usage of '==' as quest will do that distnction for you, as it was designed to be more noobie friendly. So in quest, you just use the '=' for both cases of '=' and '==' coding

and here's some big more examples (which unfrotunately wasted 18 hrs for you to find out, my sincere apologies!):

let me explain writing in attribute scripting... (it's a bit late, since you already wasted 18 hours figuring this out... HK feels very bad):

Quest's terminolgy:

VARIABLES:
-> Variables: local (only works for its own scripting block)
-> Attributes: global (can be used in any scripting block, so long as the Object, which it is attached to, exists, of course)
-> Parameters: these are just like Variables, except that they're special Variables, for being able to transfer (and also optionally rename) them among scriptings (see Functions, Commands, and etc)

general syntax for setting~defining and~or altering Attributes:

global usage (Attributes): Object_name.Attribute_name = Value_or_Expression
~OR~
local usage (Variables): variable_string_name = Value_or_Expression
example A (using quest's built-in variable for 'get input' and 'show menu' Functions~Scripts): result = Value
example B: handled = false // or true
example C: you_go_first = true // or false
example D: game_state = 0
example E: game_state = 1 // or 2, 3, 4, etc
example F: game_state = "0"
example G: game_state = "1" // or "2", "3", "4", etc
// notice how NONE of these Variable examples are 'attached' to an Object

OPERATORS:

equals: =
not equals A: not Object_name.Attribute_name = Value_or_Expression
* not equals B: <>
* lesser than: <
* greater than: >
** lesser than and equal to: <=
** greater than and equal to: >=

* if you're writing in the code directly (not via the GUI~Editor's text boxes), then you need to encase the scripting within these tags (as this tells quest engine that the encased '< and >' are not tags but OPERATORS):

<![CDATA[ scripting ]]>

for example:

<function name="xxx"><![CDATA[
if (player.strength_integer >= 51) {
msg ("strong")
} else if (player.strength_integer = 50) {
msg ("average")
} else if (player.strength_integer <= 49) {
msg ("weak")
}
]]></function>


** I think the equals *HAS TO BE* on the right side of the greater than or lesser than

and then it (the setting~defining and~or altering of Attributes or Variables) can also being applied to 'if' scripting:

if (Object_name.Attribute_name OPERATOR Value_or_Expression) { scripting } else if (Object_name.Attribute_name OPERATOR Value_or_Expression) { scripting } else { scripting }

now, here's where you wasted 18 hours, due to me not explaining this to you:

Attribute Types:

Strings, Objects, Integers, Doubles (Floats~Floating Points~decimal numbers), Booleans, Scripts, Lists, Dictionaries, etc

FOR SCRIPTING WRITING:

String Attributes:

the Value or its textual parts in an Expression, MUST be encased in quotes, as this is what tells the quest engine, the Value (or textual parts) are Strings

Also, the Value may NOT be these special strings: 'true' nor 'false', as these are set aside for Boolean Attributes' Values

Object_name.Attribute_name = "Value"
example: player.alias = "HK"
~OR~
example: player.static_greeting = "Hi, my name is HK."
//outputs: Hi, my name is HK.
~OR~
example: player.dynamic_greeting = "Hi, my name is " + player.alias + "."
//outputs (for my example of: player.alias="HK"): Hi, my name is HK.

Lastly, do note, that numerical Values can be either a String or an Integer~Double, which is determined by whether you encase it in quotes (String) or not (Integer~Double):

String Attribute: player.strength = "100"
vs
Integer Attribute: player.strength = 100
vs
Double Attribute: player.strength = ?100.00? (actually, I've not worked with them, so maybe they do use quotes, or not, as I don't know, lol)

String Attribute VS Object Attribute:

String Attribute: player.food = "apple"
vs
Object Attribute: player.food = apple
<object name="player">
<attr name="food" type="object">empty</attr>
</object>

<object name="empty">
</object>

<object name="apple">
<take />
<eat type="script">
// I'm missing scripting needed to set the: player.food = apple, this is just an example anyways, so I'm too lazy to do it, lol
if (player.food = apple) {
player.life = player.life + 50
msg ("You eat the apple, re-gaining 50 life.")
} else {
msg ("You can't eat an apple that you don't have in your possession, silly.")
}
</eat>
</object>


Object Attributes:

by NOT encasing the Value in quotes, you're telling the engine that this is an ACTUAL Object (via its ID, which in quest is it's 'name' String Attribute), and NOT as merely a 'descriptive word (a String)' for its Value:

Object_name.Attribute_name = Value

example:

<object name="player">
</object>

<object name="sword_1">
<alias>katana</alias>
</object>

<function name="equip_sword_function">
player.right_hand = sword_1
msg ("You equip the " + sword_1.alias + " in your right hand.")
// outputs: You equip the katana in your right hand.
</function>


Integer Attributes:

the Value is (non-decimal) numeric, and NO quotes encasing it

Object_name.Attribute_name = numerical_but_non_decimal_Value

Double (Float~Floating Point~decimal numbers) Attributes:

Object_name.Attribute_name = ?numerical_and_decimal_Value?
(again, I don't know if its Value does use quotes or not)

Boolean Attributes:

the Value must be either 'true' or 'false, and NO quotes encasing it

Object_name.Attribute_name = true_or_false

example:

the orc starts alive: orc.dead = false // we'd usually actually use though the 'creation' tag for setting it's initial setting (unless you like using scripting for creating everything ~ good coders prefer doing it this way, anyways):

the '->' (arrow) on the left side is just my 'arrow' method to show the indenting needed (instead of using the code box). These 'arrows' of mine are NOT proper syntaxing, you'll have to delete them (but keep the indenting correct of course):

example:
if (...) {
-> if (...) {
->-> if (...) {
->->-> msg ("blah")
->-> }
-> }
}

<object name="orc">
-> <attr name="dead" type="boolean">false</attr>
</object>

then we kill it (within a scripting): orc.dead = true

// using Jay's preferred~correct~simple syntax for this example:

<object name="player">
</object>

<object name="orc">
<attr name="dead" type="boolean">false</attr>
</object>

<function name="fight_orc_function">
if (orc.dead) {
msg ("It is already dead, silly.")
} else {
orc.dead = true
msg ("You fight and kill the orc.")
}
</function>


using my conceptual example (though it's redundant and~or wrong at a deeper level of code understanding as Jay explains, but it does still works as a functional syntax in quest, if by chance you prefer doing it this longer typed way):

<function name="fight_orc_function">
if (orc.dead = true) {
msg ("It is already dead, silly.")
} else if (orc.dead = false) {
orc.dead = true
msg ("You fight and kill the orc.")
}
</function>


anyways... that's it for now... hope this helps! (well, it's a bit too late, but it might save you another 18 hours, lol)

---------

P.S.

someone converted 'King's Quest V' (I think it's V~5 anyways) over to quest, so if interested, you can hopefully find it, download it, and play it, hehe. (if it's compatible with the current version of quest... hmm)

here it is:

http://textadventures.co.uk/games/view/ ... ll-version

enjoy! ... if it works with current version of quest...

Forgewright
Wow. My last posts did sound like I was Bitching. Hell I was excited. Believe me the time was not wasted. I learned to maneuver through Quest and the forum. I have seen so much that I am not even ready to use in my game. It's just a learning process for now. I have deleted posts because I gave in to being lazy and just wanted someone to hand me the answer. Every time I struggle to get the wanted result and it finally happens, I'm up out of my chair and doing the dance. You know the dance....

HegemonKhan
oh yes, it's such a 'high~rush' when you finally get code to work and be able to see+play it out in a game (I was so excited when I finally got my basic combat, well damage, code working, that I named the post 'Veni Vidi Veci', it's very ugly now ~ very poor coding, but it was functional and at the time I was so proud of myself lol, if interested, see my noobie thread, and the specific 'triumph' post here: viewtopic.php?f=10&t=3348&start=120#p22483 ), hehe. I wish I went into robotics and coding when I was little (instead of just playing games but not learning about them: electronics, computers, and programming), sighs. I'm trying to learn to code now at my age... sighs. I got a lot of catching up to do, hopefully I can get a livable job in computers, and maybe at some point a good job in programming... though, my time's running out... sighs. I just learned basic computer systems within the last two-three years (A+, Networking+, and Security+ CompTia certs) through a vocational school, and got my first computer job (after 9 months of job hunting) doing computer repair, but I wasn't able to handle the volume required of the job, sighs. I did learn a bit more with malware removal and computer systems from the job (though they had a lot of powerful proprietary tools, so I wasn't learning too much with manual malware removal, as I would have liked), but there's still a lot I don't know about computer systems, for being a good~high level in removing malware.

So, right now, I'm just trying to learn to code more on my own, as I wait to hopefully get into some programming classes, and~or other classes on computers (cisco level of networking and~or more computer systems ~ malware removal and~or the MSCE:Microsoft Certified Solutions Expert cert).

--------

no, you didn't sound like that at all, lol. Learning stuff on your own is good (if you struggle and finally figure something out, you understand it best), but not 18 hrs, lol. I'd say for people new to coding, like me, taking 8 hrs is the limit when trying to learn to code or to code in something or a code system, after that, ask for help !!!, lol.

I just feel bad, as you shouldn't have wasted 18 hrs! Waste 8 hrs, but no more, ask for help, as we're glad to help here, we've got a good community here (I learned so much from pestering everyone else!, going from knowing absolutely nothing about coding to where I'm at now, not very far... but I still have come a long way for myself, all thanks to Alex' Quest and all the helpful people here!), and it's good code practice for myself in helping others, hehe :D

Almost always more often than not... it's something stupid (a simple mistake, typo, or whatever) that is causing the issue~problem with not figuring something out or getting something to work in coding (so, you should ask much more soon, no reason to waste 18 hrs on something stupid!), rather than something significant, like not really knowing what or how to do something. Though... trying to learn code designs~systems, I'm finding myself struggling... as I'm limited in my code-base knowledge, I need to go back to learning more code tactics, higher code stuff, and etc, instead of trying to work on coding in a game, as I just don't have the tools~knowledge base, to be able to quickly code in such designs~systems for a RPG. Also, it seems like a lot of this involves more planning (lots of flow charts and etc), than in-actually coding it, as I find myself trying to think of how to do its structuring~connecting it all together (and in the better way to do so), than with the individual coding itself. So, I'm at a bit of a roadblock right now, sighs. This is why I really want to get into some programming classes, as they can direct my learning, whereas I really don't know how to on my own.

HegemonKhan
(I decided to split this into its own post for better organization~finding~searching, out from the previous post)
.
.
.
about Commands (went back and read your first post):

http://docs.textadventures.co.uk/quest/
http://docs.textadventures.co.uk/quest/elements/
http://docs.textadventures.co.uk/quest/ ... mmand.html

they can be set up to work on a single 'command' input or a 'command+Parameter~Variable' input (governed by the 'pattern' Attribute of the Command), as you can construct the Command's scripting to be as simple or complex as you want, such as doing static actions or dynamic actions, regardless of what your Command's 'pattern' Attribute is, aka: there's many different designs for doing the same thing and~or whatever you want with your coding.

example of a super simple Command (to show your character's stats):

the 'pattern' is what you type in during game play to activate the command, so for this super simple example, you'd just type in: info

<command name="main_character_information_screen_command">
<pattern>info</pattern>
<script>
ClearScreen
msg ("Name: " + player.alias)
msg ("Gender: " + player.gender_string)
msg ("Race: " + player.race)
msg ("class: " + player.class)
wait {
ClearScreen
}
</script>
</command>


---------

we can keep the 'pattern' as the simple 'info', while still making it dynamic, via its scripting, for example (good coders have better designs~methods to use than I do, and this is jsut for an example, it's very poor coding ~ I can do better than this lol, but it serves its purpose as an example):

<function name="character_creation_function">
show menu ("Who do you want to be?", split ("player;HK;Conan_the_Barbarian;Frodo_Baggins_from_Tolkien's_Lord_of_the_rings", ";"), false) {
game.pov = result
switch (game.pov) {
case (player) {
player.alias = "hero"
player.gender_string = "male"
player.race = "dwarf"
player.class = "cleric"
}
case (HK) {
player.alias = "HK"
player.gender_string = "male"
player.race = "human"
player.class = "warrior"
}
case (Conan_the_Barbarian) {
player.alias = "Conan"
player.gender_string = "male"
player.race = "human"
player.class = "warrior"
}
case (Frodo_Baggins_from_Tolkien's_Lord_of_the_Rings) {
player.alias = "Frodo"
player.gender_string = "male"
player.race = "hobbit (halfling)"
player.class = "thief"
}
}
}
</function>

<command name="main_character_information_screen_command">
<pattern>info</pattern>
<script>
ClearScreen
if (game.pov.name = "player") {
msg ("Name: " + player.alias)
msg ("Gender: " + player.gender_string)
msg ("Race: " + player.race)
msg ("class: " + player.class)
} else if (game.pov.name = "HK") {
msg ("Name: " + HK.alias)
msg ("Gender: " + HK.gender_string)
msg ("Race: " + HK.race)
msg ("class: " + HK.class)
} else if (game.pov.name = "Conan_the_Barbarian") {
msg ("Name: " + Conan_the_Barbarian.alias)
msg ("Gender: " + Conan_the_Barbarian.gender_string)
msg ("Race: " + Conan_the_Barbarian.race)
msg ("class: " + Conan_the_Barbarian.class)
} else if (game.pov.name = "Frodo_Baggins_from_Toliken's_Lord_of_the_Rings") {
msg ("Name: " + Frodo_Baggins_from_Toliken's_Lord_of_the_Rings.alias)
msg ("Gender: " + Frodo_Baggins_from_Toliken's_Lord_of_the_Rings.gender_string)
msg ("Race: " + Frodo_Baggins_from_Toliken's_Lord_of_the_Rings.race)
msg ("class: " + Frodo_Baggins_from_Toliken's_Lord_of_the_Rings.class)
}
wait {
ClearScreen
}
</script>
</command>


----------

or, we can do some of the dynamic stuff through the 'pattern', but this is a bit more confused as it involves Parameters~Variables, for example:

pattern: command_activator #(text or object)#

in our simple example, we only had the command_activator (info), which tells the quest engine, which Command to run~execute~activate (main_character_information_screen_command)

but now we're giving a Parameter~Variable to it (#text# or #object#), for example (this is advanced stuff, mostly due to the checkings and using Lists, so don't worry if you don't get it fully):

Pattern:

info #text#
~OR~
info #object#

<object name="player">
<alias>hero</alias>
<attr name="object_type_string" type="string">character</attr>
<attr name="gender_string" type="string">male</attr>
<attr name="race" type="string">dwarf</attr>
<attr name="class" type="string">cleric</attr>
</object>

<object name="HK">
<attr name="object_type_string" type="string">character</attr>
<attr name="gender_string" type="string">male</attr>
<attr name="race" type="string">human</attr>
<attr name="class" type="string">warrior</attr>
</object>

<object name="Conan_the_Barbarian">
<alias>Conan</alias>
<attr name="object_type_string" type="string">character</attr>
<attr name="gender_string" type="string">male</attr>
<attr name="race" type="string">human</attr>
<attr name="class" type="string">barbarian</attr>
</object>

<object name="Frodo_Baggins">
<alias>Frodo</alias>
<attr name="object_type_string" type="string">character</attr>
<attr name="gender_string" type="string">male</attr>
<attr name="race" type="string">hobbit (halfling)</attr>
<attr name="class" type="string">thief</attr>
</object>

<object name="orc_1">
<alias>orc</alias>
<attr name="object_type_string" type="string">character</attr>
<attr name="gender_string" type="string">male</attr>
<attr name="race" type="string">orc</attr>
<attr name="class" type="string">berserker</attr>
</object>

<object name="car_1">
<alias>car</alias>
<attr name="object_type_string" type="string">vehicle</attr>
</object>

<object name="table_1">
<alias>table</alias>
<attr name="object_type_string" type="string">furniture</attr>
</object>

<object name="room_1">
<alias>dungeon of doom</alias>
<attr name="object_type_string" type="string">room</attr>
</object>

<command name="any_character_information_screen_command">
<pattern>info #text#</pattern>
<script>
object_variable_1 = GetObject (text)
if (object_variable_1 = null) {
foreach (object_variable_2, AllObjects () ) {
if (object_variable_2.alias = text) {
object_variable_1 = object_variable_2
}
}
if (object_variable_1 = null) {
msg ("Wrong input, please try again.")
} else if (GetString (object_variable_1.object_type_string, "character")) {
if (object_variable_1.parent = player.parent) {
ClearScreen
msg ("Name: " + object_variable_1.alias)
msg ("Gender: " + object_variable_1.gender_string)
msg ("Race: " + object_variable_1.race)
msg ("class: " + object_variable_1.class)
wait {
ClearScreen
}
} else {
msg ("There seemingly is no such character within the room, and no, you don't get god~cheating powers to see any character anywhere within the game either, nice try wink, so please try again.")
}
} else {
msg ("Wrong input, please try again, as your input is not a 'character' Object in the game.")
}
</script>
</command>


err... too tired to show an example using the #object# Parameter~Variable usage, and I'm not really sure exactly how to use it myself (still am a bit confused by its usage even after Jay~Pixie~whoever tried to explain it to me, due to me over-thinking its usage due to me being familiar with the #text# usage) ...

anyways, an explanation of how the #text# usage is working above:

say I typed in during game play: info player

'info' tells the quest engine to use~activate~run~execute the 'any_character_information_screen_command' Command

'player' is set to the ' #text# ' Parameter~Variable:

#text# = "player"

which (via the encasing #~pound~hash tags) then enables the quest engine to use that in the Command's Script as the Variable: text

so, conceptually:

text <=== #text# <=== "player"

and thus when the Command's Script runs, for example with this code line:

object_variable_1 = GetObject (text)

the quest engine (unseen by you: this is NOT what you write in as the syntax) is trying: object_variable_1 = GetObject (player)

then, I have a series of complex checks, due to dealing with that the person can type in anything... lol

hopefully you can maybe follow along now with the rest of the code... as I'm too tired to finish the explanation of it.

and if I instead typed in the followings, my code will be able to handle all of it (hopefully):

1. info dajlkjsfno
2. info orc_1 (which the person playing the game wouldn't know to type 'orc_1' in, as this is the 'name' ~ ID, as the player of the game would only see mention of its 'alias' of 'orc', as it 'orc_1' would~should be hidden from the person playing the game, known only by the game maker)
3. info orc
4. info HK
5. info table
6. info chair

-------

if you're able to understand the complex Command above, here's a challenge for you:

.
.
.
.
.
.
.
there's one extra missing check that is needed... as there's going to be an issue with one of the checks
.
.
.
.
.
.
Hint: something (a needed check) is overlooked~missing with the 'name-vs-alias' checking...
.
.
.
.
.
.
Answer:
.
.
.
.
.
if we have multiple Objects with the same 'alias', we need a check to deal with which of those Objects to use~get~reference for the Command ~ which Object did the person want the info about?, hehe


------

oops... forgot to mention this:

you can have multiple Parameters~Variables in~for your Command's 'pattern' Attribute (and you can structure your pattern however you want too), for example:

typed in input during game play: craft sword with iron and carbon
output result: You forged a steel sword.

<command name="crafting_command">
<pattern>craft #object1# with #object2# and #object3#</pattern>
<script>
// blah scripting
msg ("You forged a steel sword.")
</script>
</command>


~OR (for example of a different pattern structure, you can do it in any grammatical or non-grammatical or whatever form you want)~

typed in input during game play: craft sword iron carbon
output result: You forged a steel sword.

<command name="crafting_command">
<pattern>craft #object1# #object2# #object3#</pattern>
<script>
// blah scripting
msg ("You forged a steel sword.")
</script>
</command>

jaynabonne
HK, a couple of minor points about what you've posted above:

Also, the Value may NOT be these special strings: 'true' nor 'false', as these are set aside for Boolean Attributes' Values


A string value can be whatever you like, including "true" and "false" (in quotes). The whole point of a quoted string is that the engine does not look at or attempt to interpret what's inside the quotes. true and false are only special when not quoted. They are values like 0, 1, 10, etc, just of a boolean type.

by NOT encasing the Value in quotes, you're telling the engine that this is an ACTUAL Object


Or a variable or parameter. Or null. A better way to look at it might be that objects define global *values* - albeit structured, of type "object" - that can subsequently be used in expressions. In other words, a non-quoted string is not a special case for objects, but rather an object definition creates a new global variable or value that fits into the general expression mechanism.

HegemonKhan
Thanks Jay for helping~correcting me with a better (deeper) understanding of how the quest engine is actually working! :D
(Always learning something new from you, very much appreciated with all these nuggets you give for understanding quest's engine~code better!)

Forgewright
Still working on my flying command/status update. In my player attributes I added an attribute called (Flying turns left). I want this attribute's value to begin at ten when "Fly" it typed. This I can do, however I want to decrease by -1 each turn so they player get tired and has to rest. I created a turn script triggered by typing "fly" successfully.
flyingcounter.PNG


The problem... I have yet to understand/grasp a whole lot on how to tweak attributes in scripts. By my example, I'm betting it is another punctuation error of the attribute "Flying turns left". I get lost when I see examples like (player.attribute.) I know these identify atts. when I'm in another object area but damn.

I attempted (player.Flying turns left} with no avail. (as the att)
I attempted ("flying turns left = flying turns left - 1")(as the value)This just changed the status to ("flying turns left = flying turns left - 1")
The GUI started laughing at me......

I got the whole status update display changing thing down pretty well but values are kicking (my rassi mon). <--- You have to say that with a Jamaican accent.....

when an example states player.attribute I assume it means (Player name).(attribute name). Is this correct or is it literal?

I started the game over be cause I messed something up in the 'code'. Cleaned up some code and surprisingly it didn't take me long.


The GUI does a great job with the drop down boxes but I seem to over think what it wants.

Marzipan
Are you using a library you didn't include with the download? I get an error when I try to open that.

HegemonKhan
some coding errors prevent the initiation of your game from even loading~starting up, and some coding errors just pop up during game play. Don't worry if your game won't even load up (it's not ruined!), as all you got to do is to open your game file via a text software~program (notepad, wordpad, notepad++, text editor ~ apple computer, or etc), and then fix (trouble shoot) the code errors... we can help with that too, especially the good coders here, whereas I only sometimes can do so (it's harder for me to look through someone elses code and spot the errors with it, than it is for the good coders here to do so, hehe).

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

my use of these *general* VARIABLE syntax structures, is just MY method of depiction of its general structure (sorry for its confusion!):

Object_name.Attribute_name = Value_or_Expression
~OR~
variable_string_name = Value_or_Expression
(but 'variable_string_name' isn't going to be discussed, as it is simplier, no attachment ~ which is for global usage, as this is just local usage)

you replace my 'Object_name' with the Object's NAME, for example 'player' or 'game' or 'whatever' Object (which also has the Attribute you want to use: aka Object+Attribute must be correctly together, for it to exist and thus be used by you, lol):

player.Attribute_name = Value_or_Expression
~OR~
game.Attribute_name = Value_or_Expression
~OR~
orc_1.Attribute_name = Value_or_Expression
~OR~
etc etc etc

you also do the same for my 'Attribute_name', replacing it with the Attribute's NAME, for example 'Flying_turns_left', 'strength', 'dead', right_hand', etc:

player.Flying_turns_left = Value_or_Expression
~OR~
game.event_flag_integer = Value_or_Expression
~OR~
orc_1.dead_boolean = Value_or_Expression
~OR~
table_1.material_type_string = Value_or_Expression
etc etc etc

lastly, you either give it a Value or an Expression of whatever it is that you want to do with it obviously, for some examples:

player.Flying_turns_left = 5
~OR~
game.event_flag_integer = 99
~OR~
orc_1.dead_boolean = false
~OR~
table_1.material_type_string = "oak wood"
~OR~
HK.physical_damage_integer = HK.claymore_sword.physical_damage_integer + HK.claymore_sword.physical_damage_integer * HK.strength_integer / 100 - orc.full_plate_armor.resistance_integer - orc.full_plate_armor.resistance_integer * orc.endurance / 100
~OR~
etc etc etc

the scripting's attachments (Object_name.Attribute_name) corresponds to the 'containment: parent-child' heirarchy (the indenting~nesting level), for example of this scripting:

HK.physical_damage_integer = HK.claymore_sword.physical_damage_integer + HK.claymore_sword.physical_damage_integer * HK.strength_integer / 100 - orc.full_plate_armor.resistance_integer - orc.full_plate_armor.resistance_integer * orc.endurance / 100

corresponds to this:

(or, add~create these Attributes to their Objects, as seen below, via through the GUI~Editor's: Object -> Attributes -> Add)

<object name="orc">
<attr name="dead_boolean" type="boolean">false</attr>
<attr name="endurance_integer" type="int">25</attr>
<attr name="attack" type="script">
HK.physical_damage_integer = HK.claymore_sword.physical_damage_integer + HK.claymore_sword.physical_damage_integer * HK.strength_integer / 100 - orc.full_plate_armor.resistance_integer - orc.full_plate_armor.resistance_integer * orc.endurance / 100
<object name="full_plate_armor">
<attr name="resistance_integer" type="int">40</attr>
</object>
</object>

<object name="player">
<attr name="strength_integer" type="int">100</atrr>
<object name="claymore_sword">
<attr name="physical_damage_integer" type="int">50</attr>
</object>
</object>


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

this might be an issue with quest trying to handle spaces, as when it parses a code line, it has to (tries to) figure out: 'okay is this a NAME String Attribute, a Command's PATTERN, a Function~Expression, and etc'... So, it's better to not use spaces if possible, to avoid any possible issues with them vs it being a separate issue causing the problem. Quest can handle spaces pretty well (Alex has done a good jo with the underlying engine), probably better than most other engines, but there are quite a bit of space issues that still pop up here that people post help on trying to troubleshoot (beware copy and pasting in accidentally copying too far, having some unwanted spaces being copied either at the beginning or end of the code line you're trying to copy, lol).

Spaces okay as (in the) Values for String Attributes, but for the actual 'NAMES' of Attributes, Objects, Elements, and etc... you shouldn't use spaces.

------

in an MS-DOS-like language (not sure about the common languages as I've not learned them yet), you can 'save' a Variable, via pseudo (I'm still trying to learn it):

Variable ==> Name
%Variable% ==> Value
!Variable! ==> ?Altered Secondary Value?

with quest, it uses Objects to 'save' Attributes (so long as the Object exists ~ remains existing, of course):

Scripting's Initial Setting, Re-setting, and~or Altering~Changing of Attributes:

(as you took 18 hrs to find out, the syntax of the Value is what determines the Attribute Type, and~or you use a conversion Function: ToInt, ToString, or ToDouble, on your Value to get it to being the right Attribute Type)

examples:
player.strength_integer = 100
player.strength_integer = player.strength_integer + 50
player.strength_integer = player.endurance_integer + player.agility_integer
player.strength_integer = 25

(such as after casting a healing spell or using a healing item)
if (player.current_life_integer > player.maximum_life_integer) {
-> player.current_life_integer = player.maximum_life_integer
}
msg ("Life: " + player.current_life_integer + "/" + player.maximum_life_integer)
// example output: Life: 999/999

msg ("What is your age?")
get input {
-> // quest engine automatically sets a String Variable: result = "your_typed_in_input"
-> // thus we need to convert it from a String to an Integer:
-> player.age_integer = ToInt (result)
}

GUI~Editor's initial setting of Attributes ONLY:

'player' Player Object -> Attributes Tab -> Attributes -> Add -> (see below)

(Object Name: player)
Attribute Name: strength_integer
Attribute Type: int (integer)
Attribute Value = 10

how the initial setting looks as the coding tag:

<object name="player">
-> <inherit name="editor_object" />
-> <inherit name="editor_player" />
-> <attr name="strength_integer" type="int">10</attr>
</object>

see how the 'player' Player Object holds~contains the 'strength_integer' Integer Attribute ???

in scripting it is syntaxed as the dot~period 'attachment', of this:

Object_name.Attribute_name:
player.strength_integer
example usage:
msg (player.strength)
// ouputs: 10

and then (depends on the scripting you're doing, such as the above, or here, such as initial setting, re-setting, or altering~changing the Attribute and its Value) Value too:

player.strength_integer = 10
but, say, now I want it to be:
player.strength_integer = 30

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

so... for your GUI PIC example...

in the box:

Attribute: "Flying turns left"

you got some issues... due to me confusing you... it takes awhile to learn this stuff, and I didn't do a good job of explaining it enough.

this is the Attribute's 'name' (ID) String Attribute, so NO quotes encasing it. (The quotes are for encasing the Attribute's Value, HOWEVER via using the GUI~Editor's text boxes, you do NOT need to even put quotes encasing the Value, as the GUI~Editor does this underneath~unseen for you. ONLY when you're writing~typing in the coding yourself, aka NOT using the GUI~Editor's text boxes, do you need to put in the correct syntaxing punctuation, like encasing quotes on a String Attribute's Values. Though, if you're manually doing an Expression via the GUI~Editor's text box, then you're going to need to put in the quotes for the textual parts. Ya, this is a bit convoluted, between how you do stuff in the GUI~Editor VS not within the GUI~Editor... lol)

so, you want the box to look like this:

Attribute: Flying turns left

HOWEVER, those spaces could be causing issues, so let's remove them, for example, let's use this labeling (I like underscores, lol):

so, you want the box to look like this:

Attribute: Flying_turns_left

now, quest IS lower~upper case sensitive, so it depends on what your prefered coding labeling convention~system is.

I personally, in my noobie level of coding, don't like using caps (upper case) at all, and I like underscores, and I like to be descriptive, such as adding on what it is (and it ensures the required unique-ness), but it does make for very lengthy code, lol:

Attribute Types:
player.strength_integer = 100
player.strength_string = "strong"
player.right_hand_object = sword
player.right_hand_string = "sword"
orc.dead_boolean = false

I think more conventional labeling systems for good coders is:

using caps (upper case) for higher level things like Functions, and lower case for lower level things like scripts, and etc... ask a good coder on this, as I'm not one of them yet, and thus am not familiar with their conventional labeling system, as can probably be seen here, lol.

so, if you want to use 'Flying_turns_left' as your Attribute's 'NAME', then make sure you type it correctly each time you use it within your game code.

I think you know about unique-ness, right?

the ID in quest is the 'name' String Attribute, so all 'names' must be unique, or you'll get an error, for examples (I think ~ I could be wrong with some of these):

<object name="orc">
</object>
<object name="orc">
</object>
// ERROR !!!!

<object name="Orc">
</object>
<object name="orc">
</object>
// NO error

<object name="orc_1">
<attr name="strength" type="int">100</attr>
</object>
<object name="orc_2">
<attr name="strength" type="int">100</attr>
</object>
// NO error

<object name="orc">
<attr name="strength" type="int">100</attr>
<attr name="strength" type="int">100</attr>
</object>
// ERROR !!!

<object name="orc">
<attr name="strength" type="int">100</attr>
<attr name="strength" type="string">100</attr>
</object>
// ERROR !!!

<object name="orc">
<attr name="strength_integer" type="int">100</attr>
<attr name="strength_string" type="string">100</attr>
</object>
// NO error

<function name="buy">
</function>
<function name="buy">
</function>
// ERROR !!!

<function name="buy">
</function>
<command name="buy">
</command>
// ERROR !!!

<function name="Buy">
</function>
<function name="buy">
</function>
// NO error

<function name="buy_1">
</function>
<function name="buy_2">
</function>
// NO error

<function name="buy_function">
</function>
<command name="buy_command">
</command>
// NO error

shortened Script Attribute tag line (due to a change in syntaxing between older and newer versions):
<obejct name="orc">
<fight type="script">
// script block
</fight>
</object>
<function name="fight">
</function>
// ERROR !!!

extended Script Attribute tag line (due to a change in syntaxing structure between older and newer versions):
<obejct name="orc">
<attr name="fight" type="script">
// script block
</attr>
</object>
<function name="fight">
</function>
// ERROR !!!

etc etc etc examples

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

shortened String Attribute tag line (by the way):
<object name="orc_1">
<alias>orc</alias>
</object>

extended String Attribute tag line (by the way):
<object name="orc_1">
<attr name="alias" type="string">orc</attr>
</object>

etc etc etc


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

anyways, back to your GUI PIC example...

we can't use 'Flying_turns_left', because, we and quest engine, don't know what to reference? 'Flying_turns_left'... OF WHAT ???

thus you need the Object that contains it, that the attribute is attached to:

so, you want the box to look like this:

Attribute: player.Flying_turns_left

though... if you want to use 'player', then *do make sure* that you actually created (added~put) the 'Flying_turns_left' Integer Attribute in the 'player' Object:

as how can you reference:

player.Flying_turns_left

when it doesn't exist:

<object name="player">
-> // quest engine... UM... HOUSTON, WE GOT A PROBLEM, this 'player' Object has no such 'Flying_turns_left' Integer Attribute... what do I do??? ERROR, can't compute !!!!!
</objecT>

so, make sure you added it to the Object (in this case the 'player' Object) which you are referencing with the scripting line:

player.Flying_turns_left

// IT EXISTS:
<object name="player">
-> <attr name="Flying_turns_left" type="int">20</attr>
</object>
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
these are the same thing, below is using the GUI~Editor to create the above in code view, or you can jsut go into code view and write in the above
VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV
GUI~Editor: 'player' Object -> Attributes Tab -> Attributes -> Add -> (see below)
(Object Name: player)
Attribute Name: Flying_turns_left
Attribute Type: int
Attribute Value: 20

also...

your Value must be corrected as well:

in the box:

player.Flying_turns_left = player.Flying_turns_left - 1

and lastly (still via the GUI~Editor, as you're using it, lol) ....

click on your 'player' Object (on the left side's 'tree of stuff' ) so it is highlighted, then on the right side:

click on the 'Attributes' Tab, then click on the 'Add' button for Attributes (NOT Status Attributes), and make sure you got the same Attribute created (added) here:

(Object Name: player)
Attribute Name: Flying_turns_left
Attribute Type: int
Attribute Value: (whatever you want it to start as, lol)

and lastly, lastly, if you want it to be displayed during game play on the right side in the 'status' box~pane~window:

click on your 'player' Object (on the left side's 'tree of stuff' ) so it is highlighted, then on the right side:

click on the 'Attributes' Tab, then click on the 'Add' button for Status Attributes (NOT Attributes), and make sure you got the same Status Attribute created (added) here:

(Object Name: player)
(Status Attribute's added Attributes):
Attribute Name: Flying_turns_left
Field Value (Attribute Value): Flying Turns Left: !

Marzipan
I've started working on a little flying demo, but it's really late here and so I'll have to try and finish it during my break tomorrow. Hopefully at least some parts of it will be useful though...I know I always can get a better understanding of how something works if I have an example to pick apart rather than just having it explained.

Weirdly enough an earlier test file I made for keeping track of shotgun ammo was coming in really handy with this one...keeping track of a variable is pretty much the same no matter what you're doing I guess.

Forgewright
Marzipan wrote:Are you using a library you didn't include with the download? I get an error when I try to open that.


It loads just fine for me..... It's a newly created game. Weird.......oh wait this one has the LevelLib.aslx I think Pixie may have wrote it. But it loads for me....

Marzipan
Forgewright wrote:oh wait this one has the LevelLib.aslx I think Pixie may have wrote it


Yeah, that's the one I kept getting the message about.

Oh well, I don't actually need the file to set up a flying demo, I was just curious as to how exactly you were handling it.

Forgewright
I may have misrepresented the problem I'm having with the attribute (Flying turns left). I haven't change the game since my last post and I don't know why it won't load for you guys.
I have it doing everything I want it to but changing its value with each turn. You can see the example has a status box saying ( Flying turns left: 10) I want it to decrease by 1 every turn until it is at 0. thus causing the player to land and rest.
If I can just write it properly.... flying turns left = flying turns left - 1
are there () ""? where and when?

I'll say it a different way....

What is the proper coding to change an attributes value decreasing 1 integer per turn if the attribute is....
Flying turns left and the value is 10
or
Flying_turns_left and the value is 10

I changed both turn script referenced attributes and player referenced attributes to
Flying_turns_left and I get the error showed in the example. Plus it shows up in the status bar as well as Flying_turns_left_

old way(note the Status and error)
gameplay.PNG

new way(note the status and error)
gameplay2.PNG


So the GUI reads them both for the status but not in the turn script.....

and the .Aslx which for some reason loads for me but not for you.

The GUI always reads the atts, with spaces as in the (You are ) att. and changes the update from(Flying to Walking) just fine it just won't do the math in the (Flying turns left) att.

Forgewright
OK, got the status to show the category i want with the words I want using:

(Object Name: player)
(Status Attribute's added Attributes):
Attribute Name: Flying_turns_left
Field Value (Attribute Value): Flying Turns Left: !

Now just need it to update and do the math.

I just want to subtract 1 from the value each turn.............

Forgewright
how do I subtract 1 from an attribute value in a script line asking for value? *****something = something - 1******. Syntax included

The attribute is for the main character otherwise known as the object i want to have the attribute value to change: Player
the attribute under this player attributes is named: Flying_turns_left
the value of this attribute in the object players attributes under the value column is: 10

Forgewright
now that I can get the status to label the way I want I'll try changing the atts. to flyingturnsleft with no underscores or spaces

Forgewright
that didn't work


player.flying_turns_left = player.flying_turns_left - 1 doesn't work

player.flyingturnsleft = player.flyingturnsleft - 1 doesn't work

flyingturnsleft = flyingturnsleft - 1 doesn't work

hmmmm

Forgewright
it just a lousy game turn script (Scratches head)

Forgewright
i don't get an error with "flyingturnsleft = flyingturnsleft - 1" as a turn script value but the status reads: Flying turns left: flyingturnsleft = flyingturnsleft - 1

Forgewright
also...

your Value must be corrected as well:

in the box:

player.Flying_turns_left = player.Flying_turns_left - 1

and lastly (still via the GUI~Editor, as you're using it, lol) ....

click on your 'player' Object (on the left side's 'tree of stuff' ) so it is highlighted, then on the right side:

click on the 'Attributes' Tab, then click on the 'Add' button for Attributes (NOT Status Attributes), and make sure you got the same Attribute created (added) here:

(Object Name: player)
Attribute Name: Flying_turns_left
Attribute Type: int
Attribute Value: (whatever you want it to start as, lol)

and lastly, lastly, if you want it to be displayed during game play on the right side in the 'status' box~pane~window:

click on your 'player' Object (on the left side's 'tree of stuff' ) so it is highlighted, then on the right side:

click on the 'Attributes' Tab, then click on the 'Add' button for Status Attributes (NOT Attributes), and make sure you got the same Status Attribute created (added) here:

(Object Name: player)
(Status Attribute's added Attributes):
Attribute Name: Flying_turns_left
Field Value (Attribute Value): Flying Turns Left: !



all this I got....
I can't get a turn script to change the value because i can't get flyingturnsleft = flyingturnsleft - 1 to be understood as a value for the turn script.

HegemonKhan
let's use for example:

player.strength = 0

here's the syntax for basic math computations:

Addition:

player.strength = value1 + value2 // or more: + valueX

examples (these examples apply for the other computations too, not just Addition):
player.strength = player.strength + 3
player.strength = player.strength + 1
player.strength = player.strength + 100
player.strength = player.weight + player.endurance + player.agility
player.y = x + 7
game.y = x + 7
game.strength = game.strength + 1
etc etc etc

----

quick conceptional-only example of how it works:

initial (old) setting: player.strength = 0

old: player.strength = 0

player.strength (new) = player.strength (old:0) + 5
player.strength (new) = 0 + 5 = 5

new: player.strength = 5

old: player.strength = 5

player.strength (new) = player.strength (old:5) + 5
player.strength (new) = 5 + 5 = 10

new: player.strength = 10

old: player.strength = 10

player.strength (new) = player.strength (old:10) + 5
player.strength (new) = 10 + 5 = 10

new: player.strength = 15

etc etc etc

--------

Subtraction:

player.strength = player.strength - 4

--------

Multiplication:

player.strength = player.strength * 3

------

Division:

player.strength = player.strength / 2

-----------

Buying Transaction:

sword.parent = shop_keeper

// missing the 'if' Script conditionals obviously
player.cash = player.cash - sword.price
shop_keeper.cash = shop_keeper.cash + sword.price
sword.parent = player

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

Selling Transaction:

sword.parent = player

// missing the 'if' Script conditionals obviously
player.cash = player.cash + sword.price / 2
shop_keeper.cash = shop_keeper.cash - sword.price / 2
sword.parent = shop_keeper

----------

if the 'player.Flying_turns_left' isn't working... a quick question, did you change the Player Object's 'name', from 'player' to 'something else', Eanates ???

if you did, then don't use 'player' but use the name you renamed it as (for example: 'bob', lol):

bob.Flying_turns_left = bob.Flying_turns_left - 1

if it's still not working... let me see...

--------

oh.... my bad... so it's not changing the value in the Status pane ??? is this the error location ??? (I still have a bit of trouble deciphering the error message ~ easier to see your entire game code, to spot where the error is, as it may not be where you think it is, hence why need to see entire game code).

HegemonKhan
P.S.

the game is just not loading for Marzipan, likely due to that he doesn't have 'Pixie's Level Library' correctly set up, which you're using in your game file. So, don't worry about this~his issue, lol.

(he jsut needs to go into the game code, and remove the '<include ref="level_library" />', for it to load fine for him as it does for you, or to properly set up the library)

The Pixie
You have set your player object to be called "Eanatas", rather than player. Either:
Set the player name to be "player" and the alias to "Eanatas" (I think you need to do that on the player tab, instead of, or as well as, the Setup tab).
In you script do Eanatas.flying_turns_left = Eanatas.flying_turns_left - 1
In you script do game.pov.flying_turns_left = game.pov.flying_turns_left - 1

game.pov will always be the current player object, whatever it is called, and it is best practice to use that (though the first way makes it easier to read and understand when you come back to it in six months).

HegemonKhan
okay, this should work (HK crosses fingers, as I might have missed some corrections and etc stuff):

<!--Saved by Quest 5.6.5510.29036-->
<asl version="550">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<include ref="LevelLib.aslx" />
<game name="Eanatas">
<gameid>ced3aa62-ef51-48b8-a371-2a72c3c6b10c</gameid>
<version>1.0</version>
<firstpublished>2015</firstpublished>
<subtitle>Gargoyle Tales</subtitle>
<author>Robert Hatfield</author>
<cover>rsz_gargoyle.jpg</cover>
<category>Fantasy</category>
<difficulty>Medium</difficulty>
<cruelty>Tough</cruelty>
<backgroundimage>gargoyle.jpg</backgroundimage>
<defaultbackground>Silver</defaultbackground>
<statusattributes type="stringlist" />
<showhealth />
<feature_asktell />
<appendobjectdescription />
<multiplecommands />
<feature_pictureframe />
<gridmap />
<pov type="object">Eanatas</pov>
</game>
<object name="Cavern">
<inherit name="editor_room" />
<description>The heat is unbearable and the smell of sulfur is so thick it would choke the life from a normal man. An unsteady patter of footsteps breaks through the silence. A yellowing flicker spreads across the cave's surfaces, mixing with shadows cast by the dead. Eanatas shuffled along, stirring up a cloud of dust. The glow from his torch showed his red, fiendish face. White eyes glistened above a huge, freakish grin, almost touching his pointed ears.</description>
<picture type="string"></picture>
<enter type="script">
</enter>
<beforeenter type="script">
SetFramePicture ("cave.jpg")
</beforeenter>
<object name="Eanatas">
<inherit name="editor_object" />
<inherit name="editor_player" />
<inherit name="namedmale" />
<inherit name="switchable" />
<usedefaultprefix />
<look>A fiendish face with large white eyes, a snake-like tongue curling and twisting, lashing out around long sharp teeth. Wings of skin and claws of carbon black bone. </look>
<visible type="boolean">false</visible>
<attr name="You are" type="string"></attr>
<statusattributes type="stringdictionary">
<item>
<key>You are</key>
<value></value>
</item>
<item>
<key>Flying_turns_left</key>
<value></value>
</item>
<item>
<key>Gold</key>
<value></value>
</item>
</statusattributes>
<feature_switchable />
<switchonmsg>You spread your wings and begin to rise.</switchonmsg>
<switchoffmsg>You land with a thump.</switchoffmsg>
<attr name="Flying_turns_left" type="int">10</attr>
<Gold type="int">0</Gold>
<drop type="boolean">false</drop>
<onswitchon type="script">
set (Eanatas, "You are", "flying")
</onswitchon>
<onswitchoff type="script">
set (Eanatas, "You are", "Walking")
</onswitchoff>
</object>
<exit alias="west" to="Mountain Path">
<inherit name="westdirection" />
</exit>
<exit alias="east" to="Tunnel">
<inherit name="eastdirection" />
</exit>
<object name="Sword">
<inherit name="editor_object" />
<alias>sword1</alias>
<look>A basic slashing and stabbing weapon. The blade is about 2 feet long</look>
<take />
</object>
</object>
<command name="fly">
<pattern type="string">fly</pattern>
<script>
SwitchOn (Eanatas)
</script>
</command>
<object name="Tunnel">
<inherit name="editor_room" />
<exit alias="west" to="Cavern">
<inherit name="westdirection" />
</exit>
<exit alias="east" to="Ledge">
<inherit name="eastdirection" />
</exit>
</object>
<object name="Ledge">
<inherit name="editor_room" />
<exit alias="west" to="Tunnel">
<inherit name="westdirection" />
</exit>
<exit alias="north" to="Small Opening">
<inherit name="northdirection" />
</exit>
</object>
<object name="Mountain Path">
<inherit name="editor_room" />
<exit alias="east" to="Cavern">
<inherit name="eastdirection" />
</exit>
</object>
<object name="Lair">
<inherit name="editor_room" />
<exit alias="east" to="Small Opening">
<inherit name="eastdirection" />
</exit>
<exit alias="up" to="Stairs">
<inherit name="updirection" />
</exit>
</object>
<object name="Small Opening">
<inherit name="editor_room" />
<exit alias="south" to="Ledge">
<inherit name="southdirection" />
</exit>
<exit alias="west" to="Lair">
<inherit name="westdirection" />
</exit>
</object>
<command name="land">
<pattern type="string">land</pattern>
<script>
SwitchOff (Eanatas)
</script>
</command>
<object name="Stairs">
<inherit name="editor_room" />
<exit alias="down" to="Lair">
<inherit name="downdirection" />
</exit>
<exit alias="out" to="Forest Clearing">
<inherit name="outdirection" />
</exit>
</object>
<object name="Forest Clearing">
<inherit name="editor_room" />
<exit alias="in" to="Stairs">
<inherit name="indirection" />
</exit>
</object>
<turnscript name="flyingturncounter">
<enabled />
<script><![CDATA[
if (IsSwitchedOn(Eanatas)) {
Eanatas.Flying_turns_left = Eanatas.Flying_turns_left - 1
if (Eanatas.Flying_turns_left = 0) {
SwitchOff (Eanatas)
msg ("You exhausted yourself, landing quickly to the ground, as you no longer have the energy to keep flying.")
}
}
]]></script>
</turnscript>
</asl>


specifically, changed your Turnscript (I had indeed confused you quite a bit, that's my fault!), here is my corrections:

  <turnscript name="flyingturncounter">
<enabled />
<script><![CDATA[
if (IsSwitchedOn(Eanatas)) {
Eanatas.Flying_turns_left = Eanatas.Flying_turns_left - 1
if (Eanatas.Flying_turns_left = 0) {
SwitchOff (Eanatas)
msg ("You exhausted yourself, landing quickly to the ground, as you no longer have the energy to keep flying.")
}
}
]]></script>
</turnscript>


since, you renamed your default 'player' Player Object to 'Eanatas', we needed this direct syntax code line:

Eanatas.Flying_turns_left = Eanatas.Flying_turns_left - 1

and my bad, as you were trying to do this in the 'set' Script (though maybe it can still be in it... not sure, lol)

also... I added in a check for you... test it... you may be getting a qwasi-double message, if you already got it set up to message something in your own code, due to me putting in a message as well, when your flying turns run out.

------

lastly (a minor fix), in your:

<game name="Eanatas">
</game>

you had a space in front of it:

<game name="(space)Eanatas">
</game>

which I edited out.

this (an unnoticed accidental space) was actually the cause of someone else's error that I was trying to help troubleshoot... somehow Pixie spotted it... amazing!

----

also... you may be having a conflict since both your Game's name and your Player Object's name is 'Eanatas', you may need to change one of them...

HegemonKhan
as Pixie mentioned... for people starting out...

it's better to leave the default Player Object's 'name' Attribute as 'player', and use the 'alias' Attribute to give it the name you want to be seen~read in your game:

Object Name: player
Object Alias: Eanatas

then you could use this syntax:

player.Flying_turns_left = player.Flying_turns_left - 1

as we get into some confusion due to when people change the 'NAME' (ID) Attribute, which they'd then have to adjust their scripting syntaxes for:

Eanatas.Flying_turns_left = Eanatas.Flying_turns_left - 1

--------

Pixie may be confusing you a bit with the 'game.pov', while it usually (some exception scenarios though) is a good~better practice to use, I think it more often just confuses people. Easier to just keep using 'player' instead of 'game.pov', until they're ready for it, as you got to explain it to them... lol.

In earlier versions of quest, there was only allowed a single Player Object, but with later versions, this was opened up to having multiple Player Objects, along with the ability to switch between (control of) them:

Player Objects (such as the default 'player' Player Object) are your 'PCs (Playable Characters)', vs your normal 'npc (Non-Playable Characters)' Objects, in quest

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

game.pov = your_currently_control_player_object

and then to change:

game.pov = player
ChangePov (HK) ~ http://docs.textadventures.co.uk/quest/ ... gepov.html
game.pov = HK

by the way, 'game.pov' is an Object (Type) Attribute, exactly the same as:

player.right_hand = sword
||
game.pov = player

though it (game.pov) has some special built in functionality due to that it deals with the Player Objects and thus the Status Attributes, of course.

Forgewright
Well, I have the aslx now and it works perfectly as far as I have it programmed or should I say YOU have it programmed. Now I can use it to study some of the coding. I can't seem to understand directions very well but if I see the coding and play around with it I start to understand what does what.

so the turn script:
Eanatas.Flying_turns_left = Eanatas.Flying_turns_left - 1

I could have sworn I tried this before.....

HegemonKhan thank you for you time and understanding. Now I can get some sleep and go to work tomorrow.

HegemonKhan
if you can, really try to get used to using Attributes often (as oposed to Variables, example: handled = true):

Object's_name(dot~period)Attribute's_name (OPERATOR) Value_or_Expression

Object's_name.Attribute's_name = Value_or_Expression

it's really the key to coding (scripting ~ actions) in quest, hehe ;)

HK.right_hand_object = sword
HK.left_hand_object = shield
HK.favorite_color_string = "black"
HK.favorite_colors_stringlist = split ("black;red", ";")
HK.hair_color_string = "dark brown"
player.strength = 50
Eanatas.strength = 75
HK.strength = 100000000000000000 // muwahaha !!!
HK.intelligence = -1000000000 // doh! :( :( :( , meh who needs intelligence, stupid wizards, me just cut to pieces with sword! :P
orc.dead = false
player.flying = false
sword.equipped = true

if (player.strength > 50) {
-> // blah scripts
} else if (player.strength < 50) {
-> // blah scripts
} else if (player.strength = 50) {
-> // blah scripts
}

if (player.endurance =< 100) {
-> // blah scripts
} else if (player.endurance > 100) {
-> // blah scripts
}

if (not player.agility = 50) {
-> // blah scripts
}

if (player.agility <> 50) {
-> // blah scripts
}

etc etc etc

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

P.S.

as I'm sure you're already well familiar with when you were doing coding years ago, and as you're dealing with now with learning quest's code:

troubleshooting is fun (sarcasm), lol

riiiight... :D (and it's like 99% of the time something so stupid too... GRRR... If I'm taking 8 hrs trying to trouble shoot, I want it to be a big huge issue that I incredibly solved~fixed... not finding out that it's merely some stupid lame mistake or typo, that is to blame for the code not working... lol)

Forgewright
Getting a grasp on scripts. at least until I want to add something else to the game. lol My trouble this ladt time turns out I was using the wrong script choice. I'll get it....someday

Forgewright
i want to limit flying turns to ten or less. If a player lands with six turns left i want the turn script to add a flying turn each game turn.

I can do this but I want it to stop at 10 flying turns.
I tried
if player.flying turns left = player.flying turns left < 10

then blah blah
..... I get error(not expecting <)

Clue a brother in... all the examples show + or - integer. Is there no less than integer?

I want the turn script to keep adding +1 till the value is 10
If my attribute is...
Flyingturnsleft with a value 10 can I easily make the value a max 10, Whats the coding I'm looking for?

Just point me in the right direction.

jaynabonne
Out of context, I can only guess you mean

if (player.flying turns left < 10)

?
You're checking for both equality and less than in the same statement.

Forgewright
That's it Jay, Thanks.

HegemonKhan
999/999 HP

player.curhp_integer = 999
player.maxhp_integer = 999
player.hp_string = player.curhp_integer + "/" + player.maxhp_integer + " HP"

let's say I just fought a slime and now I got:

800/999 HP

and I do a healing spell that does +300 HP:
player.curhp = player.curhp + 300

I'd need a check on it afterwards:

if (player.curhp > player.maxhp) {
-> player.curhp = player.maxhp
}

so, I don't have:

1100/999 HP

but instead:

999/999 HP

----

or, at the opposite end too:

if the metal slime killed me:

0/999 HP

if (player.curhp <= 0) {
-> msg ("GAME OVER")
-> finish

Forgewright
I knew I could somehow set the attribute to equal a max hp attribute. thanks for sharing that.

Forgewright
These libraries that have been created by members are very useful. I am using Pixie's combat.aslx and am impressed with how it works. I have been looking for the same type of library for the player. Setting level and what not. Can anyone point me to a player set up library. This are so helpful in structuring of attributes. I want to make claws and teeth a weapon with out having to equip them. Used together or separately. It there a list of libraries I can look at.

HegemonKhan
these are the libraries that we have so far:

viewforum.php?f=18 (Libraries and Code Samples)
http://docs.textadventures.co.uk/quest/tutorial/
http://docs.textadventures.co.uk/quest/ ... ation.html (character creation)
http://docs.textadventures.co.uk/quest/guides/ (especially, see its links of 'Using Types' and down, or the links below, lol)

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

Equipment:

Pixie's Simple Combat Lbrary
Pixie's Clothing Library
Chase's Wearables Library
Pertex' Combat Library

Items:

Sora's Stackable Library
Portable lightsource ('lantern') Library (forgot who it is authored by, too lazy to look up)

Combat:

Pixie's Simple Combat Library
Pertex' Combat Library
HK variation using Pertex' Combat code structure (all credit goes to Pertex)

Magic:

Pixie's Spell Library
Pixie's Simple Combat Library

Dialogue:

Jaynabonne's (whatever it is called) Library
others (not sure who they're by in the wiki's 'guides' section~link)

Mapping~Pathfinding:

Jaynnebonne's (whatever it is called) Library

Transportation:

Car+Elevator Libraries
HK's 'Explore' and 'Travel' Code

Transactions (Shopping):

Pixie's Shop Library

Time and Date:

Pixie's Clock Library

Character Level Up:

Pixie's Level Library

etc etc etc...

we need a stealth~thievery RPG library... among many many more...

Forgewright
Thanks Hegemon. This oughta keep me busy for a while.....

Forgewright
I have seen a lot of discussion about (clear the previous turn) I like it because it clears away the past clutter, but when the player type in a command, it will clear away the (You can go) and (you can see) texts and only show the results of the command. In the game turnscript I just have (clear previous turn) Can I enable the (Look) command in the turnscript or activate it to show everything in the room without printing it out so the player has to click it?

HegemonKhan
yes, you can re-display the Room's 'description' and an Object's 'look', after you 'ClearScreen', in any scripting (Verbs ~ Object's Script Attribute, Commands, Functions, Turnscripts, Timers, and etc).

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

ClearScreen
ShowRoomDescription ()

ClearScreen
Invoke (Object_name.look)

---------

if you're asking for a way to have to 'click' on something to activate it... one method is to use Objects and their Verbs:

have the Object (its 'name' or 'alias' Attribute) be your 'main category choice' and its Verbs be your 'sub category choices', for example:

example using the 'player' Player Object's inventory pane (aka, have these Objects in the 'player' Player Object):

Object Name: character ( 'button' )
Object's Verbs: information (stats, appearance, etc), equipment, magic, items, perks~abilities~skills, etc ( 'sub buttons' )

Object Name: examine ( 'button' )
Object's Verbs: sight, smell, sound, taste, feel ( 'sub buttons' )

-------

or, if you want to have to click on the hyperlinks in your left side's big text box pane, then use the 'text processor' + Commands + Object's Attributes:

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

and if you want to see really fancy usage, check out Pixie's Level Library.

The Pixie
Forgewright wrote:I have seen a lot of discussion about (clear the previous turn) I like it because it clears away the past clutter, but when the player type in a command, it will clear away the (You can go) and (you can see) texts and only show the results of the command. In the game turnscript I just have (clear previous turn) Can I enable the (Look) command in the turnscript or activate it to show everything in the room without printing it out so the player has to click it?

I am not exactly clear what you want to do, but it sounds like you want the screen to clear when the player enters a new room, but not when picking stuff up or whatever. There is a script on the game tab that fires when the player enters a room, but I think it fires after the description. A solution would be to replace the OnRoomEnter function to clear the screen before it prints the description.

Forgewright
Well, After a week with a sore throat and a wicked ear infection I've mustered up the strength/patience to work on some scripting. No problems, just letting everyone know I'm still alive and back to coding. I've been tinkering with Blender learning to do some graphic work. So much to do so little time.....

XanMag
Damn you, Forgewright!! =)

You mention this Blender thing and now I am addicted to learning/implementing it. Seems awfully complex, but well worth it once I get it figured out. Good luck with it!

Forgewright
the youtube beginner tutorials are very helpful

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

Support

Forums