Game-changing updates in 0.8

As I mess around writing my own games, I realise there are various issues still in the Quest 6 code, and try to update them as I go along, so you will see updates on Github every now and again. Occasionally, this will potentially affect other people's game, and there have been a few recently. These are mostly obscure points I doubt anyone is using yet... until today's update, anyway!

In light of that, I want to highlight some recent changes and what authors need to do to keep their games current.

There is a good argument for waiting until the next point release. When 0.8 is released, download that version, look back here and update your files accordingly. However it is easier for me to note changes as I go along.

I really want to keep the number of changes like this to a minimum so games are backwards compatible, but on the other hand, to support that I really need to get it right now, before QuestJS is properly released. So apologies, but...

The first is the big one, the next two might affect someone, the rest I include for completeness.

moveChar

Previously the player object was moved with world.setRoom, while NPCs were moved with either that or with npc.moveWithDescription. I have realised a better way is with just a single function. Part of this is so the side effects are consistent. If NPC is carrying something that is triggered when moved it should act the same as if the player is carrying it. There is also an issue with changing the POV, so the user is now controlling what was previously an NPC.

What needs to be changed?

Instead of:

world.setRoom(char, dest, dir)
char.moveWithDscription(dest, dir)

Do:

char.moveChar(dest, dir)

As before dir is optional; if missing this will be done silently.

simpleIsAtLoc

The function complexIsAtLoc has been renamed to simpleIsAtLoc, because it is a more simple version (rather than an easier way to do something complex, which was the earlier thinking).

Restriction testing

Renamed for wear/drop/full/put in for consistency to test[verb]Restrictions, and to avoid naming collisions.

canWearRemove(char, true)
canWearRemove(char, false)
testRestrictions(obj)         [give]
testRestrictions(obj, char)  [put in container]

Change to:

testWearRestrictions(char)
testRemoveRestrictions(char)
testGiveRestrictions(char, obj)
testPutInRestrictions(char, obj)

Command objects array options

Previously you could use ignore:true and text:true in the objects attribute of a command. These hae been subsumed into the special attribute

ignore:true,
text:true,

Becomes

special:'ignore',
special:'text',

The special attribute allows authors to add their own options here too.

settings.funcForDynamicConv

settings.dropdownForConv nolonger used, instead settings.funcForDynamicConv controls the style, allowing for more options.

NPC reactions

Uses an array, rather than a dictionary.


I say all bets are off before version 1.0.

Anyone making Quest 6 games with the pre-released code (including me) can either update our code or finish our work in progress without switching to the updated files.

Fix that stuff, Pixie! Don't hold back!


@K.V. Absolutely this. Anything pre 1.0, people should expect frequent changes and updates. Really looking forward to the final release!


just read "settings.funForDynamicCow" :-)


The "visited" attribute of a room is incremented after the description, but now before afterEnter and afterFirstEnter are run. It seems more intuitive. Before the room is entered, the player has not visited. After the room is entered, the player has visited it, which is how turn scripts have always seen it.


The background object is no longer a thing.

The background object would be set up in room description by flagging nouns with square brackets. When the player enters the room, Quest would grab those nouns and give the background object a regex based on them, effectively faking the existence of them, so if the user looks at any of them Quest can pretend it is there, but just tell you it is scenery.

createRoom("lounge", {
  desc:'A smelly room with an [old settee:couch:sofa] and a [tv:telly]. There is a tatty [rug] on the floor.',
  east:new Exit('kitchen'),
  west:new Exit("dining_room"),
})

Instead, you can now create scenery objects by setting the "scenery" attribute of a room. It is moretyping, but this creates normal items, so is actually more simple code internally, and does all the work up front, rather than each turn. It also gives you the option of adding a description.

createRoom("lounge", {
  desc:'A smelly room with an old settee and a tv. There is a tatty rug on the floor.',
  east:new Exit('kitchen'),
  west:new Exit("dining_room"),
  scenery:[
    'tv',
    {alias:['old settee', 'couch', 'sofa']},
    {alias:'rug', desc:'It might have been blue at one time. Maybe.'},
  ],
})

https://github.com/ThePix/QuestJS/wiki/Attributes-for-rooms#scenery


Timed events have been re-written, see here.


Renames some attributes for consistency:

onGoCheck -> testCarryRestrictions
onGoAction -> afterCarry
itemTaked -> afterItemTakenFrom
itemDropped -> afterItemDroppedHere
checkOpenClose -> testOpentrestrictions/testCloseRestrictions
onOpen -> afterOpen
onClose -> afterClose

More renaming and also reordering of parameters for restriction and reaction attributes. Hopefully all done now!

Details are here, which is now much shorter, which is a good sign.
https://github.com/ThePix/QuestJS/wiki/Restrictions-and-Reactions


All of it massively over my head, but I just like seeing enthusiastic updates of progress. Keep it up! ♥


The custom save/load methods have been renamed , again for consistency:

preSave -> beforeSave
templatePreSave -> beforeSaveForTemplate
postLoad -> afterLoad
templatePostLoad -> afterLoadForTemplate

Some changes for names:

  • properName is now properNoun, as that is the correct term.
  • parserAltNames is now synonyms

The second parameter for setAlias is now a dictionary, so you can set other attributes at the same time.


parsePriority is now parserPriority; I found I was using that anyway, so feels more natural

moveChar takes the exit as a parameter only, as various functions it calls need that, and the exit provides the destination. If you want to move a character where they is no exit, you wil need to set "loc" directly and handle the various possible side effects yourself.


The text processor directive "param" has been removed. Originally, "show" would show a value of an object specified in the text, while "param" did that for an object in the params, but they both got modified to partly do the other too, but in slightly different ways. It seems better to have just one function.

The params will no longer work for the object name; if "show" finds a parameter is a string, it will take it as a string, not try to convert it to an object.

If "show" gets a function the function will be passed the params, not further arguments in the directive. If this turns out to be a problem, it could be modified to send the arguments as a second paramter.


I have now released version 0.8. I think I have done all the big changes now, and I would like to think this will be a bit more stable, but we will see...


I'll try to break it for you.

Then, hopefully, Pertex will try to break the example game for me.

:o)


I will do my best :-)


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

Support

Forums