Quest 5.7.2 released

Well, sort of.

The desktop version is here:
https://github.com/textadventures/quest/releases

I have asked Luis to upload to the web site, and the web version will not be updated until that happens.

Changes are listed at the bottom of this page.


It is just possible you will see an error like this when you try pick up an object or drop it. If this is an issue then it will happen ever time, so if you are worried, go into your game, pick something up, and drop it; if it works, this does not apply to you).

This is the error:

Error running script: Cannot foreach over 'Object: [object]' as it is not a list
This is because Quest handles ALL a bit differently now, and you have your own version of either the TAKE or DROP command in your game, and it is still trying to use the old system (or you are using CombatLib, which has its own version).

Your command will have a strange script called "multiple" that returns a list, perhaps like this:

    <multiple>
      return (ListExclude(ScopeVisibleNotHeldNotScenery(), game.pov))
    </multiple>

You need to replace that with a script called "multipleobjects" that sets game.pov.currentcommandpendingobjectscope, and also to set the "scope" attribute. The above would be replaced with this:

  <multipleobjects type="script">
    game.pov.currentcommandpendingobjectscope = ListExclude(ScopeVisibleNotHeldNotScenery(), game.pov)
  </multipleobjects>
  <scope>notheld</scope>

If you are using CombatLib, I have just put up a new version with this issue fixed, so downloads that and replace the old version in your game.

If you have modified the library a lot you may prefer to update your version. Go to the "commands.xml" file, and replace the TAKE command with this:

  <command name="take">
    <pattern>take #object#; get #object#; pick up #object#</pattern>
    <multiple>
      takeList = NewObjectList()
      foreach (obj, ListExclude(ScopeVisibleNotHeldNotScenery(), game.pov)) {
        if (obj.parent = game.pov.parent) {
          list add (takeList, obj)
        }
      }
      return (takeList)
    </multiple>
    <scope>notheld</scope>
    <multipleobjects type="script">
      game.pov.currentcommandpendingobjectscope = NewObjectList()
      foreach (obj, ListExclude(ScopeVisibleNotHeldNotScenery(), game.pov)) {
        if (obj.parent = game.pov.parent and not DoesInherit(obj, "npc_type")) {
          list add (game.pov.currentcommandpendingobjectscope, obj)
        }
      }
    </multipleobjects>
    <script><![CDATA[
      if (IsUnableToHold()) {
        msg ("You cannot pick anything up with <i>" + GetDisplayAlias(game.pov.currentspell) + "</i> active.")
      }
      else if (multiple and ListCount(object) = 0) {
        msg ("Nothing here to take.")
      }
      else {
        foreach (obj, object) {
          DoTake (obj, multiple)
        }
      }
    ]]></script>
  </command>

The new versión is on the website.

Any problem, comment.

:)


Thanks. Only done a quick test, but looks good!


This is pretty cool!

Especially the change to the Split() function!

I just tested that out with this:

list = Split("Fred;Barney;Wilma;Betty")
this = PickOneString(list)
create (this, "npc_type")
this = GetObject(this)
this.parent = game.pov.parent
if ((this.name = "Fred") or this.name = "Barney") {
  this.article = "him"
  this.gender = "he" 
  this.possessive = "his"
}
else {
  this.article = "her"
  this.gender = "she"
  this.possessive = "hers"
}
this.look = CapFirst(this.gender)+" looks just like the character from The Flinstones!"
this.takemsg = "You can't take "+this.article+"."
this.speak => {
  msg (CapFirst(this.gender)+" ignores you.")
}

...and it works!

Whoo-hoo!


Great! My function ist working. Now I can do the write function


Congratulations Andy (The Pixie). You have made a large number of valuable changes to the Quest engine in the latest release, despite it being described as a “minor update”, and don’t seem to have broken anything in the process. I’ve played through the three games with which I’ve been involved, and despite two of them using Internal Core.aslx Functions (for drawing purposes) all work as before, without any problems. I’ve only started looking at the new features in detail and will probably only appreciate them fully in my next project. Though perhaps minor to you, I like the ability to control the response to faulty commands and the more intelligent take and drop. Can this idea be extended to examine and give?

I did find a couple of oddities but these my be connected with my understanding so I’ll put them into a PM. Again, well done!


Though perhaps minor to you, I like the ability to control the response to faulty commands and the more intelligent take and drop. Can this idea be extended to examine and give?

GIVE, yes. All should apply to things you have. I will look at that. I tried to think of what else it should apply to and forgot that one.

EXAMINE should do everything though, I would have thought?


Here is an example . I am in a room containing a first aid box, holding a box of matches, and try to examine 'box'. The response is as follows. I was expecting the one I was holding to be taken by default?

x box
Please choose which 'box' you mean:
1: first aid box
2: box of matches


Does the popup command work in gamebooks?

In 5.7.1 it didn't work, but it didn't throw errors, either. It's the first thing I've tried out in 5.7.2 and I got the following error:

Error running script: Error compiling expression 'JSSafe(s1) + GetRandomInt(0, 999999999)': FunctionCallElement: Could find not function 'JSSafe(String)'
Error running script: Error compiling expression 'Instr(text, "{")': FunctionCallElement: Could find not function 'Instr(Object, String)'

Also, it throws this error with one or more words in the link text field.


I've added a timesexamined integer attribute to objects and had the lookat script increase that by 1 (when it wasn't dark and the object wasn't a light source).

(If you kept putting your eyeballs on one of my NPCs, he'd get a little more perturbed each time. In fact, he'd eventually kill you for it.)


What if I was holding a box of matches, which I acquired 50 turns ago, no longer need, and have also completely forgotten about. Then, I enter the room, and it says:

You are in a room with medical supplies.

You can see a first aid box.

>x box
There are 2 matches in it.


You mean you want me to type out X FIRST AID BOX?

Are you insane?!? (Insert maniacal laugh here.)

I'm actually just kidding.

I've wanted to do away with that disambiguation menu before, but I was convinced that it's the best way to fly.


Hello, Jennifer.

Add this to your game in full code view. (I try to put the functions just before the last line, which is </asl>.)

  <function name="JSSafe" parameters="s" type="string"><![CDATA[
    s = Replace(s, "\"", "")
    s = Replace(s, "\'", "")
    s = Replace(s, " ", "")
    s = Replace(s, ".", "")
    s = Replace(s, ",", "")
    s = Replace(s, "!", "")
    s = Replace(s, "?", "")
    s = Replace(s, "-", "")
    s = Replace(s, "/", "")
    s = Replace(s, "(", "")
    s = Replace(s, ")", "")
    s = Replace(s, "$", "")
    s = Replace(s, "%", "")
    s = Replace(s, "&", "")
    s = Replace(s, "*", "")
    s = Replace(s, "@", "")
    return (s)
  ]]></function>

Here is a very small example game:

<!--Saved by Quest 5.7.6606.27193-->
<asl version="550">
  <include ref="GamebookCore.aslx" />
  <game name="Gamebook572">
    <gameid>e1ea9a0c-e2d1-45ba-9ae3-5e3dacb9f69e</gameid>
    <version>1.0</version>
    <firstpublished>2018</firstpublished>
  </game>
  <object name="Page1">
    <description>You can see a {popup:message:Hello, Jennifer!} here!</description>
    <options type="stringdictionary" />
    <script type="script">
      msg ("")
    </script>
    <object name="player">
      <inherit name="defaultplayer" />
    </object>
  </object>
  <function name="JSSafe" parameters="s" type="string"><![CDATA[
    s = Replace(s, "\"", "")
    s = Replace(s, "\'", "")
    s = Replace(s, " ", "")
    s = Replace(s, ".", "")
    s = Replace(s, ",", "")
    s = Replace(s, "!", "")
    s = Replace(s, "?", "")
    s = Replace(s, "-", "")
    s = Replace(s, "/", "")
    s = Replace(s, "(", "")
    s = Replace(s, ")", "")
    s = Replace(s, "$", "")
    s = Replace(s, "%", "")
    s = Replace(s, "&", "")
    s = Replace(s, "*", "")
    s = Replace(s, "@", "")
    return (s)
  ]]></function>
</asl>

Thanks, K.V., I'll try that... after I re-install 5.7.2.
The good news is that popups now work in 5.7.1. Which suggests a permanent registry change after uninstalling 572 and re-installing 571. Not sure I'm comfy with that, LOL.

I'll let you know how your fix works...

Jenn

UPDATE:
Thanks, K.V.,

That worked very well. But, am I going to have to put that into every game I make?
Should I consider editing the gamebook core?


You can see a first aid box.

x box
There are 2 matches in it.

With each verb there is likely to be a different preference. For 'take' there is an implication that the player doesn't have the item. For 'give', the opposite is true. For 'examine', more often than not something would be examined before it is taken or some operation performed on it. So in the box case above, the default would be the first aid box not the box of matches. When developing a game I try to avoid these conflicts so perhaps the best solution is to use 'medicine cabinet' in place of first aid box! ...except that there is a filing cabinet in the same room :)


Andy, I can't send an email to you? So, in reply to your question about reversing the user defined error command response:

Nothing comes out when if I delete the code at user level. To go back I have to delete the following in the underlying code:

 <unresolvedcommandhandler type="script">
 </unresolvedcommandhandler>

..and you might have some medicine in the medicine cabinet...


You are in a room.

You can see a medicine cabinet.

>x me
You are terminally ill.

If you don't take some medicine within 3 turns, you will die!

(Luckily for you, there's a medicine cabinet here!)

>open cabinet
Which one?
1. Filing cabinet
2. Medicine cabinet

-2-
You open it.
It contains a medicine.

>take medicine
Which one?
1. Medicine
2. Medicine cabinet

-1-
You pick it up.

>take the medicine
Which one?
1. Medicine
2. Medicine cabinet

-1-
You're already carrying it.

YOU HAVE DIED.


PS

You needed to USE THE MEDICINE!!!


Okay KV, I'm convinced that (a) 'examine' should use the disambiguation menu rather than guess; and (b) I should call the 'first aid box' a cupboard to avoid the problem!


Nothing comes out when if I delete the code at user level. To go back I have to delete the following in the underlying code:

Right, I see what you mean. You could delete the unresolvedcommandhandler attribute from the Attributes tab.


Right, I see what you mean. You could delete the unresolvedcommandhandler attribute from the Attributes tab.

I only brought this up as a user might expect to revert to the original by deleting the code or de-selecting advanced scripts. Can the attribute be deleted automatically when these conditions are detected?


For the record, DavyB,

I was just trying to make you laugh.

I'll play a game with "tomato juice" in a "can of tomato juice" as long as said game is fun.


Don't worry, I'm smiling!


Can the attribute be deleted automatically when these conditions are detected?

I do not think Quest has a way to test if a script attribute is empty, so not in a simple way, no, unfortunately.


I do not think Quest has a way to test if a script attribute is empty, so not in a simple way, no, unfortunately.

Thanks, I'm sure this won't cause anyone a problem in practice...it just feels untidy!


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

Support

Forums