Help With Tickets (Attributes) ?
Sheparoo
02 Jul 2017, 23:50Unsure how I'm supposed to apply attributes correctly, where to add them to, etc. Need some help.
My plan is to create a game including an arcade, where the player gains tickets through playing minigames and cash them in for prizes.
I don't want the tickets to be a hold-able object until the player gets his first 50 tickets from a friendly stranger. I Want the player to be able to Look At the tickets they have and see the total amount they have. So I wanna be able to +add and -decrease tickets based on winning tickets and using them to buy stuff, any advice? I'm fairly new to coding so I have no real idea.
jmnevil54
03 Jul 2017, 00:15GAME- start script
The start script in the game.
(web editor)
hegemonkhan
03 Jul 2017, 01:34is this for?
Text Adventure or Game Book or Squiffy, ???
and, is it:
off-line/desktop or online/web, ???
you can try taking a look at this, but if you're new to coding... it might be difficult to follow/understand (on top of me just not being able to explain stuff well/concisely/clearly):
http://textadventures.co.uk/forum/samples/topic/5559/attributes-and-if-script-guide-by-hk
ask if you need help with anything
once I know what you're using, I can better help you with a post on how to do what you want with what you're using (the above link is for you to try to take a look at until you post-respong and let me know what you're using)
hegemonkhan
03 Jul 2017, 02:09in the offline/desktop TA (Text Adventure), here's an example design for you:
'game' Game Settings Object -> 'Attributes' Tab -> Attributes -> Add -> (see below)
(Object Name: game)
Attribute Name: tickets
Attribute Type: int // (int = integer)
Attribute Value: 0
'room' Room Object -> 'Objects' Tab -> Add -> (see below)
Object Name: arcade_game_1
Object Type: (non-room, non-player) Object
Object Alias: hoops // a basketball hoop throwing game
'arcade_game_1' Object -> 'Verbs' Tab -> Add -> (see below)
(Object Name: arcade_game_1)
Verb Name: play
Verb Scripting: (see below, an example only, and in code --- I'm lazy)
if (RandomChance (75)) { // 75% chance of TRUE (winning the game)
game.tickets = game.tickets + 5
msg ("You won the hoops game, it gives you 5 tickets as your reward.")
} else {
msg ("Sorry, you didn't make enough baskets in time, better luck next time.")
}
'Objects' -> 'game' -> 'Commands' -> Add -> (see below, in code -- I'm lazy)
<command name="view_tickets_command">
<pattern>view tickets</pattern> // you'd type-in into the input/command bar during game play: view tickets
<script>
ClearScreen
msg ("Tickets: " + game.tickets)
// it'll display this (if you had 40 tickets for example):
// Tickets: 40
wait {
ClearScreen
}
</script>
</command>
'room' Room Object -> 'Objects' Tab -> Add -> (see below)
Object Name: arcade_owner
Object Type: (non-room, non-player) Object
Object Alias: arcade owner
'arcade_owner' Object -> 'Verbs' Tab -> Add -> (see below)
(Object Name: arcade_owner)
Verb Name: prize
Verb scripting: (see below, an example, in code --- I'm lazy)
<![CDATA[
if (game.tickets >= 50) {
// script(s) to select and get your prize
game.tickets = game.tickets - 50
ask ("Would you like to get another prize?") {
// quest does this automatically (hidden from you): result = YOUR_INPUT_(true:yes/false:no)
if (result) { // if (TRUE) // if (yes)
do (arcade_owner, "prize")
} else { // if (FALSE) // if (no)
msg ("hope you enjoyed yourself, and you're always welcome to play in the arcade and try to get enough tickets for another prize.")
}
}
} else {
msg ("sorry, but you need at least 50 tickets to get a prize")
}
]]>
ask if you got any questions or if you need help with anything
Sheparoo
03 Jul 2017, 02:39This is for a text adventure sorry for not specifying
And it is currently being made offline
hegemonkhan
03 Jul 2017, 03:20cool, easiest for me, as I don't know Game Book that well, nor the online/web Text Adventure, and squiffy completely NOT at all, but I do know the Text Adventure (relatively reasonably) well
see if my previous post and the links within it, help. if not, let me know and I'll try to help you better/more.
within my 'attributes and if script' link is this link (for a step by step walkthrough demo game creation, on learning the basics of Attribute usage):
http://textadventures.co.uk/forum/quest/topic/5387/i-really-need-help#37375 (you can use the 'statusattributes' displayment instead of using a Command for viewing the tickets' quantity, which ever you prefer, or even both if you want)
Sheparoo
03 Jul 2017, 04:52You're helping out a lot, I appreciate it. Honestly though, I'm not really following the links very well. Where would I be adding the attributes? Do I add it to 'game', or 'player', or?
The Pixie
03 Jul 2017, 06:58You can add attributes to anything. In this case I would have a single "tickets" object, and have it as an attribute of that. You could set it to not be visible at first, so the player cannot look at it, but you will still be able to check and set its attributes.
hegemonkhan
03 Jul 2017, 17:30think of the 'Objects' as containers of Attributes and/or other Objects, and Attributes as containers of Data (or of actions: Script Attributes).
in the Text Adventure, you got (can create/add) unlimited Objects, and all of these can contain Attributes
in code, you'll see:
player.strength = 100
'player' is the Object, the 'dot/period' is saying that 'strength' (the Attribute) is 'attached to' (contained within) the 'player' Object, and the '100' is the data that the Attribute is holding/storing (containing). An Attribute always includes the Object containing it, as these are all different/separate/individual Attributes:
player.strength = 100
game.strength = 100
orc.strength = 25
ogre.strength = 75
in the GUI/Editor, it has you 'add'/create Attributes to an Object, but underneath, it's creating/'adding' the Attribute to be contained within/by that Object.
it doesn't matter (for the most part) functionally what Object is containing what Attribute, but for us humans, you should do what is conceptually logical, for example:
player.strength = 100, makes sense
whereas:
game.strength = 100, doesn't make sense
both work fine, but 'game.strength = 100' doesn't make conceptual logical sense.
same as this too:
player.game_greeting = "Hi welcome to my game, I hope you enjoy it!", doesn't make much sense
whereas, this does:
game.game_greeting = "Hi welcome to my game, I hope you enjoy it!"
maybe the best example is using the Game Book, as it's limited to only two Objects that you can create Attributes for:
the 'game' Game Settings Object
and the 'player' Player Object
while, you only got these two Objects, you can still create the effect of having more Objects:
player.orc_strength = 100
player.orc_current_life = 100
player.orc_dead = false
player.orc_weapon = "club"
player.dragon_strength = 500
player.dragon_current_life = 999
player.dragon_dead = false
player.dragon_weapon = "fire_breath"
--- or ----
game.orc_strength = 100
game.orc_current_life = 100
game.orc_dead = false
game.orc_weapon = "club"
game.dragon_strength = 500
game.dragon_current_life = 999
game.dragon_dead = false
game.dragon_weapon = "fire_breath"
both work fine, but which makes more sense?
obviously using the 'player' Player Object doesn't make any sense to us humans
whereas, using the 'game' Game Settings Object makes better/some sense to us humans
Attributes (that) are contained within Objects, are NOT destroyed (they are "permanent") and are global (able to use/reference them from anywhere in your game), so long as the Object containing the Attribute exists/still-exists, of course.
this makes Attributes extremely useful for game makers: being able to permanently store and get/reference data from anywhere and/or at any time within their game.
for example, once I create/add this Attribute (as code scripting, as I'm lazy):
player.damage = 100
I can now use that anywhere and at any time within my game, as well as being able to change/adjust/manipulate its stored value too, for examples (in code, as creation tags):
<object name="room">
</object>
<object name="room_50">
</object>
<object name="room_99">
</object>
<object name="player">
<attr name="parent" type="object">room</attr>
// -----------------------------------------------------------------------------------------------------
// the scripting that I showed above (aka: player.strength = 100), does/creates this for you:
// (you'd have to have that scripting of 'player.strength = 100', be somewhere that can contain scripting, of course, see the 'smith' Object, for an example of where/what such scripting can be placed/put/added-to)
<attr name="strength" type="int">100</attr>
// --------------------------------------------------------------------------------------------------
</attr name="current_life" type="int">999</attr>
<attr name="damage" type="int">100</attr>
</object>
<object name="bahamut">
<attr name="parent" type="object">room_99</attr>
<attr name="alias" type="string">Bahamut (King of Dragons)</attr>
<attr name="dead" type="boolean">false</attr>
<attr name="current_life" type="int">9999</attr>
<attr name="damage" type="int">400</attr> // I changed it from '500', so that (now only doing 400 damage to you), you'll be able to kill it (with the tempering from the smith), just to be a bit more thorough for this example, lol
// this is the 'attack' Verb (yes, Verbs are just Script Attributes but with some addition coding elsewhere to make it function-as/be a Verb), that you would create/add in the GUI/Editor to the 'bahamut' Object (and it's the same for the 'smith.temper' Script Attribute below: on the 'smith' Object):
<attr name="attack" type="script">
<![CDATA[
if (bahamut.dead) {
msg (bahamut.alias + " is already dead, silly.")
} else {
player.current_life = player.current_life - bahamut.damage
if (player.current_life <= 0) {
msg ("You were killed by " + this.alias + ".")
msg ("GAME OVER")
finish
} else {
bahamut.current_life = bahamut.current_life - player.damage
if (bahamut.current_life <= 0) {
bahamut.dead = true
msg ("You killed " + bahamut.alias + "!")
}
}
}
]]>
</attr>
// -----------------------------------------------
// this is also extra code needed, so that your 'attack' Script-Attribute / Verb, shows up as a button and hyperlink for you to click on (if you add the 'attack' Verb to the 'bahamut' Object in the GUI/Editor, it does this for you):
<attr name="displayverbs" type="listextend">attack</attr>
// ---------------------------------------------
</object>
<object name="smith">
<attr name="parent" type="object">room_50</attr>
<attr name="temper" type="script">
player.damage = 5000 // or instead of setting/re-setting it, we can also increase/decrease it (increase: addition/multiplication or decrease: sutraction/division, and by any Value too), for an example of increasing it: player.damage = player.damage + 4900 // player.damage (new) = player.damage (old:100) + 4900 = 5000
msg ("The smith tempers your weapon, you now do 5000 damage when attacking.")
</attr>
<attr name="displayverbs" type="listextend">temper</attr>
</object>
// the extra coding needed to make the 'bahamut.attack' Script Attribute into a Verb:
// (if you use the GUI/Editor: 'bahamut' Object -> 'Verbs' Tab -> Add -> Name: attack -> (add the scripts), it does all of this code stuff: the 'attack' Verb below and the 'bahamut.attack' Script Attribute above, for you)
<verb>
<property>attack</property>
<pattern>attack</pattern>
<defaultexpression>You can't attack that!</defaultexpression>
</verb>
// and the same for this Verb too:
<verb>
<property>temper</property>
<pattern>temper</pattern>
<defaultexpression>You can't temper that!</defaultexpression>
</verb>
hegemonkhan
03 Jul 2017, 17:33"You're helping out a lot, I appreciate it. Honestly though, I'm not really following the links very well. Where would I be adding the attributes? Do I add it to 'game', or 'player', or? (Sheparoo)"
try to follow this, as I tell you what to do, step by step, (and then you can play it and see how it works/what it does), as it helps with understanding the basics of Attribute usage:
http://textadventures.co.uk/forum/quest/topic/5387/i-really-need-help#37375
if you need help with any step or whatever about it, ask me!
Sheparoo
04 Jul 2017, 21:17How do I make the code so that the player recieves tickets for playing the arcade game?
(I plan on making Skee Ball, for example, and no matter what, the player gets tickets depending on performance)
There will be 7 skee balls and therefore 7 attempts to score the highest score possible. I want there to be two verbs, one to throw the ball straight (random chance of 50,40,30,20, or 10 points) and another to throw the ball diagnally (75%chance10points,25%100points).
SO, I'd like there to be 5 different ranges of tickets you can get. For instance:
~ 70-100pts = Exquisitely Lame - 5 tickets
~110-190pts = Bad - 10 tickets
~200-340pts = Good - 25 tickets
~350-540pts = Awesome - 50 tickets
~550+ pts = Unbelievable - 150 tickets
How would I code those outcomes (just one for an example)?
And how can I hide the tickets until the player wins/finds their first tickets?
hegemonkhan
05 Jul 2017, 00:17<object name="room">
<inherit name="editor_room" />
</object>
<objct name="player">
<inherit name="editor_object" />
<inherit name="editor_player" />
<attr name="parent" type="object">room</attr>
<attr name="tickets" type="int">0</attr>
</object>
<object name="arcade_room">
<inherit type="editor_room" />
<attr name="alias" type="string">Arcade</attr>
</object>
<object name="skee_ball">
<attr name="parent" type="object">arcade_room</attr>
<attr name="alias" type="string">Skee Ball</attr>
<attr name="attempts" type="int">0</attr>
<attr name="points" type="int">0</attr>
<attr name="displayverbs" type="listextend">straight_throw;diagonal_throw</attr>
<attr name="straight_throw" type="script">
if (skee_ball.attempts = 7) {
do (skee_ball, "points_handling")
} else {
skee_ball.points = skee_ball.points + (10 * GetRandomInt (1,5))
skee_ball.attempts = skee_ball.attempts + 1
}
</attr>
<attr name="diagonal_throw" type="script">
if (skee_ball.attempts = 7) {
do (skee_ball, "points_handling")
} else {
if (RandomChance (75)) {
skee_ball.points = skee_ball.points + 10
} else {
skee_ball.points = skee_ball.points + 100
}
skee_ball.attempts = skee_ball.attempts + 1
}
</attr>
<attr name="points_handling" type="script">
<![CDATA[
if (skee_ball.points > 549) {
player.tickets = player.tickets + 150
} else if (skee_ball.points > 349) {
player.tickets = player.tickets + 50
} else if (skee_ball.points > 199) {
player.tickets = player.tickets + 25
} else if (skee_ball.points > 109) {
player.tickets = player.tickets + 10
} else {
player.tickets = player.tickets + 5
}
skee_ball.attempts = 0
skee_ball.points = 0
]]>
</attr>
</object>
<verb>
<property>straight_throw</property>
<pattern>straight_throw</pattern>
<defaultexpression>You can't throw that straight!</defaultexpression>
</verb>
<verb>
<property>diagonal_throw</property>
<pattern>diagonal_throw</pattern>
<defaultexpression>You can't throw that diagonally!</defaultexpression>
</verb>
are you able to work with the code? Or, if you don't understand code, then, do you need help on how to do this with the GUI/Editor?
hegemonkhan
05 Jul 2017, 00:31as for hiding your tickets... it depends on how you got your tickets set up as:
- as a 'tickets' Integer Attribute within the 'player' Object, using the 'player.statusattributes' to view/display/see them
- as a 'tickets' Integer Attribute within a 'tickets_object' Object, using whatever method to view/display/see them
- using a 'view_tickets' Command to view/see/display them
- etc ?
http://docs.textadventures.co.uk/quest/attributes/scenery.html
http://docs.textadventures.co.uk/quest/tutorial/interacting_with_objects.html (scroll to the 'scenery' section)
http://docs.textadventures.co.uk/quest/attributes/visible.html
http://docs.textadventures.co.uk/quest/scopes.html (see the 'visible' Scope Function links)
http://docs.textadventures.co.uk/quest/types/null.html
and for a Command, a simple 'if' check/Script/function is all that is needed:
<command name="view_command">
<pattern>view #text_parameter#</pattern> // you'd type-in during game play: view tickets // or: view points // or: view attempts
<script>
<![CDATA[
switch (text_parameter) {
case ("tickets") {
if (NAME_OF_OBJECT.tickets > 0) {
ClearScreen
msg ("Tickets: " + NAME_OF_OBJECT.tickets)
wait {
ClearScreen
}
}
}
case ("points") {
ClearScreen
msg ("Points: " + skee_ball.points)
wait {
ClearScreen
}
}
case ("attempts") {
ClearScreen
msg ("Attempts: " + skee_ball.attempts)
wait {
ClearScreen
}
}
default {
msg ("Wrong input, try again")
}
}
]]>
</script>
</command>
Sheparoo
05 Jul 2017, 04:59Yeahhh I'm not following the code extremely well. Just don't understand the context behind a lot of the coding.
I'm not sure where I'd start putting in the code. Is the coding you used just an example? And I have the tickets currenly set as an object under 'player' with the added integer attribute at 0

DarkLizerd
05 Jul 2017, 06:34How about:
Not "balls thrown" and counting up to some number,
but
"Balls left", starting a 7, and counting down to the last ball???
hegemonkhan
05 Jul 2017, 06:47Yeahhh I'm not following the code extremely well. Just don't understand the context behind a lot of the coding.
I'm not sure where I'd start putting in the code. Is the coding you used just an example? And I have the tickets currenly set as an object under 'player' with the added integer attribute at 0 (sheparoo)"
-
create a new text adventure game
-
save your new text adventure game as 'example.aslx' (watch the extension as you can have it add the 'aslx' and then you type in the 'aslx' too giving you: example.aslx.aslx, which you don't want, you can easily fix/re-name it after it's made/saved/placed) and save it somewhere you can find it easily (such as the desktop)
-
right click on your 'example.aslx' game file, and open it with some text editor software: notepad, wordpad, Apple: text editor, notepad++, etc
-
highlight the entire code (everything), as this is your entire game code, and delete it
-
highlight and copy my code below, and then paste it into your 'example.aslx' game file (now having my code instead of it's original/default new game code that you just deleted). Then, save it, obviously. Now close/get out of it.
-
now you can open it up in the GUI/Editor and study how its done, and you can play it too, to see it in action / working (assuming I don't make any mistakes, lol). Let me know if it doesn't work and/or if you need help with anything.
I'm still using an older version of quest (550), so if it doesn't work, first try (in my game code below) changing the version to:
(you can see your version number by opening up quest in the GUI/Editor, and in the menu bar at the top, is 'about', this tells you your 'quest.exe' quest engine's/software's download's version number: ignore the decimal numbers, and the 1's column regardless of what it says, will always be zero for how you add/write it to your game code: version="##0", or just see below)
// the current most recent version is:
<asl version="560">
// or:
<asl version="570">
Also... I hope the 'gameid' random generated hash string works... if not... just create a new game, open into the game code (right click, and open with text editor software), highlight and copy its 'gameid' randomly generated has string, delete this new game file, and then paste its gameid into my game code's 'gameid' below for your 'example.aslx' (you could have copied the new game code that it had when you created your new game: 'example.aslx', before you deleted its code and replaced it with my code, and then paste that 'gameid' into my code for your 'example.aslx' game file)
<asl version="550">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="example_game">
<gameid>14940bcf-bfa0-45ad-8c7c-4ec787b5586b</gameid>
<version>1.0</version>
<firstpublished>2017</firstpublished>
<author>HegemonKhan</author>
<category>DEMO</category>
<description>This demo game is 100% publically available to anyone/everyone, feel free to use it or parts of it, and/or modify it or parts of it, and then use it or parts of it. Again, in direct terms: It's 100% publically available for anyone/everyone to modify and use</description>
<attr name="start" type="script">
player.parent = arcade_room
</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>
</object>
<object name="tickets_object">
<inherit name="editor_object" />
<attr name="parent" type="object">player</attr>
<attr name="visible" type="boolean">false</attr>
<attr name="take" type="boolean">false</attr>
<attr name="drop" type="boolean">false</attr>
<attr name="tickets" type="int">0</attr>
<attr name="changedtickets" type="script">
firsttime {
tickets_object.visible = true
} otherwise {}
</attr>
<attr name="inventoryverbs" type="listextend">view_tickets</attr>
<attr name="view_tickets" type="script">
ClearScreen
msg ("Tickets: " + tickets_object.tickets)
wait {
ClearScreen
}
</attr>
</object>
<object name="arcade_room">
<inherit type="editor_room" />
<attr name="alias" type="string">Arcade</attr>
</object>
<object name="skee_ball">
<attr name="parent" type="object">arcade_room</attr>
<attr name="alias" type="string">Skee Ball</attr>
<attr name="attempts" type="int">0</attr>
<attr name="points" type="int">0</attr>
<attr name="displayverbs" type="listextend">view_skee_ball_stats;straight_throw;diagonal_throw</attr>
<attr name="view_skee_ball_stats" type="script">
ClearScreen
msg ("Attempts: " + skee_ball.attempts)
msg ("Points: " + skee_ball.points)
wait {
ClearScreen
}
</attr>
<attr name="straight_throw" type="script">
if (skee_ball.attempts = 7) {
do (skee_ball, "points_handling")
} else {
integer_variable = (10 * GetRandomInt (1,5))
msg ("You scored " + integer_variable + " points")
skee_ball.points = skee_ball.points + integer_variable
msg ("Points: " + skee_ball.points)
wait {
ClearScreen
}
skee_ball.attempts = skee_ball.attempts + 1
}
</attr>
<attr name="diagonal_throw" type="script">
if (skee_ball.attempts = 7) {
do (skee_ball, "points_handling")
} else {
if (RandomChance (75)) {
skee_ball.points = skee_ball.points + 10
msg ("You scored 10 points")
} else {
skee_ball.points = skee_ball.points + 100
msg ("You scored 100 points")
}
msg ("Points: " + skee_ball.points)
wait {
ClearScreen
}
skee_ball.attempts = skee_ball.attempts + 1
}
</attr>
<attr name="points_handling" type="script">
<![CDATA[
msg ("Points: " + skee_ball.points)
if (skee_ball.points > 549) {
tickets_object.tickets = tickets_object.tickets + 150
msg ("You got +150 tickets")
} else if (skee_ball.points > 349) {
tickets_object.tickets = tickets_object.tickets + 50
msg ("You got +50 tickets")
} else if (skee_ball.points > 199) {
tickets_object.tickets = tickets_object.tickets + 25
msg ("You got +25 tickets")
} else if (skee_ball.points > 109) {
tickets_object.tickets = tickets_object.tickets + 10
msg ("You got +10 tickets")
} else {
tickets_object.tickets = tickets_object.tickets + 5
msg ("You got +5 tickets")
}
skee_ball.attempts = 0
skee_ball.points = 0
msg ("Tickets: " + tickets_object.tickets)
wait {
ClearScreen
}
]]>
</attr>
</object>
<verb>
<property>straight_throw</property>
<pattern>straight_throw</pattern>
<defaultexpression>You can't throw that straight!</defaultexpression>
</verb>
<verb>
<property>diagonal_throw</property>
<pattern>diagonal_throw</pattern>
<defaultexpression>You can't throw that diagonally!</defaultexpression>
</verb>
<verb>
<property>view_skee_ball_stats</property>
<pattern>view_skee_ball_stats</pattern>
<defaultexpression>You can't view that!</defaultexpression>
</verb>
<verb>
<property>view_tickets</property>
<pattern>view_tickets</pattern>
<defaultexpression>You can't view that!</defaultexpression>
</verb>
</asl>
Sheparoo
06 Jul 2017, 03:01The following errors occurred:
Invalid XML: The 'attr' start tag on line 18 position 6 does not match the end tag of 'game'. Line 20, position 5.
hegemonkhan
06 Jul 2017, 05:14I spotted a few mistakes/typos after I initially posted it, but I've fixed up it, so try again with the code above, and let's hope now, no more errors. If there's still errors I'll get off my lazy-bum and get it working on my comp, so that you can then have code that works.
I was free-writing the code, and it's easy to forget/leave-off the ending slashes of the creation tag blocks:
wrong (examples):
<inherit name="xxx.aslx" >
<game name="xxx">
<game>
<object name="xxx">
<object>
<attr name="xxx">
<attr>
<function name="xxx">
<function>
<command name="xxx">
<command>
<verb>
<verb>
correct (examples):
<inherit name="xxx.aslx" />
<game name="xxx">
</game>
<object name="xxx">
</object>
<attr name="xxx">
</attr>
<function name="xxx">
</function>
<command name="xxx">
</command>
<verb>
</verb>
hegemonkhan
06 Jul 2017, 05:40"Invalid XML: The 'attr' start tag on line 18 position 6 does not match the end tag of 'game'. Line 20, position 5. (Sheparoo)"
line ~~~ position count ->
....12345678901234567
01. <asl version="550">
02.
03. <include ref="English.aslx" />
04. <include ref="Core.aslx" />
05.
06. <game name="example_game">
07.
08. <gameid>14940bcf-bfa0-45ad-8c7c-4ec787b5586b</gameid>
09.
10. <version>1.0</version>
11. <firstpublished>2017</firstpublished>
12. <author>HegemonKhan</author>
13. <category>DEMO</category>
14. <description>This demo game is 100% publically available to anyone/everyone, feel free to use it or parts of it, and/or modify it or parts of it, and then use it or parts of it. Again, in direct terms: It's 100% publically available for anyone/everyone to modify and use</description>
15.
// -----------------------------------------------------
16. <attr name="start" type="script">
17. player.parent = arcade_room
18. <attr> // I forgot the slash here, it should be: </attr>, as the ending tab block line to go with its beginning tag block line of: <attr name="start" type="script">
// --------
19.
20. <game>
// ---------------------------------------
// and because of that missing slash, quest is seeing it as this instead:
16. <attr name="start" type="script">
17. player.parent = arcade_room
// -------
18. <attr> // I forgot the slash here, it should be: </attr>, as the ending tab block line to go with its beginning tag block line of: <attr name="start" type="script">
19.
20. <game> // it thinks the '<attr>' (line 18) is the beginning tag block line and this '<game>' as its ending tag block line (when it's suppose to be seen as the ending tag of line 16's starting tag line: <attr name="start" type="script">, which has two problems of this already incorrect view: attr vs game, they must be the same, as it's either a 'attr:attribute' tag block or a 'game:special game settings object' tag block, and its ending tag is missing its slash (which is what tells quest that it's an ending tag)
// --------------------------
// in other words, messing up (or leaving off or accidentally adding) a single character/symbol/key (and the worse is accidentally adding a space/blank --- as it's really hard to spot!!!, completely re-orders the code, and produces tons and tons of errors, as quest is no longer reading the code as it should be.
// never panic when code doesn't work, as it really is like 90% of the time a single stupid small typo... coding/programming is fun... laughs.... it teaches you to be a very good spell-checker/proof-reader, lol.
if you don't understand any of this, don't worry. It's just code trouble-shooting (usually trying to find typos by yourself/others, lol)
but if you're interested, I made this post to try to help you understand how to trouble-shoot code.
Sheparoo
06 Jul 2017, 17:09Failed to load game.
The following errors occurred:
Error: Error adding type '' to element 'arcade_room': Value cannot be null.
Parameter name: key
I apologize for adding all of these 'error's but I really don't know how to fix them, really appreciating the help regardless. Can't wait to look this over and see what I can do to learn and improve. Yeah, reading code is hard for me right now, but I think I'm slowly getting it. I've been using the simple set up of the Text Adventure, never bothered looking at the actual code
hegemonkhan
07 Jul 2017, 00:20alright... I'll get around to getting this code working on my computer (give me the weekend to do so), before I post it again (so no more code errors, lol).
(ya, is was worried I'd have issues/error with using 'null' -- the newer version of quest might ahve also changed how 'null works too as I've not used 'null' with the newer versions of quest, I last used it with a much earlier version of quest). I think the 'null' issue is that since it (the Attribute's Value) is 'null' the Attribute is seen by quest as 'not existing', and hence the error when trying to increase/change or set/re-set it's value, it has to be made 'un-nulled' first, then we can increase/change/set/re-set the Attribute's value... I'll have to work with this stuff to see how exactly to get it to work ... (might have to find a different way, as might not be able to work with the use of this 'null' using design in my code currently)
(one should always test their code first, before making it available to others... but I'm lazy, laughs, and just hoped that I'd code it perfectly, that never happens, lol. As, I just free-wrote it, and thus it has tons of issues/errors/mistakes... that I need to now fix up, through examing it more thoroughly, which includes testing it, as I look for and fix the mistakes/errors/issues it got)
again, let me work on this over the weekend, so my next post will be code that actually works (no more errors).
using the GUI/Editor is fine, you can do all the same stuff, but for me, it's much more of a pain to give instructions via the GUI/Editor, as compared to code (so much faster):
(if you can learn to code, it's much faster for you too in making a game then through the GUI/Editor, well for most stuff anyways, and also if you're good at coding you can do really cool stuff --- you can still do this same cool stuff with the GUI/Editor, but being able to do it in code is faster and easier for you than via GUI/Editor, especially the fancier code/game-features stuff you want to do/have in your game)
for example:
('this' is a special key-command/key-function which GETS the parent Object of its scripting location, which for the Attributes below, is the 'orc_1' Object. So, in the code below, 'this' is GETTING the 'orc_1' Object, well it's point/reference/address, technically, so not to hopefuly confuse you into thinking its GETTING/MOVING the actual/"physical" 'orc_1' Object, but I fear this entire explanation of technicality and what the 'this' special key-command/key-function does, has confused you, lol, meh)
so much easier and quick for me (using code):
// a default new game already has the 'room' Room Object created (along with the, for example (not everything else): 'game' Game Settings Object, and the 'player' Player object, 'parented' via, in this case, nesting it inside of the 'room' Room Object, which I've, the 'player' Player Object, not shown in my code and GUI/Editor steps, here in this post)
<object name="room">
// contents: Attributes and/or other Objects
</object>
<object name="orc_1">
<attr name="parent' type="object">room</attr> // this is a pointer/reference Object Attribute, the 'room' Value is actually an Address to the actual/"physical" 'room' Object's location in the game code (see: <object name="room">contents</object>, above)
<attr name="alias" type="string">orc</attr>
<attr name="damage" type="int">10</attr>
<attr name="life" type="string">100/100</attr>
<attr name="current_life" type="int">100</attr>
<attr name="maximum_life" type="int">100</attr>
<attr name="dead" type="boolean">false</attr>
<attr name="changedcurrent_life" type="script">
<![CDATA[
if (this.current_life > this.maximum_life) {
this.current_life = this.maximum_life
} else if (this.current_life < 0) {
this.current_life = 0
}
this.life = "Life: " + this.current_life + "/" + this.maximum_life // output example: Life: 50/100
if (this.current_life = 0) {
this.dead = true
}
]]>
</attr>
<attr name="changedmaximum_life" type="script">
<![CDATA[
if (this.current_life > this.maximum_life) {
this.current_life = this.maximum_life
}
this.life = "Life: " + this.current_life + "/" + this.maximum_life
]]>
</attr>
</object>
vs (see this is going to be such fun... sarcasm) using the GUI/Editor:
(I don't know the GUI/Editor and its script options that well, so bare with me here)
// a default new game already has the 'room' Room Object created (along with the, for example (not everything else): 'game' Game Settings Object, and the 'player' Player object, 'parented' via, in this case, nesting it inside of the 'room' Room Object, which I've, the 'player' Player Object, not shown in my code and GUI/Editor steps, here in this post)
menu bar at top of screen -> whatever the option its under -> 'add object' -> Object Name: orc_1
the 'tree of stuff' on the left side of the screen -> 'orc_1' Object (click on this so it is highlighted) -> right side of the screen -> 'Setup (I think it's called: the first/left-most)' Tab (the Tabs are at the top on the right side of the screen) -> 'Alias' text box: orc
the 'tree of stuff' on the left side of the screen -> 'orc_1' Object (click on this so it is highlighted) -> 'Attributes' Tab (the Tabs are at the top on the right side of the screen) -> Attributes big box (NOT the 'inherited attributes' big box and NOT the 'status attributes' big box) -> Add (repeat as needed) -> (see below)
// ------------------------------------------------
// there's others ways of doing this within the GUI/Editor too, but this was the quickest way to show it to you (as it goes with all the oher Attributes, that I'm already showing you how to create/set-up, lol):
(Object Name: orc_1)
Attribute Name: parent
Attribute Type: object // this is actually a 'Reference/Pointer of an Object' Attribute (shortly as an: Object (type of) Attribute, and thus:
Attribute Value: room // this is NOT the actual/"physical" 'room' Object itself
-------------------------------------------------
(Object Name: orc_1)
Attribute Name: damage
Attribute Type: int // 'int' is an 'Integer Data Type'
Attribute Value: 10
(Object Name: orc_1)
Attribute Name: life
Attribute Type: string
Attribute Value: 100/100
(Object Name: orc_1)
Attribute Name: current_life
Attribute Type: int
Attribute Value: 100
(Object Name: orc_1)
Attribute Name: maximum_life
Attribute Type: int
Attribute Value: 100
(Object Name: orc_1)
Attribute Name: dead
Attribute Type: boolean
Attribute Value: false
(Object Name: orc_1)
Attribute Name: changedcurrent_life
Attribute Type: script
Attribute Value: (see below)
add new script -> 'scripts' category/section -> 'if' Script -> (see below)
if [EXPRESSION] this.current_life > this.maximum_life
-> then, -> add new script -> 'variables' section/category -> 'set a variable or attribute' Script -> (see below)
set variable this.current_life = [EXPRESSION] this.maximum_life
else if -> [EXPRESSION] -> if [EXPRESSION] this.current_life < 0
-> then, -> add new script -> 'variables' section/category -> 'set a variable or attribute' Script -> (see below)
set variable this.current_life = [EXPRESSION] 0
add new script -> 'variables' category/section -> 'set a variable or attribute' Script -> (see below)
set variable this.life = [EXPRESSION] "Life: " + this.current_life + "/" + this.maximum_life
add new script -> 'scripts' category/section -> 'if' Script -> (see below)
if [EXPRESSION] this.current_life = 0
-> then, add new script -> 'variables' section/category -> 'set a variable or attribute' Script -> (see below)
set variable this.dead = [EXPRESSION] true
(Object Name: orc_1)
Attribute Name: changedmaximum_life
Attribute Type: script
Attribute Value: (see below)
add new script -> 'scripts' category/section -> 'if' Script -> (see below)
if [EXPRESSION] this.current_life > this.maximum_life
-> then, -> add new script -> 'variables' section/category -> 'set a variable or attribute' Script -> (see below)
set variable this.current_life = [EXPRESSION] this.maximum_life
add new script -> 'variables' category/section -> 'set a variable or attribute' Script -> (see below)
set variable this.life = [EXPRESSION] "Life: " + this.current_life + "/" + this.maximum_life
and I've not yet done any combat stuff yet... lots and lots of work trying to guide/explain through using the GUI/Editor step by step, as opposed to writing in code and copying and pasting it here, lol.
ask if you got any questions and/or are confused about any of it (hopefully, you're not confused with all of it... lol)
hegemonkhan
07 Jul 2017, 06:48if you want to try one last time (before I get it definately working over the weekend), you can try this (I removed the code that attempts to hide the tickets, as I think this is the cause of the last error you posted, and let's hope I got no other errors still. If I do, then wait for the weekend, where I got the time to definately get this code working for you):
<asl version="550">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="example_game">
<gameid>14940bcf-bfa0-45ad-8c7c-4ec787b5586b</gameid>
<version>1.0</version>
<firstpublished>2017</firstpublished>
<author>HegemonKhan</author>
<category>DEMO</category>
<description>This demo game is 100% publically available to anyone/everyone, feel free to use it or parts of it, and/or modify it or parts of it, and then use it or parts of it. Again, in direct terms: It's 100% publically available for anyone/everyone to modify and use</description>
<attr name="start" type="script">
player.parent = arcade_room
</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>
</object>
<object name="tickets_object">
<inherit name="editor_object" />
<attr name="parent" type="object">player</attr>
<attr name="take" type="boolean">false</attr>
<attr name="drop" type="boolean">false</attr>
<attr name="tickets" type="int">0</attr>
<attr name="inventoryverbs" type="listextend">view_tickets</attr>
<attr name="view_tickets" type="script">
ClearScreen
msg ("Tickets: " + tickets_object.tickets)
wait {
ClearScreen
}
</attr>
</object>
<object name="arcade_room">
<inherit type="editor_room" />
<attr name="alias" type="string">Arcade</attr>
</object>
<object name="skee_ball">
<attr name="parent" type="object">arcade_room</attr>
<attr name="alias" type="string">Skee Ball</attr>
<attr name="attempts" type="int">0</attr>
<attr name="points" type="int">0</attr>
<attr name="displayverbs" type="listextend">view_skee_ball_stats;straight_throw;diagonal_throw</attr>
<attr name="view_skee_ball_stats" type="script">
ClearScreen
msg ("Attempts: " + skee_ball.attempts)
msg ("Points: " + skee_ball.points)
wait {
ClearScreen
}
</attr>
<attr name="straight_throw" type="script">
if (skee_ball.attempts = 7) {
do (skee_ball, "points_handling")
} else {
integer_variable = (10 * GetRandomInt (1,5))
msg ("You scored " + integer_variable + " points")
skee_ball.points = skee_ball.points + integer_variable
msg ("Points: " + skee_ball.points)
wait {
ClearScreen
}
skee_ball.attempts = skee_ball.attempts + 1
}
</attr>
<attr name="diagonal_throw" type="script">
if (skee_ball.attempts = 7) {
do (skee_ball, "points_handling")
} else {
if (RandomChance (75)) {
skee_ball.points = skee_ball.points + 10
msg ("You scored 10 points")
} else {
skee_ball.points = skee_ball.points + 100
msg ("You scored 100 points")
}
msg ("Points: " + skee_ball.points)
wait {
ClearScreen
}
skee_ball.attempts = skee_ball.attempts + 1
}
</attr>
<attr name="points_handling" type="script">
<![CDATA[
msg ("Points: " + skee_ball.points)
if (skee_ball.points > 549) {
tickets_object.tickets = tickets_object.tickets + 150
msg ("You got +150 tickets")
} else if (skee_ball.points > 349) {
tickets_object.tickets = tickets_object.tickets + 50
msg ("You got +50 tickets")
} else if (skee_ball.points > 199) {
tickets_object.tickets = tickets_object.tickets + 25
msg ("You got +25 tickets")
} else if (skee_ball.points > 109) {
tickets_object.tickets = tickets_object.tickets + 10
msg ("You got +10 tickets")
} else {
tickets_object.tickets = tickets_object.tickets + 5
msg ("You got +5 tickets")
}
skee_ball.attempts = 0
skee_ball.points = 0
msg ("Tickets: " + tickets_object.tickets)
wait {
ClearScreen
}
]]>
</attr>
</object>
<verb>
<property>straight_throw</property>
<pattern>straight_throw</pattern>
<defaultexpression>You can't throw that straight!</defaultexpression>
</verb>
<verb>
<property>diagonal_throw</property>
<pattern>diagonal_throw</pattern>
<defaultexpression>You can't throw that diagonally!</defaultexpression>
</verb>
<verb>
<property>view_skee_ball_stats</property>
<pattern>view_skee_ball_stats</pattern>
<defaultexpression>You can't view that!</defaultexpression>
</verb>
<verb>
<property>view_tickets</property>
<pattern>view_tickets</pattern>
<defaultexpression>You can't view that!</defaultexpression>
</verb>
</asl>
hegemonkhan
07 Jul 2017, 07:46woohoo, I got it working! (finally)
(as I got off my lazy bum, and got this tested and working, here you go (have fun playing your skee ball game, hehe)
you can download the file directly from this link (you just need to click on the light greenish download link: skee_ball.aslx):
http://s000.tinyupload.com/?file_id=60389833258044135818
(don't click on anything else, as it's non-malicious advertisement or possibly sadly worse malware-virus/adware-malicious advertisement, as you never know with this type of stuff, unless you're an expert in security: programming and malware and/or legal/illegal code-ware, meh)
or, you can copy and paste the code below (delete all the old code first) into your new game 'example.aslx' (or whatever you named it as) game file I had you make from my previous post, you may have to change the 'version="550" to 'version="560" or version="570", again, if you had to do it last time
turns out, that last error had to do with an entirely different mistake of mine, nothing to do with the 'null' stuff, it had to do with that I simply didn't do the correct syntax for this:
// correct(ed) syntax:
<object name="arcade_room">
<inherit name="editor_room" />
</object>
// incorrect syntax that I had used (whoopsy):
<object name="arcade_room">
<inherit type="editor_room" /> // lol, for some reason I had a brain failure and put in 'type' instead of 'name'... stupid mistake on my part, GRRR!!!
</object>
also, I cleaned up some other parts of the code (had duplicate Verbs showing up when playing the game, hehe)
though, it can still be cleaned up some more, but I'm lazy, and it works well enough for now, as a play'able and study'able example demo game for you.
however, this working code below, DOES HAVE THE: 'null' (my attempt of hiding the tickets) removed, as I still got to test that, if it was working fine or if not...
but, have fun playing your skee ball game for now, hehe
<asl version="550">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="example_game">
<gameid>14940bcf-bfa0-45ad-8c7c-4ec787b5586b</gameid>
<version>1.0</version>
<firstpublished>2017</firstpublished>
<author>HegemonKhan</author>
<category>DEMO</category>
<description>This demo game is 100% publically available to anyone/everyone, feel free to use it or parts of it, and/or modify it or parts of it, and then use it or parts of it. Again, in direct terms: It's 100% publically available for anyone/everyone to modify and use</description>
<attr name="start" type="script">
player.parent = arcade_room
</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>
</object>
<object name="tickets_object">
<inherit name="editor_object" />
<attr name="parent" type="object">player</attr>
<attr name="take" type="boolean">false</attr>
<attr name="drop" type="boolean">false</attr>
<attr name="tickets" type="int">0</attr>
<attr name="view_tickets" type="script">
ClearScreen
msg ("Tickets: " + tickets_object.tickets)
wait {
ClearScreen
}
</attr>
</object>
<object name="arcade_room">
<inherit name="editor_room" />
<attr name="alias" type="string">Arcade</attr>
</object>
<object name="skee_ball">
<inherit name="editor_object" />
<attr name="parent" type="object">arcade_room</attr>
<attr name="alias" type="string">Skee Ball</attr>
<attr name="attempts" type="int">0</attr>
<attr name="points" type="int">0</attr>
<attr name="view_skee_ball_stats" type="script">
ClearScreen
msg ("Attempts: " + skee_ball.attempts)
msg ("Points: " + skee_ball.points)
wait {
ClearScreen
}
</attr>
<attr name="straight_throw" type="script">
if (skee_ball.attempts = 7) {
do (skee_ball, "points_handling")
} else {
integer_variable = (10 * GetRandomInt (1,5))
msg ("You scored " + integer_variable + " points")
skee_ball.points = skee_ball.points + integer_variable
msg ("Points: " + skee_ball.points)
wait {
ClearScreen
}
skee_ball.attempts = skee_ball.attempts + 1
}
</attr>
<attr name="diagonal_throw" type="script">
if (skee_ball.attempts = 7) {
do (skee_ball, "points_handling")
} else {
if (RandomChance (75)) {
skee_ball.points = skee_ball.points + 10
msg ("You scored 10 points")
} else {
skee_ball.points = skee_ball.points + 100
msg ("You scored 100 points")
}
msg ("Points: " + skee_ball.points)
wait {
ClearScreen
}
skee_ball.attempts = skee_ball.attempts + 1
}
</attr>
<attr name="points_handling" type="script">
<![CDATA[
msg ("Points: " + skee_ball.points)
if (skee_ball.points > 549) {
tickets_object.tickets = tickets_object.tickets + 150
msg ("You got +150 tickets")
} else if (skee_ball.points > 349) {
tickets_object.tickets = tickets_object.tickets + 50
msg ("You got +50 tickets")
} else if (skee_ball.points > 199) {
tickets_object.tickets = tickets_object.tickets + 25
msg ("You got +25 tickets")
} else if (skee_ball.points > 109) {
tickets_object.tickets = tickets_object.tickets + 10
msg ("You got +10 tickets")
} else {
tickets_object.tickets = tickets_object.tickets + 5
msg ("You got +5 tickets")
}
skee_ball.attempts = 0
skee_ball.points = 0
msg ("Tickets: " + tickets_object.tickets)
wait {
ClearScreen
}
]]>
</attr>
</object>
<verb>
<property>straight_throw</property>
<pattern>straight_throw</pattern>
<defaultexpression>You can't throw that straight!</defaultexpression>
</verb>
<verb>
<property>diagonal_throw</property>
<pattern>diagonal_throw</pattern>
<defaultexpression>You can't throw that diagonally!</defaultexpression>
</verb>
<verb>
<property>view_skee_ball_stats</property>
<pattern>view_skee_ball_stats</pattern>
<defaultexpression>You can't view that!</defaultexpression>
</verb>
<verb>
<property>view_tickets</property>
<pattern>view_tickets</pattern>
<defaultexpression>You can't view that!</defaultexpression>
</verb>
</asl>
Sheparoo
08 Jul 2017, 06:18AHHHHHHHH!!! Wow, I appreciate this so much dude...
Gonna definitely try it out. I feel kinda silly about asking you to do this now. Hopefully I study up on what you've given me to work with and I can understand and appreciate coding a bit more. Thanks a ton. :D
hegemonkhan
08 Jul 2017, 06:39no problem, I like trying to help people, and it's more practice for me, was actually fun trying to code in what you wanted for the skee ball stuff, and now got a fun skee ball game to play, hehe :D
just learning the basics of using quest, its GUI/Editor, and the logic needed to do stuff for your game making is hard and slow, and if interested in learning to code, even harder and slower, lol.
it's helpful to be able to see, play with, and study stuff, as the best way of learning, instead of having me fumble around with trying to explain and teach about stuff, lol. Best way to learn to code (once you got a basic understanding of it) is to look at as much code as you can, see how other people do the code designs.
imagine, having to learn say algebra (or whatever math), but never ever being able to see a completed algebra problem with its steps and explanation of how/what is going on in those steps... that's like trying to code without ever being able to look at other people's code.