Another Menu Question

ReaperOf666
Hey everyone! I do have a simple short question, but I do need to state that my knowledge on programming is still new, and I have looked at Quest for almost a week now, so if I am asking newb things, then let me know! I didn't find this in the tutorial, so I'm asking here:

I made a Main Menu with multiple choices - Easy.
When you pick Choice 1, it's another menu - Also Easy.

While in Choice 1's menu, how do you make a choice send you back to the Main Menu?

I'm trying to make a dynamic character creator that you can do in any order, but I'm failing miserably... my guess would be that I need to make "Main Menu" something 'constant', almost like an object, so that anytime I refer to it even in another menu, it'll link back to that.

Thanks for helping in advance! <3

HegemonKhan
the easiest way to do 'looping' in quest is to use Functions (add Functions):

the term 'looping' is from its original limited code functionality of 'looping back', for example, in your computer's 'command line~prompt' or 'terminal' black code box (MS-DOS like language):

a simple MACRO~BATCH (*.bat file) is just a basket~group~block~segment of scripts~code lines (just as quest's Functions are too):
echo off
cls
:start
echo hi
echo what is you name?
echo bye
goto start


// this will endlessly loop (which is very bad, laughs), the output~displayment of:
//
// hi
// what is your name?
// bye
// hi
// what is your name?
// bye
// hi
// etc etc etc
//
// over and over again

coding language has advanced from this limited-simplistic functionality (back then you had to be really creative, and it was an organizational mess too, lol, as I've found out with trying to branch into it, before I try with learning the other actual computer languages of today), letting you 'goto~loop' to any section~segment of coding, and one of the easiest ways that quest does this is through its FUNCTIONS:

Functions serve as 'chunks~blocks~baskets' of~holding~containing Scripts (actions~events), allowing you to manage~organize your scripting easily (and moving amongst them: aka looping), and also Functions are very powerful too, for more advanced usage, when you're at that point of ability.

http://docs.textadventures.co.uk/quest/ ... ction.html
http://docs.textadventures.co.uk/quest/ ... tions.html (alphabetical order)
http://docs.textadventures.co.uk/quest/ ... jects.html (scroll down a bit to the 'Functions' section)

Add your Functions and Add your Scripts to them, and when~where you want to return to another Function, simply add the 'call upon function' Script (and just type in the Function's name that you want to loop~go back to, into the text box, and ignore the Add Parameters for now) as the last Script.

a pretend quick simple fake example just to show Function Looping usage (this is how doing the above, using the GUI~Editor, will look in-code, as an example):

(you can use your own naming~labeling system~convention, this is just my own: I love the underscores, being descriptive, and at the end, labeling what it is too, such as 'main_menu_function' as seen below)

// I Add a Function, called~named: main_menu_function (and I add the Scripts, such as 'msg', 'if', and 'show menu', and 'call upon function', seen below, to it):

<function name="main_menu_function">
show menu ("The Test Game", split ("new game;continue;exit", ";"), false) {
if (result = "new game") {
msg ("You chose to start a new game.")
new_game_function // this is the 'call upon function' Script that you add: Add a~new script -> output -> 'call upon function' Script -> name: new_game_function
} else if (result = "continue") {
msg ("You chose to load your old saved game.")
continue_function // this is the 'call upon function' Script that you add: Add a~new script -> output -> 'call upon function' Script -> name: continue_function
} else if (result = "exit") {
msg ("You chose to quit the game.")
finish
}
}
</function>

// I Add another Function, called~named: continue_function (and again add the scripts seen below, 'ask' is a Function though I think ~ I'm not that familiar with the built-in stuff, such as 'ask' as to what exactly it is and termed as: Script, Function, Command, Verb, etc, nor with the GUI~Editor as well):

<function name="continue_function">
ask ("Would you like to go back to the main menu?") {
if (result = true) {
msg ("You decided to go back to the main menu.")
main_menu_function // this is the 'call upon function' Script that you add: Add a~new script -> output -> 'call upon function' Script -> name: main_menu_function
}
}
</function>


---------

here's a more practical (but very unfinished~lacking) quick simple example for you:

<function name='character_creation">
show menu ("Set up your character", split ("name;gender;age;completed", ";"), false) {
if (result = "name") {
name_function
} else if (result = "gender") {
gender_function
} else if (result = "age") {
age_function
} else if (result = "completed") {
opening_game_scene_function
}
}
</function>

<function name="name_function">
msg ("What is your name?")
get input {
player.alias = result
character_creation_function
}
</function>

<function name="gender_function">
show menu ("What is your gender?", split ("male;female", ";"), false) {
player.gender_string = result
character_creation_function
}
</function>

<function name="age_function">
msg ("What is your age?")
get input {
if (IsNumeric (result) = true) {
player.age_integer = ToInt (result)
character_creation_function
} else {
msg ("Please type in a number this time, thank you.")
age_function
}
}
</function>

<function name="opening_game_scene_function">
msg ("You wake up in a prison cell with no memory.")
msg ("Name: " + player.alias)
msg ("Gender: " + player.gender_string)
msg ("Age: " + player.age_integer)
</function>


I added a little extra in this example, to show more looping and to introduce you with 'checks~checking' coding logic~mindset~mentality, hehe :D

----------

instead of 'calling upon' Functions, there's also using the Function's feature of 'returning values', but this is more complicated, start with understanding just 'calling upon' Functions first, then when you're much more ready, we can get into using the Function's feature of 'returning values'

-----------

P.S.

for learning the basics of quest, and the next step, BEYOND THE TUTORIAL (getting started into more advanced stuff too), use these links (in this order, aside from needing to look up stuff, anyways) below:

1. http://docs.textadventures.co.uk/quest/tutorial/
2. http://docs.textadventures.co.uk/quest/ ... ation.html
3. http://docs.textadventures.co.uk/quest/guides/
4. http://docs.textadventures.co.uk/quest/
5. viewforum.php?f=18
6. viewforum.php?f=10

----------

P.S.S.

if you want to see my own journey~struggle in learning quest (and quickly into quest's coding, as that was and is my goal: learning to code, hehe):

viewtopic.php?t=3348

(2-3 years have passed... I've come so far for myself... but got so much further still to go, sighs)

man, was I so overwhelmed with all of the terms scrambled~jumbled in my head after I got done with the tutorial, that I was totally confused (I got the tutorial in its limited examples, pretty well, but was so confused by everything that I found myself unable to do anything on my own, initially, hence my massive newbie thread, hehe) laughs.

ReaperOf666
Thank you so much for replying in such a helpful matter, and right away! It means a lot to me <3

The examples helped far more than the tutorials (I'm making the game Online, so the instructions are a bit wonky for me), and I am still learning my termonology! (Still don't know what Commands and Parameters and Expressions REALLY are, but anyway!)

I figured I'd post what I had created with your help, and ask yet another question about things I want to do in the menu. Note, I did make the first one a Menu because I was having trouble early on making it call the function first - I'll probably switch it back for simplicity's sake:

ClearScreen
ShowMenu ("Main Menu", Split ("Backstory; Race; Class; Stats; Skills; Perks; Description; Finished?", ";"), false) {
if (result = "Backstory") {
backstory
}
else if (result = "Race") {
race
}
else if (result = "Class") {
class
}
else if (result = "Stats") {
stats_creator
}
else if (result = "Skills") {
skills_creator
}
else if (result = "Perks") {
perks_creator
}
else if (result = "Description") {
description_creator
}
else if (result = "Finish") {
MoveObject (Player, Outside of Castle Rahkuin)
}
}

<main_menu [function]>
ShowMenu ("Main Menu", Split ("Backstory;Race;Class;Stats;Skills;Perks;Description;Finished?", ";"), false) {
if (result="Backstory") {
backstory
}
else if (result="Race") {
race
}
else if (result="Class") {
class
}
else if (result="Stats") {
stats_creator
}
else if (result="Skills") {
skills_creator
}
else if (result="Perks") {
perks_creator
}
else if (result="Description") {
description_creator
}
else if (result="Finished?") {
Ask ("Are you sure? All changes will be final!") {
if (result= true) {
MoveObject (Player, Outside of Castle Rahkuin)
}
else if (result= false) {
main_menu
}
}
}
}

</ main_menu [Function]?

<backstory [Function]>
ShowMenu ("Backstory", Split ("Placeholder 1;Placeholder 2;Placeholder 3", ";"), false) {
if (result = "Placeholder 1") {
msg ("Placeholder 1 text for the description of a background!<br/><br/>. . .Press Anything to Continue. . .")
wait {
Ask ("Do you wish to choose this backstory?") {
if (result = true) {
ClearScreen
main_menu
}
else if (result = false) {
ClearScreen
backstory
}
}
}
}
else if (result = "Placeholder 2") {
msg ("Placeholder 2 text for the description of a background!<br/><br/>. . .Press Anything to Continue. . .")
wait {
Ask ("Do you wish to choose this backstory?") {
if (result = true) {
ClearScreen
main_menu
}
else if (result = false) {
ClearScreen
backstory
}
}
}
}
else if (result = "Placeholder 3") {
msg ("Placeholder 3 text for the description of a background!<br/><br/>. . .Press Anything to Continue. . .")
wait {
Ask ("Do you wish to choose this backstory?") {
if (result = true) {
ClearScreen
main_menu
}
else if (result = false) {
ClearScreen
backstory
}
}
}
}
}

</ backstory [Function]>

//I repeated the same exact format for Race, Class. Stats, Perks, Skills, and Description I did this below:

<stats_creator [Function]>
msg ("(Placeholder Text)<br/><br/>This one requires a bit more 'advanced' manipulating than the others! You'll be picking which stats have how many 'points'.")
Ask ("Return to Main Menu? (You will either way! Muhahaha)") {
if (result = true) {
ClearScreen
main_menu
}
else if (result = false) {
ClearScreen
main_menu
}
}
</ <stats_creator [Function]>


Which bring me to my question - I've seen it down in an inform game, but I have no idea how to do it (probably some of the more advanced functions that I am unaware about as none of the 'given' options seem to pertain?).

With using stats as an example:
You have 3 stats:

Ability
Mental
Physical

I want to allow the player to distribute 10 points along these three skills, and allow that to affect their Player Object Status Attributes in turn. That will involve:
[list]-Making the player not leave the screen when they select an option
-Changing text to show how many points are there [Ex: Ability (2 Points); Mental (4 Points); Physical (4 Points)]
-A 'reset' button that undo's point distribution (would that just be Undo?)
-If the player would return to the screen, they would see that their changes are still present and can change then again.[/list:u]

Thanks once again for the help! You are so awesome, I wish I could bake you cookies or give you something! <3 <3 <3

I did read you Trials and Tribulations.. I think I'm beginning to go on that track now ^.~

HegemonKhan
A stat distribution system is still a bit beyond me (besides in a really poor-ugly way of doing it, lol), but there is this (I don't know if you'll be able to use it, and I myself am still trying to get it too, haha. Though, we've got others who can help you: Jay, Pixie, Pertex, Sgrieg, and etc good coders here):

viewtopic.php?f=18&t=4057

this is a Library File (think of it like a 'patch', 'xpac', and~or 'mod' add'able to your game), if you need help on how to get it added, let me know, here's some help:

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


---------

here's some more useful links:

http://docs.textadventures.co.uk/quest/guides/ (you can scroll down for a bottom section too, easy to not realize)
http://docs.textadventures.co.uk/quest/ ... ation.html
viewtopic.php?f=18&t=4988
http://docs.textadventures.co.uk/quest/ ... _menu.html
viewforum.php?f=18
viewtopic.php?f=10&t=4946

---------

Status Attributes:

http://docs.textadventures.co.uk/quest/ ... butes.html
viewtopic.php?f=10&t=4946&start=15 (scroll down to my 2nd post for about Status Attributes, I've got game files that hopefully you can DL and play~test them out)

---------

ask if you need any help or got any questions

The Pixie
Kind of blowing my own trumpet, but you might want to look at this:

viewtopic.php?f=18&t=4886

HegemonKhan
About Commands, Expressions, and Parameters:

-----

Commands:

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

Verbs are actually a subtype of Commands, but that's at an underlying technical level.

Commands use typed-in input by the person playing the game, unlike Verbs which use the 'buttons' and 'hyperlink's that you click on during game play.

Commands are more open-ended, whereas a Verb is added to that Object and only exists~works for that Object (as that Object's 'button' and~or 'hyperlink' ).

The simpliest conception of Commands:

it's comprised of and uses two inputs:

the command
what the command is acting upon

for example:

you type in during game play:

attack orc

<command name="attack_command">
<pattern>attack #object#</pattern>
<script>
object.hp = object.hp - player.damage
msg ("You attack the " + object + ", doing damage to it!")
<script>
</command>

<command name="kiss_command">
<pattern>kiss #object#</pattern>
<script>
msg ("You kiss the " + object + ", eeewww!")
<script>
</command>


see the '<pattern>attack #object#</pattern>' above? by typing in 'attack' during game play, you tell quest that you're activating the Command 'attack_command', and the 'orc' that you typed in during game play, will be the Object that will be used in the Command's Scripting (via algebraic substitution).

but, if you typed in during game play:

kiss orc

then, it activates the Command 'kiss_command', instead, and 'orc' is will be the Object used for the Command's scripting.

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

Expressions:

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

(I think it's better to explain by examples for what these are)

writing (the setting or altering of) Attributes in code:

Object_name.Attribute_name = Value_or_Expression

examples:

=Values:

player.strength = 100
player.alias = "HK"
orc.dead = false

=Expressions:

(in the GUI~Editor: run as script -> add a~new script -> whatever script -> [EXPRESSIONS] -> and then you type them in yourself into the text box)

game.static_greeting = "Hi, my name is HK, what is your name?"

game.dynamic_greeting = "Hi, my name is " + player.alias + ", what is your name?")

HK.favorite_colors_list = split ("black;red", ";")

player.damage = player.weapon.damage + player.weapon.damage * player.strength / 100 - orc.armor.defense - orc.armor.defense * orc.endurance / 100

Expressions with the 'if' Script:

in GUI~Editor: run as script -> add a~new script -> scripts -> 'if' Script -> [EXpressions] -> (write~type it in, see below)

Object_name.Attribute_name = Value_or_Expression

examples:

in GUI~Editor:

Add Function, name: fight_function -> (see below)
run as script -> add a~new script -> scripts -> 'if' Script -> [EXPRESSION] -> orc.dead = true
-> then, add a script -> output -> print a message -> [MESSAGE] -> The orc is already dead, silly!
// I'm tired... laughs...

in code:

<function name="fight_function">
if (orc.dead = true) {
msg ("The orc is already dead, silly!")
} else if (orc.dead = false) {
orc.dead = true
msg ("You attack and kill the orc!")
}
</function>


------

I'm tired... see my previous post's links, one of them gets more into Attributes+Expressions, too.

we'll talk about Parameters later, they're a bit more advanced~confusing, first get this other stuff first, then we can get into Parameters and their usage.

HegemonKhan
@Pixie,

I already blew your trumpet, hehe:

in my second post, I linked to your Level Library for Reaper :D

You may need to help him~her with it, as I myself am still trying to understand it myself (well understand how to write it, the concatinating of the Commands + displayment, is causing my stupid brain a bit of difficulty in processing the concatination, laughs. I can get it on my own, but it'll take me some time to study and practice writing it), and couldn't help nor explain it well for reaper.

ReaperOf666
I /may/ have found a way to possibly do this - I'll report back when have some sort of result ^.- (or is that my newb programming making things up?)

I'm trying to stay away from libraries, because they don't teach me anything - I'm just ripping from someone else's work, and I just feel wrong when I do that directly (I know you can do that indirectly when programming though! :P)

Thanks for the help! All of this talking has really assisted me in learning how Quest works.

HegemonKhan
It's the best way to learn, especially for people new to coding, in fact most good coders learned to code from looking at others' code when they started out. As long as it is publically made available, of course. Unless you're a genius, it's really unlikely for you to intuititively come up with advanced coding designs and~or methods all on your own.

ReaperOf666
I've tried opening libraries with some programs (I can't seem to find a way in Quest?), and I can't figure out how to view their 'guts', which is why I said they don't help me in the least bit. Unless I'm doing this wrong?

I'd learn /if/ I saw the code, but I don't, and everything just happens for me. THAT isn't helpful at all.

Silver
You need to open the files in a text editor. I use notepad+ (or is it ++?)

HegemonKhan
as Silver said:

any text program to open up and see a game file (*.aslx) and~or a library file (*.aslx):

notepad
wordpad
notepad++ ( http://notepad-plus-plus.org/ )
textedit (apple)
etc etc etc

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

Game File:

*.aslx

<asl version="###">
-> (your entire mass of game code)
</asl>

Library File:

*.aslx

<library>
-> (your entire mass of library code)
</library>

ReaperOf666
Okay! Just got back from things happening, and I've been eagerly mulling over how to do everything, but I continue to be hung up on one key factor:

I made a few Attribute Types:

KEY:
- Ability
- Attunement
- Coordination
- Fighting

Every time I create a new Attribute type, I can also choose the type of object it is. I've been defaulting to using String, which may be wrong. See Below.


Now, I also get the option to input information into a "Format String", and this is what stumps me - I have tried several ways of inputting data and none work the way intended, so here is my End Goal:

Ability = A Number (Attunement + Coordination + Fighting)
Attunement = A Number (Initial Value [5] + Value from Character Creation)
Coordination = A Number (Initial Value [5] + Value from Character Creation)
Fighting = A Number (Initial Value [5] + Value from Character Creation)

What I continually get is that I end up with
[A Number (Attunement + Coordination + Fighting)] Displaying - none of the math or anything else I've tried to do displays. Only EXACTLY what I put in there - is the String a problem?

What is the exact format for putting variables in?

How do I make format strings display RESULTS and not the actual string?

This is the only page that mentions Format Strings: http://docs.textadventures.co.uk/quest/status_attributes.html

Quote: The key in the dictionary is the name of the attribute. The value can be left blank, or you can set it to a format string like "your strength is !".

Silver
If you want numbers then make the attribute an integer. A string returns words/letters.

Silver
Player.strength = 5
Player.intelligence = 7

etc etc.

Silver
>drink strength potion

msg("The potion cools your throat as it glides slowly down towards your stomach. You feel woozy for several seconds. 
...
You are sharply awakened as you feel iron pumping through your veins and your teeth protrude and foam builds around your mouth." )
// lol
player.strength = player.strength + 10

msg("You now have " + player.strength + " strength points.")

ReaperOf666
Silver wrote:>drink strength potion

msg("The potion cools your throat as it glides slowly down towards your stomach. You feel woozy for several seconds. 
...
You are sharply awakened as you feel iron pumping through your veins and your teeth protrude and foam builds around your mouth." )
// lol
player.strength = player.strength + 10

msg("You now have " + player.strength + " strength points.")


I'll try this out and report back if I get the intended results :D

Thanks!

Silver
Be sure to set the attributes you want to use before that, either in the start script or the character creation page.

For simplicity I suggest you put

player.strength = 1


in your start script just so you see how it works on a basic level.

HegemonKhan
take a look at this thread (see my initial posts at the top, and scroll down to my posts where I give 3 game codes + game test files):

viewtopic.php?f=10&t=4946&start=15

ask if you need any help with anything, ask if you need help with understanding and doing anything.

----------

as to writing~coding an [EXPRESSION] (has both text + variables) 'msg' Script, there's a secret trick to doing it:

(general syntax for Attributes: Object_name.Atrtibute_name = Value_or_Expression)

break it into 2 types of chunks:

1. + Object_name.Attribute_name +
2. " text "

for example, to produce this output:

HK is a male human warrior.

we need to do this:

(I like for my own personal labeling convention~system, to add at the end, this: '_AttributeType', to my Attribute_names, but this has nothing to do with proper syntaxing, as you can label things however you want. I jsut love using underscores and being very descriptive such as what type of attribute it is, as it helps me keep the labels unique, and for me knowing with what I doing and~or dealing with, organization, hehe)

// how it looks as~in scripting:
player.first_name_string = "HK"
player.gender_string = "male"
player.race_string = "human"
player.class_string = "warrior"

// see below of how it looks in code:
<object name="room">
<inherit name="editor_room" />
<object name="player">
<attr name="first_name_string" type="string">HK</attr>
<attr name="gender_string" type="string">male</attr>
<attr name="race_string" type="string">human</attr>
<attr name="class_string" type="string">warrior</attr>
</object>
</object>


// (too lazy to show how it is done via the GUI~Editor's: 'whatever' Object -> Attribute Tab -> Attribute -> Add -> set it up)

HK is a male human warrior.
msg (player.first_name_string + " is a " + player.gender_string + " " + player.race_string + " " + player.class_string + ".")

<function name="function_1">
msg (player.first_name_string + " is a " + player.gender_string + " " + player.race_string + " " + player.class_string + ".")
</function>


msg (player.first_name_string + " is a " + player.gender_string + " " + player.race_string + " " + player.class_string + ".")

so, let's break this up into the chunks:

1. player.first_name_string
2. " is a "
3. player.gender_string
4. " " ~~~~~~~~~~~~~ " (space) "
5. player.race_string
6. " " ~~~~~~~~~~~~~~ " (space) "
7. player.class-string
8. "." ~~~~~~~~~~ " (dot~period, in case your eyes are bad like mine, lol) "

now, it is easier to write it's syntax correctly (now that you got the chunks broken down), as:

msg (player.first_name_string + " is a " + player.gender_string + " " + player.race_string + " " + player.class_string + ".")

// which outputs: HK is a male human warrior.

-----------

as for the other aspect:

USING THE CORRECT ATTRIBUTE TYPES, MATTERS !!!!

String Attribute:

(HAS the quotes on its value, and also on the textual parts if using an Expression)

scripting:

Static [MESSAGE]: Object_name.Attribute_name = "Value"
~OR~
Dynamic [EXPRESSION]: Object_name.Attribute_name = "text" + Object_name.Attribute_name

examples:

player.alias = "HK"
player.first_name_string = "HK"
player.condition = "poisoned"
player.race = "human"
player.gender_string = "male"
game.flag_event_string = "0"
game.flag_event_string = "1"
game.greeting_static = "Hi, my name is HK."
player.greeting_static = "Hi, my name is HK."
orc.greeting_static = "Kill, Die, Kill !"
orc.alias = "kurzog"
player.strength_string = "strong"
player.strength = "strong"
etc etc etc

game.greeting_dynamic = "Hi, my name is " + player.alias + ", what is your name?"
player.greeting_dynamic = "Hi, my name is " + player.alias + ", what is your name?"
orc.greeting_dynamic = "Hi, my name is " + orc.alias + ", what is your name?"

Integer Attributes:

(NO quotes on the value, value must be numerical, as an integer ~ no decimal)

scripting:

Static [MESSAGE]: Object_name.Attribute_name = Value
~OR~
Dynamic [EXPRESSION]: Object_name.Attribute_name = Object_name.Attribute_name (all math equation operations) Object_name.Attribute_name

player.strength = 50
player.strength_integer = 40
orc.endurance = 25
game.flag_event_integer = 0

player.damage = player.weapon.damage + player.weapon.damage * player.strength / 100 - orc.armor.armor_class - orc.armor.armor_class * orc.endurance / 100

///
/// hopefully, you get the idea now ...
///

Object Attributes:

(NO quotes on the Value)

<object name="shield">
</object>

<object name="sword">
</object>

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


player.left_hand_object = shield
player.right_hand_object = sword

Doubles:

(see integers, but they have~use decimals)

player.damage = 59.280153

Lists (String Lists and Object Lists):

game.gender_stringlist = split ("male;female", ";")

etc etc etc attributes

------

lastly, Strings and Integers, can be switched back and forth:

game.event_flag_string = "0"
game.event_flag_integer = 0

game.event_flag_string = ToString (game.event_flag_integer)
game.event_flag_integer = ToInt (game.event_flag_string)

Silver
I never know why you say:
HegemonKhan wrote:
ask if you need any help with anything, ask if you need help with understanding and doing anything.


I mean, it's polite. But it's also the default position of 99.99% of the threads started here: they're already asking for help.

HegemonKhan
aye, I'm just a very polite person (very old fashioned), well, when it's not some political debate that I'm very opinionated and passionate about, laughs.

I just like to say it, to let them know that I'd gladly help them with anything they need, and it's also code heavy too, so I understand that they'll probably need ask about it, as maybe they might assume they're to just look at it and instantly understand it, too embarassed to ask about every part of it, which I don't want to be the case, so, I try to convey that I'm very willing and be glad to help with explaining it step by step to them, until they get it, hehe. I like helping people out (again, as I'm too nice a person in this world, sighs ~ very long stories, lol), especially with coding (as it's practice for me too).

I personally don't like to ask people for help, as I don't want to trouble them, a very libertarian aspect~concept of my personality:

I don't bother you, you don't bother me. Do whatever you want, and let me do whatever I want, so long as what we both do, doesn't interfere with each other (nor others), in doing what we want. If everyone had this foundational libertarian behaviorism, the world would be such a much better+peaceful world, sighs.

Silver
John Lennon wrote a song about this I think.

ReaperOf666
HegemonKhan wrote:aye, I'm just a very polite person (very old fashioned), well, when it's not some political debate that I'm very opinionated and passionate about, laughs.

I just like to say it, to let them know that I'd gladly help them with anything they need, and it's also code heavy too, so I understand that they'll probably need ask about it, as maybe they might assume they're to just look at it and instantly understand it, too embarassed to ask about every part of it, which I don't want to be the case, so, I try to convey that I'm very willing and be glad to help with explaining it step by step to them, until they get it, hehe. I like helping people out (again, as I'm too nice a person in this world, sighs ~ very long stories, lol), especially with coding (as it's practice for me too).

I personally don't like to ask people for help, as I don't want to trouble them, a very libertarian aspect~concept of my personality:

I don't bother you, you don't bother me. Do whatever you want, and let me do whatever I want, so long as what we both do, doesn't interfere with each other (nor others), in doing what we want. If everyone had this foundational libertarian behaviorism, the world would be such a much better+peaceful world, sighs.


Sounds very similar to me! Though I'm still relatively new to the whole concept of 'coding, so I just don't know what all I should be posting or how I should be displaying information.


Now, I've been working on this for 5 and a half hours, and I'm still receiving the SAME EXACT PROBLEM, so I'll go step by step on what I have done, and what I want it to do in the end. Obviously I'm messing up somewhere, or its being done correctly and Quest just won't do what I want it to do!

1) I go to the (player) object and click on the [Attributes] tab.

2) Three windows are there - {Status Attributes}, {Inherited Types}, {Attributes}
-Status Attributes I have problems with (since it only look like it does Strings) but display to the player
-I understand what Inherited Types is (all Attributes from another object this object gets as well) so I skip this one.
-I am left with Attributes, which is the one I've been attempting to use the most.

3) I {Add} a new attribute, and name it

attunement

4) Creating it defaults it to a string, so I change the type to [Integer]

5) Now that I can put a number in, I place [ 5 ] in the value box via the Up/Down arrows and input box.

6) I make 2 other {Attributes}:

coordination
&
fighting

Using the same exact format for the first one.


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

Now I have 3 {Attributes} that are [Integer], and all of their values are [ 5 ].

THE GOAL is to have an equation of attunement+coordination+fighting / 3 (the average, rounding down).

I set this up in a {Status Attribute} called [Ability] and input the following variations (and several more) into the Format String:

player.attunement + player.coordination + player.fighting / 3
= player.attunement + player.coordination + player.fighting / 3
=player.attunement + player.coordination + player.fighting / 3
(player.attunement) + (player.coordination) + (player.fighting) / 3
= (player.attunement) + (player.coordination) + (player.fighting) / 3
=(player.attunement) + (player.coordination) + (player.fighting) / 3

I've also attempted to make this simpler by making another {Attribute} called [ability] and made it a STRING, and have tried inputting all of the same examples from the above into the {Attribute} [ability] Format String.

Then I have proceeded to go to the {Status Attribute} and attempted these formats, and more:

player.ability
= player.ability
=player.ability
+ player.ability +
= + player.ability +
=+ player.ability +
"Your Ability is" + player.ability + "."
= "Your Ability is" + player.ability + "."
="Your Ability is" + player.ability + "."

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

No matter how I go about this, what always, ALWAYS end up showing up is the same exact thing I input ex. /////"Your Ability is" + player.ability + "."/////

Should I not mess with the Status Attributes (game or player? I've tried both)?

If I don't use Status Attributes, how can i display that information to the players when they want it? Make a Command to draw that information up and throw it in a Msg?

Am I inputting the information/formatting it/doing it wrong?


It's driving me crazy! I just hope I'm not missing a silly period anywhere...


Thanks again everyone! <3

I understand most of what you are saying, I just apparently can't get results.

Silver
Would it not be something like:

player.ability = (player.attunement + player.coordination + player.fighting) / 3

HegemonKhan
.

HK's Step by Step Guide (using the 'statusattribute' method):

-----------

Don't worry about being stuck on something for hrs... I still work on figuring stuff out for hrs (even days and entire weeks) too. Coding isn't easy to learn quickly. Try to do something on your own for a bit, but soon as you realize you just can't figure it out, get help, no reason to try to figure out something on your own, when you can't. Sometimes, you can eventually figure something out on your own, but usually not. Give yourself a set time to try to figure out something on your own (say 3-5 hrs), and once that is up, don't waste any more time, go get help. Trying to do stuff on your own is good, as your brain is racing to figuring out how to code something (which is teaching your brain to think in code logic, which is very good, even if you totally fail to figure out how to do the thing). Eventually... we will take less and less time to code stuff correctly... it's a slow learning process, but as the saying goes 'a thousand mile journey, begins with a step, then another, and another, and slowly those small tiny steps will build up to learning to code well".

and sides, it's not your fault, it's my fault for not providing good instructions on how to do it, hehe.

let me try to do a better job, giving you specific instructions, step by step...

------

there's 2-3 ways to display stuff to the person playing the game:

1. the right panes'~sides' boxes: 'inventory', 'places and objects', 'status', 'compass', and etc... (if there's any more of them)

(for stat displayment, we would add to the setup of the the special 'statusattributes' StringDictionary Attribute, which *ONLY* works for the special 'game' Game Object and Player Objects, which makes them appear in the right pane's~side's box called 'status' )

2. the left side's~pane's large text box

(which the main way would be doing it as a Command, adding~using 'msg' Scripts for its scripting)

3. a qwasi-3rd method is via the 'popup window' feature, such as from using the 'show menu' Script.

I'll let you pick which displayment method is best for you and your game.

-----

let's start with the most complex one to set it up correctly: the 'statusattributes' method

the special 'statusattribute' StringDictionary Attribute, is *MERELY TO DISPLAY* the Attributes in the 'status' box during game play. In other words, if your attributes don't exist, they can't be displayed. The 'statusattributes' does *NOT* create attributes, it merely displays them on the right side during game play. This causes some confusion with people. Creating~Adding and Displayment, are two very different things. You can't display an Attribute that doesn't exist, and NOR are you creating an Attribute by just merely causing a displayment of a message for the person playing to see during play.

-----

so, to CREATE (Add) Attributes in the GUI~Editor:

(whatever) Object -> Attributes Tab -> Attributes (NOT Status Attributes) -> Add -> (set them up, see below, repeat as needed for each Attribute)

(Object Name: whatever)
Attribute Name: (whatever)
Attribute Type: (String, Integer ~ int, Boolean, Object, Double, Script, StringList, ObjectList, StringDictionary, ObjectDictionary, ScriptDictionary)
Attribute Value: (whatever, but based upon your Attribute Type, of course)

*HOWEVER, since you want specifically for these Attributes to be displayed in the 'status' box during game play, your Object (that you're adding~creating the Attributes for) must be either:

1. the special 'game' Game Object (highlight the 'Game' Object in the left side's 'tree of stuff', then set up the attributes for it, as shown above)

*The 'game' Game Object holds your game's global settings (which you can set~decide upon), so it's a special~unique Object.

2. Player Objects (such as your default 'player' Player Object or your own custom Player Objects)

so, for what you want (I'll be using the 'player' Player Object as our Object):

'player' Player Object -> Attributes Tab -> Attributes -> Add -> (see below, repeat for each Attribute)

(Object Name: player)
Attribute Name: attunement
Attribute Type: int (integer)
Attribute Value: 5 (just for example, use whatever numerical value you want)

(Object Name: player)
Attribute Name: coordination
Attribute Type: int (integer)
Attribute Value: 5

(Object Name: player)
Attribute Name: fighting
Attribute Type: int (integer)
Attribute Value: 5

now, since you want a math equation (an Expression), this is where (why), you're failing, as you've got no idea that you need to do this unknown tricky part:

as you found out, you can't use a math equation directly for~in your Status Attributes, as it doesn't work as you know quite well. NOR can we use it directly for~in an Attribute as well. For the math equation to work, we need to use Scripting to (indirectly) set it to a (new) Attribute, which we'll then use that in~for the StatusAttributes.

----------

but, before we get to this tricky stuff, let's make one more last Attribute (you'll see why later):

(you were on the right track in your brain thinking, great job!, you almost got it, except there's no way you could know how to do it correctly, yet you still came up with the right way of doing it!)

(Object Name: player)
Attribute Name: ability
Attribute Type: int (integer)
Attribute Value: 0 (this value of '0' is just for you to see it working, obviously if you're starting value is 15 '5+5+5', then you'd hve this set to initially display '15', not '0' )

--------

there's 2 ways to do the needed scripting:

1. using a (global) Turnscript
2. using the special 'changed' Script Attributes

---------

The (global) Turnscript method:

Turnscripts (and Timers) are like '(mostly: depends on their setup and scripting): ALWAYS' running~activating~executing Functions, which works well for updating Stats (Attributes and their displayment via Status Attributes) in games. If you haven't learned about Functions yet (and also if you haven't learned about Commands yet too), then think of them as like your Verbs, except they're open-ended scripting (not tied to an Object).

click on the upper left 'object' in the left side's 'tree of stuff', so that it is highlighted (this is so that our created~added Turnscript will be global, vs just working for~in a specific Room, as we don't obviously want this, as we want to see our updated Attributes everwhere within the game, lol)

(I don't know why 'Turnscript' isn't displayed in the left side's 'tree of stuff', as it's 'twin', Timer, is shown, meh)

now, go to the bar at the top of the screen (due to the above comment), click on the 'add', and select 'Turnscript'.

Turnscript Name: (whatever)
Enabled: yes (check in the toggle box)
Script: (see below)

player.ability = player.attunement + player.coordination + player.fighting


or, via GUI~Editor:

run as script -> add a~new script -> variables -> 'set a variable or attribute' -> [EXPRESSION] -> (see above: just type it in here, or see below, lol)

run as script -> add a~new script -> variables -> 'set a variable or attribute' -> [EXPRESSION] -> player.ability = player.attunement + player.coordination + player.fighting

-------

The special 'changed' Script Attribute method:

(the special 'changed' Script isn't shown in the GUI~Editor, well maybe it is somewhere, meh. I don't know the GUI~Editor's stuff very well, lol)

you just add 'changed' to the beginning of the specific Attributes for the Attribute Name, and set it to Attribute Type: Script, (see below)

and what the 'changed' does is this conceptually: when~if this attribute's value changes, then do the following scripts

but what you can do, to is to create it manually instead, in the GUI~Editor:

'player' Player Object -> Attributes Tab -> Attributes -> Add -> (set it up, repeat for each attribute)

(Object Name: player)
Attribute Name: changedattunement (NO space nor any other character~symbol between 'changed' and your attribute's name, as this is very exact syntaxing needed for it to work)
Attribute Type: Script
Attribute Value: (see below)

player.ability = player.attunement + player.coordination + player.fighting


or, via GUI~Editor:

run as script -> add a~new script -> variables -> 'set a variable or attribute' -> [EXPRESSION] -> (see above: just type it in here, or see below, lol)

run as script -> add a~new script -> variables -> 'set a variable or attribute' -> [EXPRESSION] -> player.ability = player.attunement + player.coordination + player.fighting

(Object Name: player)
Attribute Name: changedcoordination
Attribute Type: Script
Attribute Value: (see below, yes it's the same exact scripting for all 3 of your attributes)

player.ability = player.attunement + player.coordination + player.fighting


or, via GUI~Editor:

run as script -> add a~new script -> variables -> 'set a variable or attribute' -> [EXPRESSION] -> (see above: just type it in here, or see below, lol)

run as script -> add a~new script -> variables -> 'set a variable or attribute' -> [EXPRESSION] -> player.ability = player.attunement + player.coordination + player.fighting

(Object Name: player)
Attribute Name: changedfighting
Attribute Type: Script
Attribute Value: (see below, yes it's the same exact scripting for all 3 of your attributes)

player.ability = player.attunement + player.coordination + player.fighting


or, via GUI~Editor:

run as script -> add a~new script -> variables -> 'set a variable or attribute' -> [EXPRESSION] -> (see above: just type it in here, or see below, lol)

run as script -> add a~new script -> variables -> 'set a variable or attribute' -> [EXPRESSION] -> player.ability = player.attunement + player.coordination + player.fighting

----------

now that we have either the Turnscript or the special 'Changed' Script Attributes, updating our 'ability' Integer Attribute, as the 'attunement', 'coordination', and~or 'fighting' Integer Attributes change ...

NOW, we can set up our Status Attribute:

'player' Player Object -> Attributes Tab -> Status Attributes (NOT Attributes) -> (set it up, see below)

(Object Name: player)
Attribute Name: ability
(Attribute Type: String Dictionary)
Format String (Attribute Value): (see below)

the 'Format String' (Attribute Value) field is a bit confusing~complex, so let me explain it:

actually... let me ignore explaining it for now... as it's outside of this specific step by step guide post for you, lol. I don't want to make this any more confusing than it is already, laughs.

if you want to get into this, then you can see if this helps for now (if not than ask me, and I'll help), I have example game files (hopefully, they'll work for the current quest version, as they're old):

http://forum.textadventures.co.uk/viewtopic.php?f=10&t=4946&start=15#p34198


so, set it up like this:

'player' Player Object -> Attributes Tab -> Status Attributes (NOT Attributes) -> (set it up, see below)

(Object Name: player)
Attribute Name: ability
(Attribute Type: String Dictionary)
Format String (Attribute Value): Ability: !

the '!' will display the Attribute's Value

so, as of right now, conceptual (and in pseudo-code: I'm lazy) explanation of what it will display:

player.ability = 0 (after you see this all working for you, obviously you don't want this to be showing '0', when in this example, it is actually starting at '15', not '0')
player.ability = player.attunement + player.coordination + player.fighting
player.ability = (5) + (5) + (5)
player.ability = 15

Status Attribute:

ability = Ability: !
ability = Ability: (15)

output (what you'll see in the 'status' box during game play):

Ability: 15

and as your 3 Attributes change, it'll adjust to the new sum of them, for example:

player.attunement = 10
player.coordination = 5
player.fighting = 5

output:

Ability: 20
(10 + 5 + 5)

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

oops... forgot this last very important thing... lolololol

the 'status' box will display this:

Ability: 0

until, you cause it to update, which you can do so by (one way):

just click on the command bar at the bottom during game play, and type in whatever, a simple 'p' will do and hit the 'enter' key on your keyboard, and now it should update to show:

Ability: 15

----------

HK edit: err... I forgot you wanted the 'sum of the 3 Attributes divided by 3', hopefully you can know~figure out how to put this into it, if not let me know.

-----------

and now hopefully it works fully for you... let me know if it doesn't (I might be missing or messed up something, or you might have messed something up, let me know, and we'll troubleshoot it, so that it works for you)

-----------

as for the other 1-2 methods (Commands or the 'popup' menu box), if interested, I'll make a separate post for them, as I'm tired now... lol.

HegemonKhan
About Dictionary Attributes:

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

StringDictionary, ObjectDictionary, or ScriptDictionary

they're just really input~output conversions

string1 (input) = string2~object~script (output)

for example:

<game name="xxx1">
<attr name="xxx2" type="simplestringdictionary">1=red;2=blue;3=yellow</attr>
</game>

<function name="xxx3">
msg ("Pick a number, 1-3, and get a color in return!")
get input {
player.color_string = StringDictionaryItem (game.xxx2, result)
msg (player.color_string)
}
</function>

if I typed in 1, output: red
if I typed in 2, output: blue
if I typed in 3, output: yellow

result = 1
player.color_string = StringDictionaryItem (game.xxx2, result)
player.color_string = StringDictionaryItem (game.xxx2, 1)
player.color_string = StringDictionaryItem (1 ===> red)
player.color_string = red

result = 2
player.color_string = StringDictionaryItem (game.xxx2, result)
player.color_string = StringDictionaryItem (game.xxx2, 2)
player.color_string = StringDictionaryItem (2 ===> blue)
player.color_string = blue

result = 3
player.color_string = StringDictionaryItem (game.xxx2, result)
player.color_string = StringDictionaryItem (game.xxx2, 3)
player.color_string = StringDictionaryItem (3 ===> yellow)
player.color_string = yellow


or

<game name="xxx1">
<attr name="strength_integer" type="int">10</attr>
<attr name="endurance_integer" type="int">20</attr>
<attr name="dexterity_integer" type="int">30</attr>
<attr name="statusattributes" type="simplestringdictionary">strength_integer = Strength: !; endurance_integer = Endurace: !; dexterity_integer = Dexterity: !</attr>
</game>

// outputs in the 'status' box during game play:
//
// Strength: 10
// Endurance: 20
// Dexterity: 30
//
// you'd need all the other coding for when your attributes values change, too lazy to re-code this in ~ tired from my big guide post still, lol


So, this is what is going on with the special 'statusattributes' StringDcitionary Attribute:

string1=string2

this is why you can't do an integer math equation, as you're dealing with Strings only, thus it just displays your equation, instead of calculating its value and then in displaying that calculated value; it's a String Expression, not an Integer (or nor Double) Expression.

You got to do the equation outside of the 'statusattribute', and setting that calculated value to an Attribute (via scripting), and then you can display that Attribute (and its value) in the 'statusattribute'.

ReaperOf666
Then go to sleep! I thank you SO MUCH for all of the help! I was beginning to think I was missing a step, and I'm glad I was :)

I'll get around to doing this within the next 24 hours (this PARTICULAR issue has been plaguing me for around 3 weeks, so I want to dedicate a good chunk of time of doing coding as soon as I 'finish' this part up), and I'll report back with either my Success or Failure! I'm tired too, lol!


I'm sure I've got the conceptual grasp on everything, its just the actual DOING OF that I'm trying to learn - and I thank you and everyone else who has given me some suggestions and advise on how to do such things! I hope I'll be able to make a library for Dynamic Menus as soon as I get it fleshed out in my own game :)

Now, just as a simple question (Yes or No - I'll attempt to figure it out on my own), when I get something to display # wise in the game:

Ex. Ability [15]

would it be possible to set something up that changes numbers into words? Ex. 15 = Outstanding 21 = God-Like 3 = Pathetic OR Weakling

I'm sure its possible outside of the Status Attributes ---but is it possible in it?---

EDIT: I think you just answered it - we were 3 minutes apart from that posting :)

HegemonKhan
yes, see my previous post from this one (we must have posted at the same time, lol).

ReaperOf666
Good times! Thank you Thank you Thank you! <3

HegemonKhan
I edited in a bit more to the previous post.

(unfortunately, I do this with most of my posts, as I'm unable to think of everything I want to say in the moment of my initial writing+posting of the post, sighs)

so, you might want to just check any of my (relevant for you ~ on your questions~issues that you need help with) posts over again, here and there, as I might have added (or edited) in more content to them. I try to let people know, but I sometimes forget... (or+and I don't really like making a 'spam' post just to say I edited in more content in my last post, lol).

Silver
ReaperOf666 wrote:Then go to sleep! I thank you SO MUCH for all of the help! I was beginning to think I was missing a step, and I'm glad I was :)

I'll get around to doing this within the next 24 hours (this PARTICULAR issue has been plaguing me for around 3 weeks, so I want to dedicate a good chunk of time of doing coding as soon as I 'finish' this part up), and I'll report back with either my Success or Failure! I'm tired too, lol!


I'm sure I've got the conceptual grasp on everything, its just the actual DOING OF that I'm trying to learn - and I thank you and everyone else who has given me some suggestions and advise on how to do such things! I hope I'll be able to make a library for Dynamic Menus as soon as I get it fleshed out in my own game :)

Now, just as a simple question (Yes or No - I'll attempt to figure it out on my own), when I get something to display # wise in the game:

Ex. Ability [15]

would it be possible to set something up that changes numbers into words? Ex. 15 = Outstanding 21 = God-Like 3 = Pathetic OR Weakling

I'm sure its possible outside of the Status Attributes ---but is it possible in it?---

EDIT: I think you just answered it - we were 3 minutes apart from that posting :)


There's also the text processor for this kind of thing.

msg("You wake up and are feeling {if player.strength<=5:pretty weak}{if player.strength>=6:pretty strong}.")


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

HegemonKhan
The text processor may work within~for the 'statusattribute' too, but I'm not sure though, as I never tried it yet (as I've jsut learned the text processor recently thanks to Jay+Silver, hehe). If it does, it would simply the usage of 'statusattributes' a bit.

Actually... it might not work for the 'statusattribute' as it is a Stringdictionary, whereas the text processor would require a ScriptDictionary Attribute, as the text processor uses the 'msg' Script, and thus you need a ScriptDictionary Attribute:

ScriptDictionary:

string (input) -> script~s (output)

red -> msg ("Hi, my name is {player.name}.")

whereas, a String Dictionary (such as the special 'statusattributes' ):

string1 (input) -> string2 (output)

... err... actually... I'm confused now... as they're both 'msg' Scripts I think... HK is getting himself too confused... I do need to sleep... haha... laughs.

ReaperOf666
Okay! So - here's what my endeavor has brought forth so far - sorry for not updating right away ^.^;; Things come up, as you all know very well!


1) I've created a total of 15 {Double} [Attributes]:
the three to average out into a single one (x3)

What this left me with is making [Status Attributes] that displayed Numbers (HURRAY!)

Problem 1 Solved!

Now, I thought about trying to do a (String Dictionary) like HK suggested, but making it display into the [Status Attribute] was beciming more of a task than anything - so I made 3 more [Attributes] called: ability_name ; mental_name ; physical_name

Then I went to my Turn Script HK helped me make, and made an (If...)
ability_name >=5 [expression] (Pathetic;Paltry)

Then I made the [Status Attributes] display the name, thus outputting the (Pathetuc;Paltry). Danget! Least I did half of what I wanted to do!


Then I realized that I wanted something to randomly pick either adjective, so I had to add a randomness factor somehow... I digged around here a bit and found this post:
http://forum.textadventures.co.uk/viewtopic.php?f=10&t=4987&p=33979&hilit=random#p33979

I'll thank Pixie for this!

I created a 'Pick' function, and revised my (if...) statement to:
ability_name >=5 [expression] Pick ("Pathetic;Paltry")

And it works like a charm!


The only hurtles I have left (simply because I haven't got around to them) is making the
{Points Remaining: X}
when you go into the menu to increase you Attunement, Coordination, Fighting, etc.

That should just be as simple as making an attribute called (attribute_point_buy) and make a message appear with the menu that is something along the lines of
msg ("Points Remaining = (attribute_point_buy)")

Probably typed it out wrong, but coding is much easier to do than write it out :P


I do have another question though:

I've noticed that when you are in a menu, 0 turns go by.
Is it at all possible to make turns occur while a menu is open? That way the [Status Attributes] on the right can be updated (since they are update in my TurnScript?

Otherwise, I'll just make a String List of all the stats as they are updated below the menu - more work, but I'll make it work somehow!


Otherwise, I think it's finished!

Thank you everyone <3

And I hope you slept HK! Quit pulling Long Days!

HegemonKhan
here is a game file (at bottom as attachment) and it's game code (below in th code box), for you to play~study (hopefully you can play~test it, if not, let me know, and I'll get it working for you):

study it, as it shows the different ways~variations of doing the 'statusattribute', see especially:

'hp' Attribute VS 'hit_point' Attribute

and the rest of it, as I demonstrate quite a few more things as well: using the 'game' Object and 'player' Object for 'statusattributes', and etc

I use these two show the two ways of doing the 'statusattribute', let me know if you need me to explain it.

<asl version="560">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="Testing Game Stuff 2">
<gameid>cd102f9d-370a-4bda-b6ea-ca42288f619c</gameid>
<version>1.0</version>
<turns type="int">0</turns>
<statusattributes type="simplestringdictionary">turns =</statusattributes>
</game>
<object name="room">
<inherit name="editor_room" />
<object name="player">
<inherit name="editor_object" />
<inherit name="editor_player" />
<curhp type="int">250</curhp>
<maxhp type="int">500</maxhp>
<current_hit_points type="int">999</current_hit_points>
<maximum_hit_points type="int">999</maximum_hit_points>
<maxhp type="int">500</maxhp>
<hp type="string">0/0</hp>
<strength type="int">100</strength>
<endurance type="int">100</endurance>
<agility type="int">100</agility>
<hit_points type="string">0/0</hit_points>
<statusattributes type="simplestringdictionary">hp = ;hit_points =!;strength =;endurance = !;agility = Your agility is !</statusattributes>
</object>
</object>
<turnscript name="turns_turnscript">
<enabled />
<script>
player.hp = player.curhp + "/" + player.maxhp
player.hit_points = "HP: " + player.current_hit_points + "/" + player.maximum_hit_points
game.turns = game.turns + 1
</script>
</turnscript>
</asl>


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

reaper666 wrote:I've noticed that when you are in a menu, 0 turns go by.
Is it at all possible to make turns occur while a menu is open? That way the [Status Attributes] on the right can be updated (since they are update in my TurnScript?


there might be a way to do so (but as default the 'show menu' choice selection doesn't count as a turn), as 'turns' deals with the internal coding of the quest engine, and while Jay did have a post on the 'order of operations' with how turns work, what counts as 'turns', and etc about turns (somewhere... argh), it was a little bit beyond me, so for this question, you'll need to get help from the good coders here, as I'm not at this understanding yet of how quest's internal coding of its turns, works. They can certainly help you, but on this, I can't help.

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

reaper666 wrote:The only hurtles I have left (simply because I haven't got around to them) is making the
{Points Remaining: X}
when you go into the menu to increase you Attunement, Coordination, Fighting, etc.

That should just be as simple as making an attribute called (attribute_point_buy) and make a message appear with the menu that is something along the lines of
msg ("Points Remaining = (attribute_point_buy)")

Probably typed it out wrong, but coding is much easier to do than write it out


this can be simple or complex (see Pixie's Level Library ~ If you can't find where it's at: if it's not in the 'libraries and sample code' forum board, I'll get it for you).

a simple way is to just have a (my label~naming only, for an example) 'skill_point_integer' Integer Atribute, which you decrease~subtract, each time you make a selection via the 'show menu', see a simple brief non-extensive code example below:

(using 'show menu' and 'switch' and 'split' for this)

the 'switch' is just a different design~method for doing multiple 'if' Scripts:

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

the 'split' is a very quick way to create a list:

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

<function name="level_up_function"><![CDATA[
if (player.skill_point_integer > 0) {
show menu ("Choose a stat to raise", split ("attunement;coordination;fighting", ";"), false) {
switch (result) {
case ("attunement") {
player.attunement_integer = player.attunement_integer + 1
msg ("You've increased your 'attunement' by 1, it's now at {player.attunement_integer}, and you've got {player.skill_point_integer} skill points left.")
level_up_function
}
case ("coordination") {
player.coordination_integer = player.coordination_integer + 1
msg ("You've increased your 'coordination', it's now at {player.coordination_integer}, and you've got {player.skill_point_integer} skill points left.")
level_up_function
}
case ("fighting") {
player.fighting_integer = player.fighting_integer + 1
msg ("You've increased your 'fighting', it's now at {player.fighting_integer}, and you've got {player.skill_point_integer} skill points left.")
level_up_function
}
}
}
} else {
msg ("You're done leveling up, having spent all of your skill points.")
}
</function>


----------

reaper666 wrote:Now, I thought about trying to do a (String Dictionary) like HK suggested, but making it display into the [Status Attribute] was beciming more of a task than anything - so I made 3 more [Attributes] called: ability_name ; mental_name ; physical_name


I'm not exactly clear on what you did with this, but just about 'statusattribute', see below:

the 'statusattribute'.. IS ITSELF.. a String Dictionary (Type) Attribute (but a special one, as it displays in the 'status' pane, unlike all the other String Dictionary Attributes), so you don't want to use your own custom (self made) String Dictionary Attribute.

----

a simple, brief~quick, and poor (inefficient code design) example of what you would use your own custom String Dictionary Attributes for:

using lists is advanced~confusing~complex for people new to coding and~or to quest's coding, and using dictionaries is even more advanced~confusing~complex... so you may not be able to understand this right now, but here it is anyways, hehe:

<object name="global_data_object">
<attr name="month_integer_and_month_string_conversion_stringdictionary" type="simplestringdictionary">1=january;2=february;3=march;4=april;5=may;6=june;7=july;8=august;9=september;10=october;11=november;12=december;january=1;february=2;march=3;april=4;may=5;june=6;july=7;august=8;september=9;october=10;november=11;december=12</attr>
</object>

<function name="month_function_A">
show menu ("What is your month of birth?", split ("1;2;3;4;5;6;7;8;9;10;11;12", ";"), false) {
// I select '7' for example
player.month_integer = ToInt (result)
// player.month_integer = 7
player.month_string = StringDictionaryItem (global_data_obejct.month_integer_and_month_string_conversion_stringdictionary, result)
// player.month_string = "july"
}
</function>

<function name="month_function_B">
show menu ("What is your month of birth?", split ("january;february;march;april;may;june;july;august;september;october;november;december", ";"), false) {
// I select 'september' for example
player.month_string = ToString (result)
// player.month_string = "september"
player.month_integer = ToInt (StringDictionaryItem (global_data_obejct.month_integer_and_month_string_conversion_stringdictionary, result))
// player.month_integer = 9
}
</function>


----------

Random-ness:

(though implementing them, especially their advanced usage, will require some help~explanation from us~me, if you can't figure it out on your own)

http://docs.textadventures.co.uk/quest/ ... eroll.html
http://docs.textadventures.co.uk/quest/ ... hance.html
http://docs.textadventures.co.uk/quest/ ... omint.html
http://docs.textadventures.co.uk/quest/ ... ouble.html

ask if you need any help in understanding these and~or how to implement them (for doing simple things or doing advanced things).

ReaperOf666
Okay!

Everything 'feels' to be finished apart from one thing (see below)!

Here's what I got so far, feel free to look at it and make comments:

<function cc_aspects>
ClearScreen
ShowMenu ("Aspect Points Remaining:" + game.cc_aspect_points + "", Split ("[Ability] Attunement;[Ability] Coordination;[Ability] Fighting;[Mental] Charisma;[Mental] Intelligence;[Mental] Will;[Physical] Agility;[Physical] Endurance;[Physical] Strength; RESET; Done", ";"), false) {
if (result = "[Ability] Attunement") {
player.attunement = player.attunement + 1
game.cc_aspect_points = game.cc_aspect_points - 1
if (game.cc_aspect_points = - 1) {
player.attunement = player.attunement - 1
game.cc_aspect_points = game.cc_aspect_points +1
}
else if (player.attunement = 16) {
player.attunement = player.attunement - 1
game.cc_aspect_points = game.cc_aspect_points +1
}
cc_aspects
}
else if (result = "[Ability] Coordination") {
player.coordination = player.coordination + 1
game.cc_aspect_points = game.cc_aspect_points - 1
if (game.cc_aspect_points = - 1) {
player.coordination = player.coordination - 1
game.cc_aspect_points = game.cc_aspect_points +1
}
else if (player.coordination = 16) {
player.coordination = player.coordination - 1
game.cc_aspect_points = game.cc_aspect_points +1
}
cc_aspects
}
else if (result = "[Ability] Fighting") {
player.fighting = player.fighting + 1
game.cc_aspect_points = game.cc_aspect_points - 1
if (game.cc_aspect_points = - 1) {
player.fighting = player.fighting - 1
game.cc_aspect_points = game.cc_aspect_points +1
}
else if (player.fighting = 16) {
player.fighting = player.fighting - 1
game.cc_aspect_points = game.cc_aspect_points +1
}
cc_aspects
}
else if (result = "[Mental] Charisma") {
player.charisma = player.charisma + 1
game.cc_aspect_points = game.cc_aspect_points - 1
if (game.cc_aspect_points = -1) {
player.charisma = player.charisma - 1
game.cc_aspect_points = game.cc_aspect_points +1
}
else if (player.charisma = 16) {
player.charisma = player.charisma - 1
game.cc_aspect_points = game.cc_aspect_points +1
}
cc_aspects
}
else if (result = "[Mental] Intelligence") {
player.intelligence = player.intelligence + 1
game.cc_aspect_points = game.cc_aspect_points - 1
if (game.cc_aspect_points = - 1) {
player.intelligence = player.intelligence - 1
game.cc_aspect_points = game.cc_aspect_points +1
}
else if (player.intelligence = 16) {
player.intelligence = player.intelligence - 1
game.cc_aspect_points = game.cc_aspect_points +1
}
cc_aspects
}
else if (result = "[Mental] Will") {
player.will = player.will + 1
game.cc_aspect_points = game.cc_aspect_points - 1
if (game.cc_aspect_points = - 1) {
player.will = player.will - 1
game.cc_aspect_points = game.cc_aspect_points +1
}
else if (player.will = 16) {
player.will = player.will - 1
game.cc_aspect_points = game.cc_aspect_points +1
}
cc_aspects
}
else if (result = "[Physical] Agility") {
player.agility = player.agility + 1
game.cc_aspect_points = game.cc_aspect_points - 1
if (game.cc_aspect_points = - 1) {
player.agility = player.agility - 1
game.cc_aspect_points = game.cc_aspect_points +1
}
else if (player.agility = 16) {
player.agility = player.agility - 1
game.cc_aspect_points = game.cc_aspect_points +1
}
cc_aspects
}
else if (result = "[Physical] Endurance") {
player.endurance = player.endurance + 1
game.cc_aspect_points = game.cc_aspect_points - 1
if (game.cc_aspect_points = - 1) {
player.endurance = player.endurance - 1
game.cc_aspect_points = game.cc_aspect_points +1
}
else if (player.endurance = 16) {
player.endurance = player.endurance - 1
game.cc_aspect_points = game.cc_aspect_points +1
}
cc_aspects
}
else if (result = "[Physical] Strength") {
player.strength = player.strength + 1
game.cc_aspect_points = game.cc_aspect_points - 1
if (game.cc_aspect_points = - 1) {
player.strength = player.strength - 1
game.cc_aspect_points = game.cc_aspect_points +1
}
else if (player.strength = 16) {
player.strength = player.strength - 1
game.cc_aspect_points = game.cc_aspect_points +1
}
cc_aspects
}
else if (result = "RESET") {
}
else if (result = "Done") {
ClearScreen
MoveObject (player, Character Creation)
}
}
msg (player.attunement + " Attunement: Info")
msg (player.coordination +" Coordination: Info")
msg (player.fighting + " Fighting: Info")
msg (player.charisma + " Charisma: Info")
msg (player.intelligence + " Intellignece: Info")
msg (player.will + " Will: Info")
msg (player.agility + " Agility: Info")
msg (player.endurance + " Endurance: Info")
msg (player.strength + " Strength: Info")
</function>


The only problem I'm experiencing is that I can't make the 'RESET' option work, aka, setting the stats back to 5 and the points remaining to 45.

The only way my newb programming mind could think of such a way was using this:

if (game.cc_aspect_points <= 45)
game.cc_aspect_points = 45

If (player.attunement >= 5)
player.attunement = 5

etc.


I thought, mentally, of making the increase of a stat and decrease of the cc_aspect_points a 'variable' (b / d) and simply do an equation like
if (game.cc_aspect_points <= 45)
game.cc_aspect_points = game.cc_aspect_points + d

if (player.attuement >= 5)
player.attunement = player.attunement - b

etc.


But I've yet to figure out how to do that.

Wish I could just say "I WANT IT TO WORK THIS WAY" and it be done, lol!

Hope everyone's help until now reflects in what I've accomplished so far! I'm super proud of it, even if it's sloppy!

-------------
P.S. As for the randomness thing, I am fine with what I have in my Turn Script, see below (Really sloppy, I know, Can probably throw into a function (or 3) to make it easier I suppose :P)
<function Pick>
l = Split(lst, ";")
n = GetRandomInt(0, ListCount(l) - 1)
return (StringListItem(l, n))
</function>

<Game Turn Script>
player.ability = (player.attunement + player.coordination + player.fighting) / 3
if (player.ability < 1) {
player.ability_name = Pick ("Useless;Non-Existent")
}
else if (player.ability < 2) {
player.ability_name = Pick ("Worthless;Insignificant")
}
else if (player.ability < 3) {
player.ability_name = Pick ("Inefficacious;Pitiful")
}
else if (player.ability < 4) {
player.ability_name = Pick ("Faulty;Deficient")
}
else if (player.ability < 5) {
player.ability_name = Pick ("Scarce;Insufficient")
}
else if (player.ability < 6) {
player.ability_name = Pick ("Pathetic;Paltry")
}
else if (player.ability < 7) {
player.ability_name = Pick ("Measly;Impractical")
}
else if (player.ability < 8) {
player.ability_name = Pick ("Ineffective;Unavailing")
}
else if (player.ability < 9) {
player.ability_name = Pick ("Feeble;Poor")
}
else if (player.ability < 10) {
player.ability_name = Pick ("Restrained;Meager")
}
else if (player.ability < 11) {
player.ability_name = Pick ("Decent;Fair")
}
else if (player.ability < 12) {
player.ability_name = Pick ("Common;Ordinary")
}
else if (player.ability < 13) {
player.ability_name = Pick ("Standard;Typical")
}
else if (player.ability < 14) {
player.ability_name = Pick ("Legitimate;Innate")
}
else if (player.ability < 15) {
player.ability_name = Pick ("Reasonable;Moderate")
}
else if (player.ability < 16) {
player.ability_name = Pick ("Exceptional;Extraordinary")
}
else if (player.ability < 17) {
player.ability_name = Pick ("High-Caliber;First-Rate")
}
else if (player.ability < 18) {
player.ability_name = Pick ("Unparalleled;Unprecedented")
}
else if (player.ability < 19) {
player.ability_name = Monstrous
}
else if (player.ability < 20) {
player.ability_name = Unearthly
}
else if (player.ability < 21) {
player.ability_name = Demi-God
}
else if (player.ability < 22) {
player.ability_name = God-Like
}
</Game Turn Script>

HegemonKhan
Code looks good so far, great job!

(It's such a 'rush~high' when you get and see your code working as a playable game file, hehe. You're proud even if it is very messy~bad~poor code design, who cares, it works, it's functional! You can always later on, go back and try to refine it ~ make it better, more efficient, short, concise)

(when I finally got my combat code to work, I was so elated, I called my post, 'Veni Vidi Veci!", hehe. Then Pertex refines it in like 2 minutes, and my mouth drops, doh..! lol.. I'm going to try to get to get good at coding... eventually... hopefully to their levels, hehe)

(if you want to see my own progress~struggle with learning to code for my very first time ever: with quest!, I was so overwhelmed just with all of the terms when I started ~ after finishing the tutorial, lol, take a look at this noobie thread of mine: viewtopic.php?t=3348 )

(as you learn more about quest's coding, and coding, you'll be able to craft, better ~ more efficient ~ shorter ~ more concise, code, but it's a slow learning process to learn more and more code designs and methods)

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

reaper666 wrote:The only problem I'm experiencing is that I can't make the 'RESET' option work, aka, setting the stats back to 5 and the points remaining to 45.


you literally set them to what you want (if you have~know those specific values, of course ~ if not, than it's more complex code), since they're~you're selecting 'reset', this is all you need for its scripts:

'reset' menu list choice selection's scripts:

game.cc_aspect_points = 45
player.attunement = 5
player.coordination = 5
etc etc etc

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

a code trick for 'reverting' is this, for example:

player.strength = 50

before you change an Attribute (player.strength), create a new one and set it to your (unchanged) Attribute's value, via an example:

player.strength_old = player.strength

conceptually: player.strength_old = player.strength = 50
conceptually: player.strength_old = 50

now, we can change our Attribute (player.strength), as normal:

player.strength = player.strength + 25

player.strength = 50 + 25 = 75

now, to revert back to our old value:

player.strength = player.strength_old

player.strength = 50

----------

you can do this with~for ANY Attribute Type (Strings, Integers, Doubles, Booleans, Objects, Scripts, Lists, Dictionaries), for example:

room.description = msg ("You find yourself in a dense thick jungle.")

room.description_old = room.description
conceptually: room.description_old = room.description = msg ("You find yourself in a dense thick jungle.")
conceptually: room.description_old = msg ("You find yourself in a dense thick jungle.")

new value (setting):

room.description = msg ("You're in a spooky haunted old house.")

reverting back to old value:

room.description = room.description_old
conceptually we're back to our old value: room.description = msg ("You find yourself in a dense thick jungle.")

--------

as for your randomness section of your post, if it works for you, awesome!

(I've actually not delved into this type of string concatinating~construction~parsing that you're doing, so you're already coding in this aspect at a higher level than me, hehe)

------

also, you can shorten these parts of your code up:

if (result = "[Ability] Attunement") {
player.attunement = player.attunement + 1
game.cc_aspect_points = game.cc_aspect_points - 1
if (game.cc_aspect_points = - 1) {
player.attunement = player.attunement - 1
game.cc_aspect_points = game.cc_aspect_points +1
}
else if (player.attunement = 16) {
player.attunement = player.attunement - 1
game.cc_aspect_points = game.cc_aspect_points +1
}
cc_aspects
}


by doing this structure~design (well actually method~way, whatever) instead:

if (result = "[Ability] Attunement") {
if (game.cc_aspect_points > 0 and player.attunement <= 15) {
player.attunement = player.attunement + 1
game.cc_aspect_points = game.cc_aspect_points + 1
} else {
msg ("Sorry, but you've reached your limit.")
}
} else if (result = "[Ability] Coordination") {
if (game.cc_aspect_points > 0 and player.coordination <= 15) {
player.coordination = player.coordination + 1
game.cc_aspect_points = game.cc_aspect_points + 1
} else {
msg ("Sorry, but you've reached your limit.")
}
}
// etc 'else ifs'
cc_aspects


and we can actually shorten this code much more too with even better methods~ways, but they're much more code advanced too.

ReaperOf666
I quite literally am stumped:

The Reset button? I've tried both methods you've listed (copy pasted :P) and neither of them are changing the values when I call upon for them to work.

Even looking at the Debugger, nothing has changed at ALL. Period.

Spelling isn't an issue, and I thought something else I had in the game was one, so I just tore out the menu feature I made and made an entirely new game with it - it still refuses to work for whatever reason.

I've even gone as a last resort to try the third way I wanted to do - a variable. I made an extra attribute for all of them called (player.x_variable; game.x_variable), and added to my menu that when you choose an option, it adds +1 to the appropriate variable.
When you hit the reset button, for the character 'stats', it is
[player.stat - player.stat_variable], which should always be 5 (the stats only increase, so it makes sense to decrease them;
the other is
[game.points + game.points_variable] which should always be 45 (the points only decrease, so it makes sense to increase it)

and even this refuses to work.

I don't think it's that I have 1 a game attribute and 9 player attributes, nor do I think I've misspelled anything or mis-typed anything (I've made sure I didn't miss any periods among all things!).

Is it because I am calling upon the attributes too often through so many things and it refuses to update because it's confused? (Ex. Turn Script when game begins; below the menu to display amount of current points at that particular moment)

Perhaps it's because I'm using it as a function to display it, and/or am using a menu to do all of this?

I am so confused T.T

((My last post is pretty much everything I have, so feel free to try it out.))

I call shenanigans!

The Pixie
The problem is in this line:

ShowMenu ("Aspect Points Remaining:" + game.cc_aspect_points + "", Split ("[Ability] Attunement;[Ability] Coordination;[Ability] Fighting;[Mental] Charisma;[Mental] Intelligence;[Mental] Will;[Physical] Agility;[Physical] Endurance;[Physical] Strength; RESET; Done", ";"), false) {

You have a space before RESET, so when the player clicks that option, the value in result is " RESET", and your code is looking for "RESET". Just to make this harder to spot, ShowMenu actually trims the leading space when it shows the options, so what you see is "RESET".


By the way, it is generally better to do repetitive things in loops. If you want to change how the values are displayed, you only have to make one change; if you decide to remove or add an attribute, you just make one change; etc. It can also a lot shorter. I took the liberty of re-writing your code so rather than doing each attribute in turn, it loops through an array of them, to show what I mean.

// Set up the menu options
// You could put this in your start script
// Do not have spaces after the semi-colon!
game.att_names = Split ("[Ability] Attunement;[Ability] Coordination;[Ability] Fighting;[Mental] Charisma;[Mental] Intelligence;[Mental] Will;[Physical] Agility;[Physical] Endurance;[Physical] Strength;RESET;Done", ";")

ClearScreen
ShowMenu ("Aspect Points Remaining:" + game.cc_aspect_points + "", game.att_names, false) {

// Do reset and done first; all the rest can be caught together in a loop
if (result = "RESET") {
// Iterate through each menu option
foreach (att, game.att_names) {
// Skip the last two
if (not att = "Done" and not att = "RESET") {
// The next line will convert "[Ability] Attunement" to "attunement"
attname = LCase(StringListItem(Split(att, " "), 1))
game.cc_aspect_points = game.cc_aspect_points + GetInt(player, attname) - 5
set (player, attname, 5)
}
}
cc_aspects
}

else if (result = "Done") {
ClearScreen
MoveObject (player, Character Creation)
}

else {
foreach (att, game.att_names) {
if (result = att) {
// The next line will convert "[Ability] Attunement" to "attunement"
attname = LCase(StringListItem(Split(att, " "), 1))
// Only change the value if we have the points and have not hit the limit yet
if (GetInt(player, "attunement") < 16 and game.cc_aspect_points > 0) {
set (player, attname, GetInt(player, attname) + 1)
game.cc_aspect_points = game.cc_aspect_points - 1
}
cc_aspects
}
}
}
}

foreach (att, game.att_names) {
if (not att = "Done" and not att = "RESET") {
attname = LCase(StringListItem(Split(att, " "), 1))
msg (GetInt(player, attname) + " " + CapFirst(attname) + ": Info")
}
}

HegemonKhan
another 'space' character~symbol issue (hehe, doh!) ... I think this has been like the 3rd-4th that it has come up, making everyone pull their hair out, lol. (good catch Pixie, else we'd have been troubleshooting for a long time... laughs)

Be very very very careful when you copy(-n-paste) and~or type... make very sure there's no 'space' character~symbol where there shouldn't be one, hehe.

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

Support

Forums