Programming diseases on Web version
Abigail Storm
06 Dec 2016, 01:30To clarify, I'm making an Oregon Trail type game. I need to figure out how to make players "Sick"

OurJud
06 Dec 2016, 01:35That would be best done with the health method, but I never use it so you'll have to wait for someone who knows more than me.
Abigail Storm
06 Dec 2016, 01:37Thanks! I would do "Attributes", but, I'm doing this on the mac version because I don't have a PC.
The Pixie
06 Dec 2016, 09:11You can still use attributes, you just do not get a convenient tab to set them on. You need to initialise them in the start script of the game object.
Take a look at this page; it is about keeping score, but you can use the same technique to track health. It describes how to set it up for both on-line and off-line.
https://github.com/ThePix/quest/wiki/Keeping-Score
Abigail Storm
06 Dec 2016, 22:25How would I program four other characters' health?
hegemonkhan
07 Dec 2016, 05:01If you can create other Objects, you just create/add 'health/life/hp/etc' Integer Attributes for them.
If you can't create other Objects (like in Game Book, you only have the 'player' Player Object and the 'game' Game Object):
you just use Attributes to handle the illusion of another Object:
game.display_health_party_character_1_string_attribute = "999/999"
game.current_health_party_character_1_integer_attribute = 999
game.maximum_health_party_character_1_integer_attribute = 999
game.display_health_party_character_2_string_attribute = "999/999"
game.current_health_party_character_2_integer_attribute = 999
game.maximum_health_party_character_2_integer_attribute = 999
etc etc etc
and for monster/enemy illusions of Objects:
game.display_health_orc_1_string_attribute = "99/99"
game.current_health_orc_1_integer_attribute = 99
game.maximum_health_orc_1_integer_attribute = 99
game.display_health_dragon_1_string_attribute = "9999/9999"
game.current_health_dragon_1_integer_attribute = 9999
game.maximum_health_dragon_1_integer_attribute = 9999
etc etc etc
and to display the 'health/life/hp/etc' Integer Attributes:
<attr name="changedcurrent_health_party_character_1_integer_attribute" type="script">
game.display_health_party_character_1_string_attribute = current_health_party_character_1_integer_attribute + "/" + maximum_health_party_character_1_integer_attribute
</attr>
<attr name="changedmaximum_health_party_character_1_integer_attribute" type="script">
game.display_health_party_character_1_string_attribute = current_health_party_character_1_integer_attribute + "/" + maximum_health_party_character_1_integer_attribute
</attr>
<attr name="changedcurrent_health_party_character_2_integer_attribute" type="script">
game.display_health_party_character_2_string_attribute = current_health_party_character_2_integer_attribute + "/" + maximum_health_party_character_2_integer_attribute
</attr>
<attr name="changedmaximum_health_party_character_2_integer_attribute" type="script">
game.display_health_party_character_2_string_attribute = current_health_party_character_2_integer_attribute + "/" + maximum_health_party_character_2_integer_attribute
</attr>
<attr name="changedcurrent_health_orc_1_integer_attribute" type="script">
game.display_health_orc_1_string_attribute = current_health_orc_1_integer_attribute + "/" + maximum_health_orc_1_integer_attribute
</attr>
<attr name="changedmaximum_health_orc_1_integer_attribute" type="script">
game.display_health_orc_1_string_attribute = current_health_orc_1_integer_attribute + "/" + maximum_health_orc_1_integer_attribute
</attr>
<attr name="changedcurrent_health_dragon_1_integer_attribute" type="script">
game.display_health_dragon_1_string_attribute = current_health_dragon_1_integer_attribute + "/" + maximum_health_dragon_1_integer_attribute
</attr>
<attr name="changedmaximum_health_orc_1_integer_attribute" type="script">
game.display_health_dragon_1_string_attribute = current_health_dragon_1_integer_attribute + "/" + maximum_health_dragon_1_integer_attribute
</attr>
I think these might (hopefully will) be helpful for you...
http://textadventures.co.uk/forum/samples/topic/5559/attributes-and-if-script-guide-by-hk
http://textadventures.co.uk/forum/quest/topic/5387/i-really-need-help#37375
http://docs.textadventures.co.uk/ifanswers/ifanswers.com/tag/status-attributes.html
Abigail Storm
07 Dec 2016, 22:42I can't add attributes because I'm on the Online version.
The Pixie
08 Dec 2016, 08:30Yes you can, but you have to do it in the start script of the game object. Just do this:
player.health = 100
The problem is it will get very long if you have a lot, so try to keep it organised. Keep all the player attributes together, for example.
hegemonkhan
08 Dec 2016, 21:20ah, okay, so the web/online version works the same as the GameBook (but I presume no 'page' Objects, no Page Type: [script] or [script+text] options), in that you need to use the 'game.start' Attribute. Thanks Pixie. So, I can still try to help Abigail on this stuff, as I wasn't sure of if this stuff could be done in the web/online version.
@ Pixie:
does the web/online version then also have the ability to 'add new script', and thus there's the 'set a variable or attribute Script, or if not, than how would the Attributes be changed after the 'game.script', or is this not possible to change (script) them?
Abigail Storm
08 Dec 2016, 22:14I'm thinking of doing it as a flag, as flags are just easier.
The Pixie
08 Dec 2016, 22:32@HK
The web version allows you to add scripts to exits, scripts as verbs, turn scripts, command scripts, etc. Just not on the attributes tab.
https://github.com/ThePix/quest/wiki/On-line-vs-Off-line-Editor
@AS
Flags are attributes too, they are just attributes that are restricted to two values. If you are just tracking sick/not sick, use a flag. If you want the player to get gradually better or worse, or to count the number of turns before getting better or worse, you need to use integers.
Give some more details on how this will play out. What will trigger the disease? How will it progress? What symptoms will become apparent? How will it be cured? We will see if we can get something working.
Abigail Storm
08 Dec 2016, 22:35Okay. So, my original plan was to make it so your family probably will die of space cholera. (I haven't come up with any cool name yet, so "Space cholera" it is. But that would take a lot of programming, as it would be a random script when traveling.
hegemonkhan
08 Dec 2016, 22:35Boolean Attributes (limited to only two cases/values --- adversarial/opposites/dualism/binary: '0 or 1'-like/"black and white"): true vs false
(I don't like calling Boolean Attributes as 'flags', but that's just me, as I see/understand all types of Attributes as being 'flags/indicators' of stuff/data/states/etc)
if (player.flying) { // if player.flying = true
MoveObject (floating_magical_key, player)
msg ("Being able to fly, you fly up to the magical floating key high up in the sky and take it")
} else { // if player.flying = false
msg ("Being unable to fly, there's no way you can get the magical key floating high up in the sky")
}
Integer Attributes (unlimited cases - well actually not unlimited due to data type size limitations): ..., -10000, -100, -1, 0, 1, 2, 100, ...
if (game.state = 0) {
// whatever scripting 1
} else if (game.state = -1) {
// whatever scripting 2
} else if (game.state = 1) {
// whatever scripting 3
}
// etc etc etc
else if (game.state = 1000000) {
// whatever scripting N
}
String Attributes, (again near) infinite cases/values
if (game.password = "A") {
// whatever scripting 1
} else if (game.password = "B") {
// whatever scripting 2
} else if (game.password = "a") {
// whatever scripting 3
} else if (game.password = "V") {
// whatever scripting 4
} else if if (game.password = "MNO") {
// whatever scripting 5
} else if (game.password = "fdlkj3 4984 ksdk lhsdbclskd_8794378240hdn nissdksn ksjdlsjd") {
// whatever scripting 6
}
and then there's the List/Dictionary Attributes, (again near) infinite cases, but they can also hold multiple values at the same time, whereas, the other types of Attributes can only hold one value at a time.
hegemonkhan
08 Dec 2016, 23:03ah, okay, you got Turnscripts to work with.... otherwise, it'd be much harder to design your disease game feature, lol (actually... you can probably...might... use/have the special 'changed' Script Attributes in the web/online version... or not, meh)
here's an example (it's quick and brief, so not the best code):
<game name="example_game">
<attr name="player_1_alias" type="string">unknown</attr>
<attr name="player_2_alias" type="string">unknown</attr>
<attr name="player_1_condition" type="string">unknown</attr>
<attr name="player_2_condition" type="string">unknown</attr>
<attr name="player_1_life" type="int">-1</attr>
<attr name="player_2_life" type="int">-1</attr>
<attr name="max_life" type="int">-1</attr>
<attr name="difficulty" type="string">unknown</attr>
<attr name="ammo" type="int">-1</attr>
<attr name="difficulty_list" type="simplestringlist">easy;medium;hard;impossible</attr>
<attr name="start" type="script">
msg ("Player 1's Name?")
get input {
game.player_1_alias = result
}
msg ("Player 2's Name?")
get input {
game.player_2_alias = result
}
// etc etc etc
show menu ("Difficulty?", game.difficulty_list, false) {
game.difficulty = result
if (game.difficulty = "easy") {
game.ammo = 100
game.max_life = 100
game.player_1_life = game.max_life
game.player_2_life = game.max_life
} else if (game.difficulty = "medium") {
game.ammo = 50
game.max_life = 75
game.player_1_life = game.max_life
game.player_2_life = game.max_life
} else if (game.difficulty = "hard") {
game.ammo = 25
game.max_life = 50
game.player_1_life = game.max_life
game.player_2_life = game.max_life
} else if (game.difficulty = "impossible") {
game.ammo = 1
game.max_life = 25
game.player_1_life = game.max_life
game.player_2_life = game.max_life
}
}
</attr>
</game>
<turnscript name="example_global_turnscript">
<enabled />
<script><![CDATA[
game.player_1_life = game.player_1_life - 1
game.player_2_life = game.player_2_life - 1
if (game.player_1_condition = "dead" and game.player_2_condition = "dead") {
msg ("Everyone is dead...")
msg ("GAME OVER")
finish
}
if (game.player_1_life > game.max_life * 0.6) {
game.player_1_condition = "healthy"
} else if (game.player_1_life > game.max_life * 0.3) {
game.player_1_condition = "average"
} else if (game.player_1_life > 0) {
game.player_2_condition = "poor"
} else if (game.player_1_life = 0) {
game.player_2_condition = "dead"
}
if (game.player_2_life > game.max_life * 0.9) {
game.player_2_condition = "healthy"
} else if (game.player_2_life > game.max_life * 0.3) {
game.player_2_condition = "average"
} else if (game.player_2_life > 0) {
game.player_2_condition = "poor"
} else if (game.player_2_life = 0) {
game.player_2_condition = "dead"
}
]]></script>
</turnscript>
hegemonkhan
08 Dec 2016, 23:23if you just want to do a random chance... there's actually a Function already for that:
http://docs.textadventures.co.uk/quest/functions/corelibrary/randomchance.html
<turnscript name="example_global_turnscript">
<enabled />
<script>
if (RandomChance (10)) { // there's a 10% odd/chance of you getting space cholera
game.player_1_condition = "space cholera"
}
</script>
</turnscript>
Abigail Storm
08 Dec 2016, 23:29I know! That's what I did! ^-^
hegemonkhan
08 Dec 2016, 23:32Awesome!, glad you're understanding this stuff a bit, as usually my coding posts scare people off, sighs.
(showing in code is just so much faster easier, than trying to describe the process/clicking on stuff via through using the GUI/Editor...)
(but this scares people who don't know code, sighs)
Abigail Storm
08 Dec 2016, 23:36I was having trouble because I was going to do four characters. I'm only going to do one character and one disease for the first game. If enough people enjoy it, I'll develop a second game with more characters that can die of Space Cholera, and add Space Diphtheria, Space Dysentery, Broken arms and legs, Space Worm bites, etcetera... And a longer trail.
hegemonkhan
08 Dec 2016, 23:57Can you add/create Objects, or are you limited to only the 'player' Player Object and the 'game' Game Object ???
if you can create/add more Objects, it makes things easier
(hmm... maybe you might just not be able to create/add Objects through a GUI/Editor Tab Option and/or not through the webpage menu bar options at the top of screen, but since you can at least do scripting, you can create Objects via scripting):
http://docs.textadventures.co.uk/quest/scripts/create.html
Abigail Storm
09 Dec 2016, 00:12I can. That's not the problem. I just would have to create every script four more times, and I'm not sure anyone will like the game in the first place.
hegemonkhan
09 Dec 2016, 00:25there's coding ways to reduce the code redundency, but they're more advanced coding stuff and concepts...
for example, List/Dictionary Attributes and iterating/cycling/looping through them, via 'for' or 'foreach', here's some links:
http://docs.textadventures.co.uk/quest/guides/using_lists.html
http://docs.textadventures.co.uk/quest/using_dictionaries.html
http://docs.textadventures.co.uk/quest/functions/string/split.html
http://docs.textadventures.co.uk/quest/scripts/for.html
http://docs.textadventures.co.uk/quest/scripts/foreach.html
http://docs.textadventures.co.uk/quest/scripts/while.html
http://textadventures.co.uk/forum/samples/topic/5137/list-and-dictionary-extensive-guide-by-hk
http://textadventures.co.uk/forum/samples/topic/5138/explore-and-travel-code-sample-by-hk
for example:
<object name="player_1">
<attr name="alias" type="string">unknown</attr>
</object>
<object name="player_2">
<attr name="alias" type="string">unknown</attr>
</object>
<object name="player_3">
<attr name="alias" type="string">unknown</attr>
</object>
<object name="player_4">
<attr name="alias" type="string">unknown</attr>
</object>
// scripting:
game.player_list = split ("player_1,player_2,player_3,player_4", ";")
foreach (player_variable, game.player_list) {
get input { // (hopefully there's no issue with using foreach and get input... probably is... meh... this is jsut an example... argh)
player_variable = result
}
}
// output/result (pretend I've inputted: Jim, Jeff, Jack, and Joe, for the 4 players' aliases):
player_1.alias = "Joe"
player_2.alias = "Jeff"
player_3.alias = "Jack"
player_4.alias = "Joe"
there's also using Functions with Parameters, Commands, and etc.... for ways to reduce coding redudency...
and even more advanced, if working with large data management/usage... there's 'trees' (coding design) and Object/Objectlist Attributes (as the 'pointers' in/for the 'trees' coding design)
and even more advanced stuff that is way beyond me...
Abigail Storm
09 Dec 2016, 00:30Okay... Thanks! I'm currently on the mobile site (I'm not usually), so I can only work on minor stuff, or else I risk messing up the game.