I'd like some help with the level library (SOLVED FINALLY)

Anthony the tiger
26 Aug 2017, 07:48(now that this issue has been solved, I'd like to personally say thank you to all those that put in the effort to help me. I really do appreciate your efforts. I learned more about code along the way and this experience brings me one step closer to finishing the game I've been working on!)
So now I have been testing out the level library in quest, only one issue is getting these attributes to mean something.
http://imgur.com/a/qlozA in that link it displays a loose idea of what I want to do and I explain what the function does or should do. So in the level library, you can assign points to a list of attributes. In short, this function says "hey let's get the value of intelligence" the system idealistically gets that value from the points assigned by the player. In the example the player picks 0 stats points in intelligence 0+0 = 0 hey would you look at that it gives them the top result or at least should. In the one below it, the player picks 1 stat point in intelligence 0+1 =1 so the player gets the bottom result. I am wondering if that would be the correct way to do such a thing.
ShadowsEdge19
26 Aug 2017, 09:23You question didn't seen all that clear to me but here's my thoughts.
I'm wondering why you need to return "0 + game.pov.intelligence" instead of just "game.pov.intelligence", there is nothing to gain by the calculation since you don't alter the intelligence attribute inside that function.
Also it might be best if you don't name objects with spaces, its okay with the Alias but the Name attribute can be tricky with ambiguous titles, I know many languages that can't handle spaces.

Anthony the tiger
26 Aug 2017, 11:16So should the return type be none then? The best way for me to clarify things is: what I displayed in this function the poper way to do something like this?

Anthony the tiger
26 Aug 2017, 11:24So I removed the return being the 0+ and nothing changes when I call up the function it doesn't cause any errors but it doesn't recognize any value change. do I have to set up the variable in the function? am I missing something here?

K.V.
26 Aug 2017, 11:34Hello,
Try deleting the Set this function's return value...
part (the first line of the script). Then change the return type from Integer
to none
.
game.pov.intelligence
is an attribute on the game.pov object, and it shouldn't need anything returned (unless you have more code that I can't see).
It doesn't look like you need to return anything for this to work though. As long as you have game.pov.intelligence = 0
in your Start Script (or the attribute set up on every object the player could become), it should work.
NOTE: You may not wish to start the player with 0 intelligence. That was just an example.
jmnevil54
26 Aug 2017, 15:29You're making it too complicated.
I can't tell what you want. Do you want to see an attribute, or make a level up function?
If you need a level up system, make an attribute like player.level = 0. Then type something like this.
'''
if (player.exp >= player.level * 310 + 100) {
player.level = player.level + 1
msg ("You are level " + player.level + ".")
player.defence = player.defence + 1
player.attack = player.attack + 1
player.damage = player.damage + 1
player.hitpoints = player.hitpoints + 5
player.max = player.max + 5
}
'''
Then you can type something like.
msg (CapFirst(attacker.alias) + " attack " + target.alias + " and get a critical (" + damage + " hits)!")
target.hitpoints = target.hitpoints - damage
}
Or.
msg ("You are level " + player.level + ".")

Anthony the tiger
26 Aug 2017, 17:04Jmevil I hoped the image would make it clear enough what I want to do. But I will explain it again. I want an attribute witha changing value. This value going from 0-10 the player has a max ammount of points they can spend so they don't put 10 into each stat I have made. The key stat intelligence affects the names of objects. So when i call up that function it says something different. Imagine something like fallout's speech system for an example. You get some sort of class skill/invisible factor that changes dialogue. Bringing up new options. I hope that clarifies things.
hegemonkhan
26 Aug 2017, 18:50(filler for getting edited post, updated/posted)
here's an example on actions/events based upon an (Integer) Attribute's Value (see the 'changedscore' Script Attribute of the 'test' Object, specifically):
(a school test/exam, having a 'score' and a 'grade' associated with it)
<game name="example_game">
<attr name="start" type="script">
do (test, "run")
</attr>
</game>
<object name="test">
<attr name="score" type="int">0</attr>
<attr name="grade" type="string">unknown</attr>
<attr name="run" type="script">
do (this, "set_score")
do (this, "view")
ask ("Again?") {
if (result) { // if (true/yes)
do (this, "run")
} else { // if (false/no)
msg ("You decided to stop")
}
}
</attr>
<attr name="set_score" type="script">
<![CDATA[
msg ("Input Score (0 to 100)")
get input {
ClearScreen
if (IsInt (result)) {
input_integer_variable = ToInt (result)
if (input_integer_variable >= 0 and input_integer_variable < 101) {
this.score = input_integer_variable
} else { // wrong input (input needs to be from 0 to 100: input is 'out of bounds')
do (this, "set_score")
}
} else { // wrong input (input needs to be an integer: non-decimal number)
do (this, "set_score")
}
}
]]>
</attr>
<attr name="view" type="script">
ClearScreen
msg ("Name: " + this.name)
msg ("Score: " + this.score)
msg ("Grade: " + this.grade)
wait {
ClearScreen
}
</attr>
<attr name="changedscore" type="script">
<![CDATA[
if (this.score > 100) {
this.score = 100
} else if (this.score < 0) {
this.score = 0
}
if (this.score > 89) {
this.grade = "A"
} else if (this.score > 79) {
this.grade = "B"
} else if (this.score > 69) {
this.grade = "C"
} else if (this.score > 59) {
this.grade = "D"
} else {
this.grade = "F"
}
]]>
</attr>
</object>
if you need help on using/doing Pixie's 'level up' library, let me know, it's complicated and not easy to understand and get right.
in quest, there's 3 types of VARIABLES (keeping this simple):
VARIABLES:
- Variables
- Attributes
- Parameters
'Variable' VARIABLES are local/temporary, they're destroyed upon their parent's scripting ending, and can't be used outside of their parent's scripting either (ERROR: 'out of scope').
an example:
NAME_OF_Variable = VALUE_OR_EXPRESSION
<game name="example_game">
<attr name="start" type="script">
msg ("Name?")
get input {
// quest automatically (hidden from you) stores your input into the built-in 'result' Variable: result = YOUR_INPUT
msg ("Your name is: " + result) // NO error
do (example_object, "example_script") // ERROR !!! (see below)
}
</attr>
</game>
<object name="example_object">
<attr name="example_script" type="script">
msg ("Your name is: " + result) // ERROR !!! the 'result' Variable doesn't exist!
</attr>
</object>
'Attribute' VARIABLES are global/permanent (so long as its parent Object: exists / still exists), you can use them anywhere/everywhere and as much as you want.
The only negative is that changing its Value, is changing its Value, aka: the changed Value is it's new Value, and thus now that new Value is being used where-ever/when-ever you're using the Attribute
an example:
NAME_OF_OBJECT.NAME_OF_ATTRIBUTE = VALUE_OR_EXPRESSION
<game name="example_game">
<attr name="example_string_attribute" type="string">unknown</attr>
<attr name="start" type="script">
msg ("Name?")
get input {
// quest automatically (hidden from you) stores your input into the built-in 'result' Variable: result = YOUR_INPUT
game.example_string_attribute = result
msg ("Your name is: " + game.example_string_attribute) // NO error
do (example_object, "example_script") // NO error
}
</attr>
</game>
<object name="example_object">
<attr name="example_script" type="script">
msg ("Your name is: " + game.example_string_attribute) // NO error
</attr>
</object>
'Parameter' VARIABLES deals with Functions, Commands, and Objects+Script_Attributes+Delegates, basically they're a way of transferring Data (the Arguments/inputs as direct/literal Values or as VARIABLES storing the Values) to or from: Functions, Commands, and Objects+Script_Attributes+Delegates

Anthony the tiger
26 Aug 2017, 18:55KV
Aug 26, 2017 6:34 AM (edited)
Hello,
Try deleting the Set this function's return value... part (the first line of the script). Then change the return type from Integer to none.
game.pov.intelligence is an attribute on the game.pov object, and it shouldn't need anything returned (unless you have more code that I can't see).
It doesn't look like you need to return anything for this to work though. As long as you have game.pov.intelligence = 0 in your Start Script (or the attribute set up on every object the player could become), it should work.
NOTE: You may not wish to start the player with 0 intelligence. That was just an example.
alright, that works for setting up the attribute, but what if I wanted to increase that number to say 1? what if I wanted to create a limit between 3 attributes. for example, I want the player to have 14 max points between three attributes each attribute going up to 10. Would I use a command that would tell the player: "you've reached the max amount of points." or would that be a function?
hegemonkhan
26 Aug 2017, 19:13Pixie's 'level' (level up) library's GUI/UI creation, handles manually increasing stats well (you click on arrow buttons to increase or decrease the stats as you decide where and how much to place the points into them), whereas, just using scripting is much more clunky. So, I'd recommend you use Pixie's 'level' library, ask and we can help you alter it for your game's stats and etc needs/wants
here's the basic ways of adjusting Integer (non-decimal numbers) and/or Double (decimal numbers) Attributes:
(the examples are only of using Integer Values/Attributes)
Arithmetic Operations:
Addition example:
player.strength = player.strength + 5
Subtraction example:
player.strength = player.strength - 9
Multiplication example:
player.strength = player.strength * 3
Division example:
player.strength = player.strength / 2
conceptually how it works (using an addition example):
initial Value: player.strength = 0
// old Value: player.strength = 0
player.strength = player.strength + 2
// player.strength (NEW) = player.strength (OLD: 0) + 2
// player.strength (NEW) = (0) + 2 = 2
// new Value: player.strength = 2
// old Value: player.strength = 2
player.strength = player.strength + 2
// player.strength (NEW) = player.strength (OLD: 2) + 2
// player.strength (NEW) = (2) + 2 = 4
// new Value: player.strength = 4
// old Value: player.strength = 4
player.strength = player.strength + 2
// player.strength (NEW) = player.strength (OLD: 4) + 2
// player.strength (NEW) = (4) + 2 = 6
// new Value: player.strength = 6
you get the idea...
more about it
this is programming's 'Assignment' Operation, even though it's using the '=' operator/operation, which is different than Math's addition operation and its '= (comparison)' operator
VARIABLE = VALUE_OR_EXPRESSION
the 'VALUE_OR_EXPRESSION' is being STORED INTO the 'VARIABLE'
the 'VARIABLE' MUST BE ON LEFT SIDE of the '=' operator
the 'VALUE_OR_EXPRESSION' MUST BE ON RIGHT SIDE of the '=' operator
VALUE_OR_EXPRESSION = VARIABLE // ERROR !!!!!
// NO error (programming):
sum = 5 + 4
// sum = 9
// ERROR (programming):
5 + 4 = sum
// NO errors (math):
5 + 4 = sum
sum = 5 + 4
we're doing the programming's 'Assignment' operation, this is NOT a math's 'addition' operation (well, the '4+5' part of the expression of the full statement is a math 'addition' operation, but the full statement, due to the '=' operator, is an 'Asssignment' Operation)
Assignment vs Comparison:
Math Comparison's '=' operator:
// 9 = 9:
4 + 5 = 9
9 = 4 + 5
// sum = 9:
4 + 5 = sum
sum = 4 + 5
Programming's Assigment '=' operator:
sum = 4 + 5
// sum = 9
Programming's Comparison '=' operator:
if (sum = 4 + 5) { msg ("true") } else { msg ("false") }
if (4 + 5 = sum) { msg ("true") } else { msg ("false") }
// sum = 9
if (sum = 4 + 5) { msg ("true") } else { msg ("false") }
// output: true
if (4 + 5 = sum) { msg ("true") } else { msg ("false") }
// output: true
// sum = 0
if (sum = 4 + 5) { msg ("true") } else { msg ("false") }
// output: false
if (4 + 5 = sum) { msg ("true") } else { msg ("false") }
// output: false

K.V.
27 Aug 2017, 03:22Are you using this?
<library>
<!--
LevelLib is a basic character creation and levelling library for Quest. See the Wiki How to guide for details.
Version 1.0
Quest version: 5.4
Written by: The Pixie
-->
<command name="IncCommand">
<pattern>Inc #text#</pattern>
<script><![CDATA[
if (TotalAttributes() < game.pov.maxpoints) {
value = GetAttribute(game.pov, text)
set (game.pov, text, value+1)
}
ChooseAttributes
]]></script>
</command>
<command name="DecCommand">
<pattern>Dec #text#</pattern>
<script><![CDATA[
value = GetAttribute(game.pov, text)
oldvalue = GetAttribute(game.pov, text+"_old")
if (value > oldvalue) {
set (game.pov, text, value-1)
}
ChooseAttributes
]]></script>
</command>
<command name="LevellingDoneCommand">
<pattern>Levelling Done</pattern>
<script>
ClearScreen
request (Show, "Command")
game.showdescriptiononenter = game.remembershowdescriptiononenter
ShowRoomDescription
game.notarealturn = true
</script>
</command>
<command name="LevellingCommand">
<pattern>level</pattern>
<script>
LevelUp
</script>
</command>
<function name="LevelUp"><![CDATA[
game.remembershowdescriptiononenter = game.showdescriptiononenter
game.showdescriptiononenter = false
request (Hide, "Command")
foreach (att, game.pov.attlist) {
if (not HasInt (game.pov, att)) set (game.pov, att, 0)
set (game.pov, att + "_old", GetInt (game.pov, att))
}
ChooseAttributes
]]></function>
<function name="ChooseAttributes"><![CDATA[
ClearScreen
msg ("Assign points to attributes (" + (game.pov.maxpoints - TotalAttributes()) + ")")
foreach (att, game.pov.attlist) {
msg (att + ": {command:Dec " + att + ":<} {" + game.pov.name + "." + att + "} {command:Inc " + att + ":>}")
}
msg ("{command:Levelling Done:Done}")
game.notarealturn = true
]]></function>
<function name="TotalAttributes" type="int">
total = 0
foreach (att, game.pov.attlist) {
total = total + GetInt (game.pov, att)
}
return (total)
</function>
<function name="PointsLeft" type="int">
return (game.pov.maxpoints - TotalAttributes())
</function>
</library>

K.V.
27 Aug 2017, 03:30Check this out:
https://github.com/ThePix/quest/wiki/CombatLib-Part-11:-Character-Creation#cool
hegemonkhan
27 Aug 2017, 06:32@ Anthony the tiger:
for what you want (thanks for the PM: sorry for not answering your topic correctly until now), you need something that is either:
- constantly checking an Attribute (Turnscript/Timer)
- activating when an Attribute's Value changes (the special 'changedNAME_OF_ATTRIBUTE' Script Script)
- the easiest is using the special 'changedNAME_OF_ATTRIBUTE' Script Attribute:
(if you want to use a Turnscript/Timer instead, let me know)
an example:
(using the String Dictionary Attribute usage too)
<game name="example_game">
<attr name="start" type="script">
do (player, "run")
</attr>
</game>
<object name="player">
<attr name="alias" type="string">unknown</attr>
<attr name="intelligence" type="int">-1</attr>
<attr name="run" type="script">
do (this, "set_intelligence")
do (this, "view")
ask ("Again?") {
if (result) { // if (true/yes)
do (this, "run")
} else { // if (false/no)
msg ("You decided to stop")
}
}
</attr>
<attr name="set_intelligence" type="script">
<![CDATA[
msg ("Input Intelligence (0 to 10)")
get input {
ClearScreen
if (IsInt (result)) {
input_integer_variable = ToInt (result)
if (input_integer_variable > -0 and input_integer_variable < 11) {
this.intelligence = input_integer_variable
} else {
do (this, "set_intelligence")
}
} else {
do (this, "set_intelligence")
}
}
]]>
</attr>
<attr name="view" type="script">
ClearScreen
msg ("Intelligence: " + this.intelligence)
msg ("Alias: " + this.alias)
wait {
ClearScreen
}
</attr>
<attr name="changedintelligence" type="script">
<![CDATA[
if (this.intelligence > 10) {
this.intelligence = 10
} else if (this.intelligence < 0) {
this.intelligence = 0
}
intelligence_string_variable = ToString (this.intelligence)
this.alias = StringDictionaryItem (this.intelligence_to_alias, intelligence_string_variable)
]]>
</attr>
<attr name="intelligence_to_alias" type="stringdictionary">
<item>
<key>0</key>
<value>jax</value>
</item>
<item>
<key>1</key>
<value>joe</value>
</item>
<item>
<key>2</key>
<value>jim</value>
</item>
<item>
<key>3</key>
<value>jeff</value>
</item>
<item>
<key>4</key>
<value>john</value>
</item>
<item>
<key>5</key>
<value>jack</value>
</item>
<item>
<key>6</key>
<value>joel</value>
</item>
<item>
<key>7</key>
<value>jake</value>
</item>
<item>
<key>8</key>
<value>johan</value>
</item>
<item>
<key>9</key>
<value>jacob</value>
</item>
<item>
<key>10</key>
<value>james</value>
</item>
</attr>
</object>

K.V.
27 Aug 2017, 09:22I've been playing with ASLEvents and <button> elements lately, and I came up with this:
CLICK HERE TO VIEW THE ENTIRE CODE
<!--Saved by Quest 5.7.6404.15496-->
<asl version="550">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="atts">
<gameid>cf4af96d-68d4-4bed-bc97-047a4842ec4e</gameid>
<version>1.0</version>
<firstpublished>2017</firstpublished>
<showtitle type="boolean">false</showtitle>
<author>KV</author>
</game>
<object name="room">
<inherit name="editor_room" />
<description type="script"><![CDATA[
msg ("{if player.attributetokens>0:<center><br/><br/><button title=\"Increase Strength from {=player.strength} to {=player.strength+1}\" onclick=\"ASLEvent('incAtt','strength')\">ADD TO STRENGTH</button><br> Strength: {=player.strength}<br/><br/><button title=\"Increase Intelligence from {=player.intelligence} to {=player.intelligence+1}\" onclick=\"ASLEvent('incAtt','intel')\">ADD TO INTELLIGENCE</button><br> Intelligence: {=player.intelligence}<br/><br/><button title=\"Increase Mastery of Magic from {=player.magicMastery} to {=player.magicMastery+1}\" onclick=\"ASLEvent('incAtt','magic')\">ADD TO MASTERY OF MAGIC</button><br> Mastery of Magic: {=player.magicMastery}<br/><br/><center>}")
]]></description>
<beforeenter type="script">
request (Hide, "Command")
</beforeenter>
<descprefix type="string"></descprefix>
<usedefaultprefix type="boolean">false</usedefaultprefix>
<enter type="script"><![CDATA[
msg ("<br/>You have {=player.attributetokens} token{if player.attributetokens<>1:s} to set on Strength, Intelligence, or Mastery of Magic.<br/>")
]]></enter>
<alias>PLEASE SET UP YOUR ATTRIBUTES</alias>
<object name="player">
<inherit name="editor_object" />
<inherit name="editor_player" />
<attributetokens type="int">14</attributetokens>
<statusattributes type="stringdictionary">
<item>
<key>attributetokens</key>
<value>Available Attribute Points: !</value>
</item>
<item>
<key>strength</key>
<value></value>
</item>
<item>
<key>intelligence</key>
<value></value>
</item>
<item>
<key>magicMastery</key>
<value>Mastery of Magic: !</value>
</item>
</statusattributes>
<strength type="int">0</strength>
<intelligence type="int">0</intelligence>
<magicMastery type="int">0</magicMastery>
<intelligenceMax type="int">10</intelligenceMax>
<strengthMax type="int">10</strengthMax>
<magicMasteryMax type="int">10</magicMasteryMax>
</object>
<turnscript>
<script><![CDATA[
if (player.attributetokens > 0) {
msg ("You have {=player.attributetokens} token{if player.attributetokens<>1:s} to set on Strength, Intelligence, or Mastery of Magic.")
}
else {
PrintCentered ("SET UP COMPLETE!<br/><br/>")
OutputTextNoBr ("INITIALISING")
TextFX_Typewriter (".....", 1000)
SetTimeout (5) {
MoveObject (player, first real room)
}
}
if ((DictionaryContains(player.statusattributes, "attributetokens")) and player.attributetokens<1) {
dictionary remove (player.statusattributes, "attributetokens")
}
]]></script>
<enabled />
</turnscript>
<exit alias="THE GAME" to="first real room">
<scenery />
<runscript />
<script type="script"><![CDATA[
if (player.attributetokens > 0) {
PrintCentered ("You still have attribute points to use.")
}
else {
MoveObject (player, first real room)
}
]]></script>
</exit>
</object>
<object name="first real room">
<inherit name="editor_room" />
<description><![CDATA[{once: Welcome to the game!<br/><br/>}This is the description of the first actual room in the game!<br/>]]></description>
<beforefirstenter type="script"><![CDATA[
request (Show, "Command")
ClearScreen
msg ("<center><h1>{=game.gamename}</h1><br/>{either game.author=null:|<br/><h2>by {=game.author}</h2>}</center>")
]]></beforefirstenter>
</object>
<function name="incAtt" parameters="att"><![CDATA[
maxed = false
switch (att) {
case ("strength") {
if (player.attributetokens > 0) {
if (player.strength > player.strengthMax - 1) {
msg ("Already at max level.")
maxed = true
}
else {
player.strength = player.strength + 1
player.attributetokens = player.attributetokens - 1
msg ("Strength + 1<br/>")
msg ("Strength: {=player.strength}")
}
}
else {
msg ("You have no more attribute points to use.")
}
}
case ("intel") {
if (player.attributetokens > 0) {
if (player.intelligence > player.intelligenceMax - 1) {
msg ("Already at max level.")
maxed = true
}
else {
player.intelligence = player.intelligence + 1
player.attributetokens = player.attributetokens - 1
msg ("Intelligence + 1<br/>")
msg ("Intelligence: {=player.intelligence}")
}
}
else {
msg ("You have no more attribute points to use.")
}
}
case ("magic") {
if (player.attributetokens > 0) {
if (player.magicMastery > player.magicMasteryMax - 1) {
msg ("Already at max level.")
maxed = true
}
else {
player.magicMastery = player.magicMastery + 1
player.attributetokens = player.attributetokens - 1
msg ("Mastery of Magic + 1<br/>")
msg ("Mastery of Magic: {=player.magicMastery}")
}
}
else {
msg ("You have no more attribute points to use.")
}
}
}
ClearScreen
HandleSingleCommand ("look")
if (maxed) {
msg (CapFirst(att) + " is already at the max level. Please try again.<br/>")
}
if ((player.attributetokens<1) and not room.alias = "SETUP COMPLETE") {
room.alias = "SETUP COMPLETE"
request (UpdateLocation, "SETUP COMPLETE!")
ClearScreen
HandleSingleCommand ("look")
request (GameName, "LET'S GO!")
game.gamename = "LET'S GO!"
}
]]></function>
</asl>
Test it out:
http://textadventures.co.uk/games/view/dlewkwixxkywg-0sf8mfkw/atts
NOTE: This is not the function you need if you're using Pixie's LevelLib (I don't think).
I'm fairly certain HK's code is what you'd need.
The focus here is on the interface.
... the buttons do call the function though...
...and the function works in this example (although your third attribute probably isn't magicMastery 1).
jmnevil54
27 Aug 2017, 12:42Ah. Sorry.
Is this it?
V
if player.pov.intelligence = 0
msg (You are dumb.)
if player.pov.intelligence = 2
msg (You are average.)
if player.pov.intelligence <= 6 and not 0 and not 2
msg (You are intelligent.)
if played.pov.intelligence >= 7
player.pov.intelligence = 6
This isn't the exact coding, I just did it from memory.
I would also recommend using H.K.'s advice, "changedNAME_OF_ATTRIBUTE". And follow the example... I think. If you need to, you can search "changedNAME_OF_ATTRIBUTE" in the search engine.
While I'm at it, here's this.
game.lock = true
Lock1
if (HasInt(game, "crittercount")) {
game.crittercount = game.crittercount + 1
}
else {
game.crittercount = 1
}
create ("crittercount" + game.crittercount)
obj = GetObject("crittercount" + game.crittercount)
obj.parent = room
obj.displayverbs = Split("Look at;Attack;Shoot", ";")
game.lock = true
obj.dead = false
obj.changedhitpoints => {
if (this.hitpoints < 1) {
msg ("The monster whited out!")
this.dead = true
player.exp = player.exp + 20
player.gold = player.gold + 20
love
game.lock = false
RemoveObject (this)
Lock2
}
}
names = Split("Blue Troll", ";")
obj.alias = StringListItem(names, game.crittercount % ListCount(names))
obj.listalias = CapFirst(obj.alias)
obj.look = ProcessText("A " + obj.alias + ", named for the blue moss growing on their backs.")
obj.hitpoints = 25
obj.damage = 2
obj.attack = 1
obj.defence = 0
obj.armour = 0
Pixie's zombie code also has many attributes that change. See here. https://github.com/ThePix/quest/wiki/The-Zombie-Apocalypse-(on-the-web-version)
Check out the time script if you want. But if you want a function that is hooked up/
Iinked to another function that checks and sets an attribute, you can take a look at my "The Legend of the Secret of the Smelly, Stinky Fish." An RPG based off The Pixie's code, in the "Libraries and Code Samples" section.

Anthony the tiger
27 Aug 2017, 18:29So I believe everyone was fairly unclear of what I was requesting before so I will do my best to be as clear and concise to the point. I will list what I don't understand and hopefully, this forum will properly explain what my problem is so people can understand how I want it fixed. So let's get this out of the way so I don't see yet another wall of code giving me a stat system. First and foremost I understand what a stat system is. Second I understand how attributes work on a mathematical level. Now here is what I don't understand. ((https://textadventures.co.uk/forum/samples/topic/4057/letting-the-player-set-attributes (this is the library I am currently using)
-
I have a stat system in place FANTASTIC, I have strength, luck, and intelligence these are the three attributes I currently have in the test game I've made to test out the code. So here was the issue with what someone suggested, I simply didn't understand how either of the options would help me in my situation. So, currently, the player can change all the three attributes to 10. I can level the player up whenever I need it be. Here's where the issue lies, how would I get the system to recognize when the value is 1,2,3,4,5,6,7,8,9,10? because the player can already manually input it to 10, but the system doesn't do anything with that number. I already have max points in place so the player doesn't just shove 10 points into each stat and go on with their day. So how can I get the system to recognize what the player put in while keeping in the maxpoints? ((I apologize if this question was already answered))
-
is it possible to do what I just described? is this too complicated for quest to handle? am I misunderstanding the posts in the past forums? Now that I have made clear what I want the system to do this is the results I want from the system recognizing these values **1. for intelligence to be able to change the alias of objects((and no the player cannot become these objects)), 2. for the objects I want the player to be able to look at said objects so that the descriptions match up with the aliases. For example: If intelligence = 1 apple.alias = "different name" look at script: if intelligence = 1 print message: it's a different name) **
-
if this becomes too headache inducing I will just give up on trying to work with these values because in my main game I already have a system set-up for objects connected to a phantom value and it's really complex and it works for me, and I was honestly hoping this attribute system would be a far more convenient method of doing things. All that it has done is lead me to more headaches and confusion. I am just really frustrated because I am left with more questions than answers. So, if I sound angry it's not towards anyone in the past post. All these intertwining paths that just make me, even more, confused.
(if anyone has any further questions or things that don't make sense to them that I mentioned please pm me)

Doctor Agon
27 Aug 2017, 18:52Answering the 2nd point. If you have a look at the attributes tab of the 'apple' object, you will see alias. Change this to script, then enter all your permutations for intelligence: Apologies, this is not in code. writing this on the fly as I assume you know how to code.
If player.intelligence = 1 then apple.alias = "round object"
All the way up to 10:
If player.intelligence =10 then apple.alias = "an apple"
Again, similarly with the 'look at', change this to run a script and again you will have to factor in for all the permutations of intelligence.
Hope this helps with part of your question.

K.V.
27 Aug 2017, 19:52What Doctor Agon said rings true.
x = player.intelligence
if (x = 0) {
msg ("Insert script here!!!")
}
else if (x =1) {
msg ("Insert script here!!!")
}
// Rinse and repeat.
Pixie's got me hooked on Switch scripts now, though...
Check it out:
Look script for an object:
CLICK HERE FOR THE CODE
switch (player.intelligence) {
case (0) {
doohickey.alias = "doohickey0"
doohickey.look = "Intel 0"
}
case (1) {
doohickey.alias = "doohickey1"
doohickey.look = "Intel 1"
}
case (2) {
doohickey.alias = "doohickey2"
doohickey.look = "Intel 2"
}
case (3) {
doohickey.alias = "doohickey3"
doohickey.look = "Intel 3"
}
case (4) {
doohickey.alias = "doohickey4"
doohickey.look = "Intel 4"
}
case (5) {
doohickey.alias = "doohickey5"
doohickey.look = "Intel 5"
}
case (6) {
doohickey.alias = "doohickey6"
doohickey.look = "Intel 6"
}
case (7) {
doohickey.alias = "doohickey7"
doohickey.look = "Intel 7"
}
case (8) {
doohickey.alias = "doohickey8"
doohickey.look = "Intel 8"
}
case (9) {
doohickey.alias = "doohickey9"
doohickey.look = "Intel 9"
}
case (10) {
doohickey.alias = "doohickey10"
doohickey.look = "Intel 10"
}
}

Anthony the tiger
27 Aug 2017, 20:21Thank you this clarifies 2. but still issue number 1 resides where the system does not recognize the value, so nothing changes when I put something like that in.
jmnevil54
27 Aug 2017, 21:09Example.
msg ("How intelligent are you?")
options = Split("1;2;3;4;5;6;7;8;9;10", ";")
ShowMenu ("Shop", options, true) {
switch (result) {
case ("1") {
player.pov.intelligence = 1
}
}
case("2") {
player.pov.intelligence = 2
}
}
case ("3") {
player.pov.intelligence = 3
}
}
case ("4")
player.pov.intelligence = 4
}
}
case ("5")
player.pov.intelligence = 5
}
}
case ("6")
player.pov.intelligence = 6
}
}
case ("7")
player.pov.intelligence = 7
}
}
case ("8")
player.pov.intelligence = 8
}
}
case ("9")
player.pov.intelligence = 9
}
}
case ("10")
player.pov.intelligence = 10
}
}
}
Just don't paste this directly in. Although, pasting in code is a bad idea for the system you are using, in general, anyways.

K.V.
27 Aug 2017, 21:44Don't use quotes in the CASEs when checking for the value of the attribute. That checks for a string, and we're working with integers when checking for the value of these attributes.
case (1)
not case ("1")
I'm pretty sure I'm confused...
Perhaps we could be more specific (and, in turn, more helpful) if we could see your code?

Anthony the tiger
27 Aug 2017, 23:41I was doing it wrong this whole time I figured it out! I was using the game instead of the player. I finally got it, it finally works holy crap! WOOOOOO! excitement
hegemonkhan
27 Aug 2017, 23:50@ Anthony the tiger:
to use Pixie's 'level' (level up) library, you need to add/create a 'maxpoints' Integer Attribute on the 'player' Player Object, and a 'attlist' Stringlist Attribute on the 'player' Player Object, and here's a bunch of additional code for seeing it in action (hopefully): create a new text adventure game (for the off-line/desktop version of quest), name it whatever you want, and save it somewhere you can find it (such as on the desktop), close out of it, right click on it (XXX.aslx) and choose to open it with whatever text editor software (notepad, wordpad, Apple: text editor, notepad++, etc), highlight ALL of it, delete ALL of it, copy and paste in my code below, save it, close out of it, open it up in the GUI/Editor and study it, try playing it too as well.
(HK edit: checked that the library reference tags are correctly as 'include ref' and not wrongly as 'inherit name' tags, laughs. K.V. understands, hehe)
<asl version="550">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<include ref="LevelLib.aslx" />
<game name="example_game">
<gameid>672cfb04-ee75-4e9b-9a34-bf2b62974b23</gameid>
<version>1.0</version>
<firstpublished>2017</firstpublished>
<attr name="start" type="script">
run_function
</attr>
</game>
<object name="room">
<inherit name="editor_room" />
</object>
<object name="player">
<inherit name="editor_object" />
<inherit name="editor_player" />
<attr name="parent" type="object">room</attr>
<attr name="alias" type="string">unknown</attr>
<attr name="maxpoints" type="int">0</attr>
<attr name="attlist" type="simplestringlist">strength;intelligence;luck</attr>
<attr name="strength" type="int">0</attr>
<attr name="intelligence" type="int">0</attr>
<attr name="luck" type="int">0</attr>
<attr name="intelligence_to_alias" type="stringdictionary">
<item>
<key>0</key>
<value>jax</value>
</item>
<item>
<key>1</key>
<value>joe</value>
</item>
<item>
<key>2</key>
<value>jim</value>
</item>
<item>
<key>3</key>
<value>jeff</value>
</item>
<item>
<key>4</key>
<value>john</value>
</item>
<item>
<key>5</key>
<value>jack</value>
</item>
<item>
<key>6</key>
<value>joel</value>
</item>
<item>
<key>7</key>
<value>jake</value>
</item>
<item>
<key>8</key>
<value>johan</value>
</item>
<item>
<key>9</key>
<value>jacob</value>
</item>
<item>
<key>10</key>
<value>james</value>
</item>
</attr>
</object>
<function name="set_maxpoints_function">
msg ("Input Max Points")
get input {
ClearScreen
if (IsInt (result)) {
game.pov.maxpoints = ToInt (result)
} else {
set_maxpoints_function
}
}
</function>
<function name="view_function">
ClearScreen
msg ("Alias: " + game.pov.alias)
foreach (attribute_string_variable, game.pov.attlist) {
value_variable = GetInt (game.pov, attribute_string_variable)
msg (attribute_string_variable + ": " + value_variable)
}
wait {
ClearScreen
}
</function>
<function name="run_function">
set_maxpoints_function
LevelUp <!-- to do/activate Pixie's level library -->
check_intelligence_function
view_function
ask ("Again?") {
if (result) {
run_function
} else {
msg ("You decided to stop")
}
}
</function>
<function name="check_intelligence_function">
string_variable = ToString (game.pov.intelligence)
game.pov.alias = StringDictionaryItem (game.pov.intelligence_to_alias, string_variable)
</function>
</asl>
HK Edit:
just saw your post that you got it working, congrats!!!!!!!!!
(don't worry about the stupid mistake of using 'game' instead of 'player' for your Object, I make them all the time too, argh)
(seriously, for everyone, even professional programmers, 95% of the time, when your code/program doesn't work, it's because of some stupid small mistake or typo in your code !!!)

K.V.
28 Aug 2017, 05:19Don't feel bad, HK.
I just wrestled a game for an hour, trying to get it to load from Code View.
The problem: <object name="base64Stuff" />
Why'd I put that forward slash there?!?!
(Because I am a crazy person! That's why!)
Just for fun (and completely off topic), while I'm here...
Here's the correct code:
<object name="base64Stuff">
<inherit name="editor_object" />
<attr name="kvAvatar">/9j/4AAQSkZJRgABAQEASABIAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjL/wAARCACgAKADASIAAhEBAxEB/8QAHAABAQEAAwEBAQAAAAAAAAAAAAcIBAUGAwEC/8QARBAAAQMDAQMHCAYIBgMAAAAAAQACAwQFEQYHEiEIEzFBUWFxFBgiMlWBktE3QmJ1obMVFiM2dJGy0lJTcoKDlCQzQ//EABQBAQAAAAAAAAAAAAAAAAAAAAD/xAAUEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwDP6IiAiIgIiICIiAiIgIiICIiAiIgIiICIiAiIgIiICIiAiIgIiICIiAiIgIiICIiAiIgIirGnNg931Jp2gvNPeKGKKsiEjY5GP3m8eg4CCTorZ5tl99u274H/ACTzbL77dt3wP+SCJorZ5tl99u274H/JeX15sjuWgbFBday5UtTHLUtpgyFrgQS1zs8er0D/ADQTtF3+jdLVGs9SwWSmqI6eWZr3CSQEtG60u6vBU3zbL77dt3wP+SCJorZ5tl99u274H/JPNsvvt23fA/5IImitnm2X327bvgf8k82y++3bd8D/AJIImitnm2X327bvgf8AJPNsvvt23fA/5IImi9Tr3RFVoG+QWusq4aqSambUB8IIABc5uOP+g/zXlkBFT9HbFLrrLTNNfKW7UUEU7ngRyteXDdcW8cDHUu982y++3bd8D/kgiaK2ebZffbtu+B/yXktfbKrhoC2UlbWXGlqm1MxiDYWuBBxnPHwQeAXYWy+3ayy85a7nWUT+2nnczPjg8V16INf7HdXXHWWhzW3VzZKymqn0r5WtDedw1rg4gcAcPxw7FQFH+Tj9Hlw+9ZPyolYEEM5QOsr1ZZrVaLT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72O4c240zoHwc4BwDw7ewezIPDtwexQpahrNvGgLjSvpa2hr6mnkGHwz0bHsd4guwVG9pN40Ld3UEujrVJQSB0hqw6Lm2uB3d3ADiB9boAQfbZJtCfojUYhq5HGzVzgyqb0iI9AlA7uvHSM9JAWumPbIxr2ODmOALXNOQR2hYCVz2Y7baHT2mG2bUjayXyQhtJLCwPPNf4HZI9Xq7iB1cQ0RUU8NXTS01TEyWCZhjkjeMte0jBBHWCFlLahskr9HVk1ytcMtVYXu3g9oLnUv2X/AGex3uPHprXnC6K/y7r/ANdv9y/DyhdEkEGK6EHpBpm/3IMsIq9r7VWy6/afrTY7DJSXx+5zEzaYQsB32l2Q12CS3e6QelSFAVR2D6o/QOvW26aTdpLuwU7snAEoyYz45y0f61Ll9IJ5aWoiqIJHRzRPD2PacFrgcgj3oN9rzuutSM0loy53klvOwxFsAPHeld6LBjr4kE9wK8tatuWiKi0Uc1xvApa58LHVEApZ3COTHpNBDCCAc8cqW7btpNr1dFbLXYKw1NBCTUTyc29gdJxa0YcAeA3j2ekOxBH3vfLI6SRznvcS5znHJJPSSV/KIgIiICIiAiIgIiICIiAiIgIiICIiAiIgIiICIiAiIgIiICIiAiIgIiICIiAiIgIiICIiAiIgIiICIiAiIgIiICIiAiIgIiICIiAiIgIiIP/Z</attr>
</object>
This allows me to use a Base64 embedded image in Quest:
msg ("<img src=\"data:image/png;base64, " + base64Stuff.kvAvatar + "\" />")
Seems like a nice way for online users to include images without linking to another site...
All you need is a BASH! terminal.
base64 -w 0 kvAvatar.png > kvAvatar.txt
Copy the contents of the text file to the attribute string, and that's it! (NOTE: the bigger the image file, the longer the Base64 code.)
jmnevil54
28 Aug 2017, 15:07I'm just replying to K.V.
@K.V.
-
I just did what The Pixie did in his example, and it worked. I just do what works. If this is a completely different code, that's fine.
-
Well, I'm okay with just uploading an image from my computer. Saves me a lot of time and hassle.
hegemonkhan
28 Aug 2017, 18:30everything is 0's and 1's in machine language, including: pixels: graphics: pictures/animation/text-characters-symbols, so that's why your low/high level code gets larger with a larger (and/or also higher resolution: more pixels) picture/graphic.
yes, a picture is just code, and malicious hackers can put malicious code into a picture... why you got to be careful with file formats/extensions which can have graphics in them, like pdfs (xxx.pdf), but there's many other file formats/extensions too.
( ht.tps://www.symantec.com/content/en/us/enterprise/media/security_response/whitepapers/the_rise_of_pdf_malware.pdf )
more data = more code

K.V.
28 Aug 2017, 22:51@jmnevil54
I'm sorry. I haven't had enough beer today (ha-ha!), but I can't remember (or find) the things I said to which you're replying. (We've totally jacked this thread, and there are WAY too many messages crossing paths here! (Sorry about that, by the way!))
-
Do what Pixie does: Oh, heck yeah! That's what I do, too!
-
Uploading images: No argument here, either. Just providing an example of an alternative method.
-
I think your code is actually what he needs, since he's using Pixie's code like you are. (I was merely pointing out the difference between using and not using the quotation marks when integers were involved.)
-
Posting ordered lists makes me feel like I'm being unpleasant (which is not the case (and never is)), so this will be my last point.
In summation, do what you do!
...and do what works for you!
...and have fun with it!
(Did I leave anything out? Oh yeah...)
...and be EXCELLENT to each other!

Doctor Agon
28 Aug 2017, 23:00And...
PARTY ON DUDE!!!
(couldn't resist)
Wyld Stallions rule!

K.V.
28 Aug 2017, 23:10And...
PARTY ON DUDE!!!
(couldn't resist)
Wyld Stallions rule!
♫♫♫ God gave rock and roll to you... ♫♫♫