Should these commands be built-in?

K.V.
04 May 2018, 11:27

A (standard?) command which examines the PC's overall condition (health and score, if applicable) is DIAGNOSE. (The default would be the default when examining the PC.)

Anyone think this should be buit-in?

Also, what about SCORE? Default would be something like "There is no scoring in this story." Oherwise, it would show the score (and game.maxscore, if it exists).


-=Darchy=-
04 May 2018, 13:46

I personally like simplicity K.V so yes it would be a nice addition.

If I may? Maybe another little thing would be something for integers like:

inc (player.ammo, x)
inc (player.credits, x)
...
That would increase player.variable with the value x

would save typing out player.credits = player.credits + x

I apologise in advance if these commands exist and I have missed them.

-=Darchy=-


K.V.
04 May 2018, 18:12

You can use IncreaseCounter(player, "ammo")


-=Darchy=-
04 May 2018, 18:32

I knew I would have missed something like that :D - Thanks K.V.

-=Darchy=-


Doctor Agon
04 May 2018, 19:13

I thought 'Score' did exist already. It's on the 'features' tab of the main game object. Once ticked, a new section opens up on the 'add script command' pop-out menu. Together with 'health' and 'money' if they are ticked.


K.V.
04 May 2018, 21:06

Don't fret, Darchy. I just found that function a few days ago, myself.

(The cool thing about IncreaseScore() is the fact that it will create the attribute if it does not exist.)


Dr Agon,

Is there a SCORE command? (I may have overlooked it.)


Doctor Agon
04 May 2018, 21:36

Sorry K.V., I misunderstood. Although, score does exist/appear/is in (doing my best to channel HK), in the game as a status, you're correct, there is no score command. My bad. Sorry.


K.V.
04 May 2018, 22:13

Hehehe

i am modify/changing/altering Pixie's code in SaveLib (which is old, virtually/mostly/figuratively nonexistent code) to work with the current score scripts.


Here's what I'm currently tinkering with:

Edited

<!--Saved by Quest 5.8.6698.11031-->
<asl version="550">
  <include ref="English.aslx" />
  <include ref="Core.aslx" />
  <game name="ScoreLib tester">
    <gameid>29fe19be-bc8b-4ad5-bff6-be1a65a51650</gameid>
    <version>1.2</version>
    <firstpublished>2018</firstpublished>
    <show_score />
    <start type="script">
      InitScore (100, "sucky,awesome", false)
    </start>
  </game>
  <object name="room">
    <inherit name="editor_room" />
    <object name="player">
      <inherit name="editor_object" />
      <inherit name="editor_player" />
    </object>
    <object name="stick">
      <inherit name="editor_object" />
      <take />
      <ontake type="script">
        IncScore ("got_stick", 50)
      </ontake>
    </object>
  </object>
  <command name="score">
    <pattern>score</pattern>
    <script>
      if (not game.show_score) {
        msg ("There is no scoring in this story.")
      }
      else {
        PrintFullScore
      }
    </script>
  </command>
  <function name="InitScore" parameters="max, ranks, status">
    game.score_rank_list = Split(ranks, ",")
    game.score_max = max
    game.score_achievements = NewStringDictionary()
    game.pov.score = 0
    if (not status) {
      game.pov.statusattributes = NewStringDictionary()
    }
    if (DictionaryContains(game.pov.statusattributes, "score")) {
      dictionary remove (game.pov.statusattributes, "score")
    }
    dictionary add (game.pov.statusattributes, "score", "Score: !/" + max)
  </function>
  <function name="IncScore" parameters="str, inc">
    if (not DictionaryContains(game.score_achievements, str)) {
      game.pov.score = game.pov.score + inc
      dictionary add (game.score_achievements, str, ToString(inc))
    }
  </function>
  <function name="GetScore" type="int">
    return (game.pov.score)
  </function>
  <function name="PrintScore">
    msg ("You have scored " + game.pov.score + GetRank())
  </function>
  <function name="PrintFullScore">
    PrintScore
    if (HasAttribute(game, "score_achievements")) {
      foreach (ach, game.score_achievements) {
        msg ("- " + ach + " (" + DictionaryItem(game.score_achievements, ach) + ")")
      }
    }
  </function>
  <function name="GetRank" type="string"><![CDATA[
    if (HasAttribute(game, "score_max")) {
      if (player.score >= game.score_max) {
        return (" giving you the rank: " + StringListItem(game.score_rank_list, ListCount(game.score_rank_list) - 1) + ".")
      }
      else if (0 >= game.pov.score) {
        if (HasAttribute(game, "score_rank_list")) {
          return (" giving you the rank: " + StringListItem(game.score_rank_list, 0) + ".")
        }
      }
      else {
        if (HasAttribute(game, "score_rank_list") and HasAttribute(game,"score_max")) {
          n = ListCount(game.score_rank_list) - 2) * (game.pov.score - 1) / (game.score_max - 1) + 1
          n = ToInt(ToString(Round(n)))
          return (" giving you the rank: " + StringListItem(game.score_rank_list, n) + ".")
        }
      }
    }
    return (".")
  ]]></function>
</asl>

K.V.
04 May 2018, 22:14

PS

I wasn't using caps to yell at you. I just use all-caps for commands when posting here.


hegemonkhan
05 May 2018, 06:01

it's probably bad grammar style ... but if you want to be cool like HK ... keep doing the 'XXX/XXX/XXX' usage, lol

(HK has a hard time with american english, and american english is the only language HK knows lol, as many words to him reference/symbolize/mean the exact same thing/concept/etc, so he doesn't know which word to use, and thus he just includes a bunch of them, via: 'XXX/XXX/XXX/etc', lol)


K.V.
05 May 2018, 06:03

he doesn't know which word to use

...or which word the reader will understand/comprehend/recognize/recognise.


hegemonkhan
05 May 2018, 06:05

yep... so... just provide a list... and hopefully one of the items will register with them... hehe (I used computer/programming lingo for puns, hehe)


-=Darchy=-
05 May 2018, 10:54

I use a command called 'cmd_player_stats' that prints HEALTH, SCORE and MONEY etc when you type in STATS or STATUS.

(Looks better on a black background)

msg ("Your health is at " + "<b span style=\"color: orangered;\">" +  player.health + "%</span></b>" + "<span style=\"color: chartreuse;\">" + "." + "</span>")
msg ("You have " + "<b span style=\"color: orangered;\">" +  player.money + " credits</span></b>" + "<span style=\"color: chartreuse;\">" + "." + "</span>")
msg ("You have scored " + "<b span style=\"color: orangered;\">" +  game.score + "%</span></b>" + "<span style=\"color: chartreuse;\">" + "." + "</span>")

-=Darchy=-


mrangel
05 May 2018, 12:05

I can't find the relevant post to reply to now, but HK's comment about use of terms reminded me of something.

I vaguely recall someone (I think it was you, but not sure) using the terms "object" and "OBJECT" to distinguish between two different types of object in the Quest documentation (which can be quite confusing).
Next time a conversation comes up where it matters, maybe we could use the terminology in the source code instead:

An "object" is something the player can use, pick up, interact with, look at, enter, etc. "objects" may also include rooms, because there's no difference between them from the game's point of view. A couple of times I've noticed code comments that use "item" to mean an object that isn't a room.

An "element" is anything in the game model that can have attributes and children; and that can be put in an objectlist. This includes objects, exits, turnscripts, commands, and the special game element. [Note - if you use custom scope scripts to put these elements in scope, Quest has no problem letting the player use commands on them]

Most functions that take an object as an argument will actually work on any element; but there are some that only work on actual objects. This can be confusing, and might need a little trial-and-error, because the documentation just refers to "object" in both cases.

(And while typing this, a very silly idea came to mind. If there's objects in a room that can only be found by searching, you might normally make them hidden, or put them in a temporary holding area until they're needed. But an alternative solution might be putting hidden objects inside the 'search' command, where the search script can use GetDirectChildren(this) to find them :p Not sure if that would actually work, but it's an interesting thought)