Is Score useless or am I dumb?

JenniferKline

Heya everyone!

I'm trying to do something with my game; have a score system that has an impact.

The point is, there's no win conditions, but score works almost like currency. Find a bonus that's hard to find and get some score. Then, you can use your score to buy cheats if you're stuck, or so people that have already played can unlock their favourite content.

So, how can I work something like, "If player score = 10, run script, else 'You need more score!'" in any simple method. Is there a simple method?


hegemonkhan

I'm not sure how the built-in 'score' Attribute works


but, for a custom (self-made/added/created) Attribute....

I'm going to use a different example (and in code):

<game name="whatever">
  <attr name="start" type="script">
    msg ("Enter your test score (as a non-decimal number): ")
    get input {
      // the 'get input', 'show menu', and 'ShowMenu' Scripts/Functions automatically sets the built-in 'result' Variable to hold your input:
      // result = YOUR_TYPED_IN_INPUT
      if (isInt (result)) {
        test.score = ToInt (result)
        example_function
        msg ("Test Score: " + test.score)
        msg ("Test Grade: " + test.grade)
      } else {
        ClearScreen
        msg ("Wrong input, try again.")
        wait {
          ClearScreen
          invoke (game.start)
        }
      }
    }
  </attr>
</game>

<object name="test">
  <attr name="score" type="int">-1</attr>
  <attr name="grade" type="string">unknown</attr>
</object>

// high to low checking:

<function name="example_function">

  // optional: checking (correcting) for 'out of range/bounds' (having a max/min limit/range):
  if (test.score > 100) {
    test.score = 100
  } else if (test.score < 0) {
    test.score = 0
  }

  if (test.score >= 90) {
    test.grade = "A"
  } else if (test.score >= 80) {
    test.grade = "B"
  } else if (test.score >= 70) {
    test.grade = "C"
  } else if (test.score >= 60) {
    test.grade = "D"
  } else {
    test.grade = "F"
  }

</function>

// or...

// low to high checking:

<function name="example_function">

  // optional: checking (correcting) for 'out of range/bounds' (having a max/min limit/range):
  if (test.score > 100) {
    test.score = 100
  } else if (test.score < 0) {
    test.score = 0
  }

  if (test.score < 60) {
    test.grade = "F"
  } else if (test.score < 70) {
    test.grade = "D"
  } else if (test.score < 80) {
    test.grade = "C"
  } else if (test.score < 90) {
    test.grade = "B"
  } else {
    test.grade = "A"
  }

</function>

the "TWO SUPER SCRIPTS" are:

  1. Attribute Scripting (creating/adding/setting/re-setting/altering/changing/adjusting an Attribute):

in the GUI/Editor: (run as script) -> add new script -> 'variables' section/category -> 'set a variable or attribute' Script -> (see below)

set variable NAME_OF_OBJECT.NAME_OF_ATTRIBUTE = [EXPRESSION] VALUE_OR_EXPRESSION

// examples:
// set variable player.strength = [EXPRESSION] 100
// set variable game.greeting = [EXPRESSION] "Welcome new player, I hope you enjoy this game!"
// set variable orc.strength = [EXPRESSION] 10
// set variable orc.dead = [EXPRESSION] false
// set variable orc.dead = [EXPRESSION] true
// set variable player.damage = [EXPRESSION] player.weapon.damage + player.weapon.damage * player.strength / 100
// player.right_hand = [EXPRESSION] katana

  1. the 'if' Script (Conditional Scripting):

in the GUI/Editor: (run as script) -> add new script -> 'scripts' section/category -> 'if' Script -> (see below)

if [EXPRESSION] NAME_OF_OBJECT.NAME_OF_ATTRIBUTE
// or:
if [EXPRESSION] NAME_OF_OBJECT.NAME_OF_ATTRIBUTE OPERATOR VALUE_OR_EXPRESSION // replace 'OPERATOR' with either: +, -, *, /, %, >, <, =, >=, or <=, depending on what is your 'VALUE_OR_EXPRESSION'

examples:

if [EXPRESSION] player.strength > 66
-> then -> add new script -> 'output' section/category -> 'print a message' Script -> print a [EXPRESSION] "You're strong."
else if [EXPRESSION] player.strength > 33
-> then -> add new script -> 'output' section/category -> 'print a message' Script -> print a [EXPRESSION] "You have average strength."
else,
-> add new script -> 'output' section/category -> 'print a message' Script -> print a [EXPRESSION] "You're weak."


if [EXPRESSION] player.alias ="HK"
-> then, -> add new script -> 'variables' section/category -> 'set a variable or attribute' Script -> set variable player.sex [EXPRESSION] "male"
else if [EXPRESSION] player.alias ="Jennifer"
-> then, -> add new script -> 'variables' section/category -> 'set a variable or attribute' Script -> set variable player.sex [EXPRESSION] "female"
else,
-> add new script -> 'variables' section/category -> 'set a variable or attribute' Script -> set variable player.sex [EXPRESSION] "unknown"


as for a 'cheat'... the easiest method would be to use a Command (in code example)

(Commands also get/use typed-in input by the person playing the game, so they work great as a "cheat code" - accurate pun, hehe)

create/add a global Command in the GUI/Editor via:

on the left side is the "tree of stuff", click on "Commands" (Objects -> game -> Commands) so that it is highlighted, and then on the right side/pane, click on the 'add' button, and set it up similiarly as I've done in code, for this specific example, anyways.

<command name="cheat_command">
  <pattern>cheat</pattern> // the pattern is the format of what you type in during game play to activate this command and optionally pass arguments/inputs to it for them to be used in the Command's scripting (this example does not use inputs/arguments). For this example, you'd just type in during game play: cheat
  <script>
    msg ("Enter password: ")
    get input {
      if (result = "endgame") {
        player.parent = room_66 // pretend this is near the end of the game
      } else if (result = "midgame") {
        player.parent = room_33 // pretend this is near the middle of the game
      } else {
        msg ("Wrong password, try again if you'd like")
      }
    }
  </script>
</command>

let me know if this is too confusing... and you need help with this stuff... as this will probably not make much sense... if you're new to 'if' logic, game making, and/or especially coding...


if you're not too confused by this stuff, here's a more detailed guide on this stuff (Attributes and the 'if' Script):

http://textadventures.co.uk/forum/samples/topic/5559/attributes-and-if-script-guide-by-hk


JenniferKline

Aha, so the Built-In score isn't as functional? I mean, oddly, the health system works exactly for what I'd want to do, so I might replace it with that, even better if there was a way to rename 'health' in the UI. The cheat commands I already have set up, my main thing is more I need a 'score' to act as the currency to buy the cheats, almost as if they're optional upgrades.

There are no win conditions, the game is impossible to beat and never ends, and that's more the point. It's just exploration, to find all the content and secrets. So perhaps saying I want the score to work almost like gold - i.e find a secret, +10 gold, and say 150 gold would allow for someone to acquire all hidden items in the game. As a base example. My issue last game was a ton of secrets were always missed and I got flooded with emails asking me how, why, when and where things were.

I'm a bit new to looking at the code side and tend to do most of my game using the 'standard' tools, so whilst I can sorta' see where bits make sense, treat me like a beginner!


XanMag

In my X3 game, I am going to do something similar to this. Call these "things" something like "Clever Points", or the like. You get Clever Points as you do clever things without asking for help. If you get stuck, I'd have a built-in hint system, as in X2, and your clever points get deducted whenever you ask for a clue. If you have zero clever points, too bad. No clues for you! I like this idea. I'm stealing it. Thanks!


hegemonkhan

I just have personal trouble with understanding the built-in 'score' Attribute, when I first started to learn quest and haven't gotten around to trying to understand how the built-in 'score' and its percentage works still... I'm lazy, so I just create my own Attributes.

So, I've no idea if it has less functionality, but I don't think so... (of course the built-in 'score' Attribute and its system/functionality was created, meaning that it is finite/limited. One could always create a more robust/complex/advanced system/functionality, as there's no in general limit on coding possibility/creativity/robustness/complexity/advancement: take for an analogy, you can always create a bigger/better house)


It's quicker/easier for me to help via code, so just ignore my posts or just the code parts of my post, as indeed, if you don't already know coding, looking-at/seeing code is quite confusing/meaningless/overwhelming/scary/terrorifying, etc.

I still like to post code, because if people can somewhat read/understanding it, they can at least see the 'if'/etc logic/mindset involved, which is important/neccessary for game making, even if not doing any coding.


if I'm not lazy and I got the time... I'll help on how to do stuff through the GUI/Editor, but not often anymore (and I don't know the GUI/Editor stuff that well, also).


hegemonkhan

the built-in 'score' Attribute is added to (contained within) the 'game' Game Object, so if you know the GUI/Editor's script options, use those drop down and etc options (Object: game, Attribute: score), but I don't know them that well, so I when helping on how to do stuff with the GUI/Editor, 'cheat' using the '[EXPRESSION]' option, allowing me to type/code in what I want done, lol.

within your 'cheat' Command's scripting/script, I think you want to do something like this within the GUI/Editor:

[if] [Object: game] [Attribute: score] [>= 90]
-> then, -> print a message
[else if] [Object: game] [Attribute: score] [>= 80]
-> then, -> print a message
//etc etc etc [else ifs] and/or an ending [else]
[set variable game.score = [EXPRESSION] game.score - 10] // since you used a cheat, your score is thus deducted.

if you can follow through this (an Attribute GUI/Editor step by step guide on making a demo game you can see/play it in action), it should give you a really good understanding on using Attributes:

http://textadventures.co.uk/forum/quest/topic/5387/i-really-need-help#37375


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

Support

Forums