I have been having a play around with JavaScript, building a new version of Quest. Note that this will not work with existing games, and as yet there is no editor. There definitely will be an editor eventually. There may be a way to convert files from Quest 5, at least to some degree, one day.
What there is at the minute is a framework to create games in JavaScript.
You can see an example game here. There is not much in the way of plot, but stuff to interact with to see how the world model feels. Let me know if there is anything important I see to have missed out.
http://textadventures.co.uk/games/view/48pkf40on0soigganjtatq/first-steps
Why JavaScript?
Better for players
Better for authors
Better for me
What else?
As I was building this from scratch, I could build in some features from seem lacking or are tricky to implement in Quest 5. The parser has a better idea of context, looking at what objects are where when matching commands, so should be better able to guess what the player means when it is ambiguous.
As much as possible is neutral with regards to the character (i.e., works for both the player character and NPCs), making it easy to add commands allowing the player to command an NPC.
Objects can be in several rooms at once. Countable objects that have specific numbers at different locations are built-in.
See more...
More details here, including a tutorial on how to create a game in this framework.
https://github.com/ThePix/QuestJS/wiki
I this is new, from the ground up, can I add an idea...
When the script has a get input command, the script stops and waits for the player to answer it?
This way, there is no need to nest get inputs inside of get input...
IE:
msg("Hello player, what is your name?")
get input
// script stops waiting for the answer...
or even:
get input player.alias
Then you could do this:
// player set-up
msg ("Name?")
get input player.alias
msg("sex: (M/F)")
get input player.gender
msg ("{player.alias}, what is your class? (Fighter, Thief, Cleric, Magic User)")
get input player.class
direct, no nesting, and no need to keep track of how many nests you did...
That is built-in to JavaScript already, with the prompt
function.
msg("'What's you name?' she asks.");
var name = prompt("Your name?");
msg("'Hi " + name + ",' she says. 'You're very sweet.'");
That is what I was suggesting...
And not that far from Basic's input command...
Couple of thoughts on possible next steps with Quest
The Electron project is essentially a Node.js application that hosts border-less browser window with Chromuim as UI engine - it is essentially similar to what Quest 5.8 uses currently so existing UI code can potentially be re-used, and "backend" using .Net Core could be leveraged to re-use some parts of existing code.
I don't have too much free time, so my progress in this is very slow, but I did some testing - it is certainly possible. (Node.js interop with .Net to start the self-hosted ASP.Net Core server can be made possible by the Edge library)
You built all this from scratch in a month and a half? Respect! I am curious how it will develop.
myarichuk
I was looking around for a good framework for the editor, and came across Electron. KV recommended it too. It does look to be the best solution. At the moment I am looking at a desktop system, but that should be cross-platform, if built on Electron. I have very little experience do this sort of stuff on a server, so that will take rather longer...
hi so I’m not sure if my reply to this is posted or not so I’m trying again I am totally blind and play these games I have tried to use the web player but I have found that it is very clunky because when you type in commands the screen reader does not read back what the command is so you have to swipe around on an iPhone to see what the command was which is what I would like to use to play these games now using quest on the computer works fine but that’s only with the application itself so what would be nice is to see away in the web player where you could type in a command and then have the screen reader automatically read back the response instead of making you go find it in the history of responses for example when you type examine cat the player should automatically re-ply The cat is round and fluffy instead of making you having to swipe left to see the response of the cat is round and fluffy I hope I explain this well enough but if not let me know and I can try to explain it better
H2359
I have added a SPOKEN command to the test game, which may help (only tested on Chrome). That said, if you are using a screen reader anyway, it may make it worse, as you may get everything twice.
http://textadventures.co.uk/games/view/48pkf40on0soigganjtatq/first-steps
DarkLizerd
There is a text-to-speech option in desktop Quest 5 (or at least there is if you have some extra software). H2359 is wanting to use it on the web player, which then has the browser sat in the middle, so it is the text-to-speech in the browser. The problem with the web player I guess is that Quest inserts the response into page, rather than appending it to the end, as it needs to go in before the command bar.
yeah I would rather play it on my iPhone then to use the computer because I don’t use my computer very much at all and if there’s a text to speech thing built into the web player then I have no need to use my screen reader it’s just with the way the web player is right now there’s nothing implemented that I know of to read out responses as you type in the commands also it would be great to see this be Built where you could play all games in it including existing ones
Also I tried to use the spoken feedback in the game and I tried it on Safari and chrome and when I turn on the spoken mode and try and type in a command still nothing is automatically read out and this is on an iPhone eights running the latest version of iOS if that helps s
Positive news. Presumably it'll help with the server issues which is rendering larger games unplayable? I like the interface.
I doubt you're looking for bug reports but in case you are it says Turn Script! after every turn and speak to works but talk to doesn't (which is the one listed in the interface). Also it doesn't force the page to scroll downwards meaning it has to be done manually once the page is filled. Good stuff so far though. I probably ought to attempt learning javascript again.
Looking at the tutorial on github, this is the perfect opportunity to help me learn js!
I took the liberty to fork the repository, to test and play with this new version of Quest.
A quick remark about the documentation: for NPC conversation, the verb is currently talkto
, and not speakto
I've made a few experiments. I like it so far.
I suggest adding a "use" verb in lang.js:
const VERBS = {
examine:"Examine",
...
use: "Use",
};
and add it in the default list of verbs of the TAKEABLE template. This will allow the player to use an item through links, and ensure that they play as much as possible through hyperlinks (less time to enter a command, more control on player output, less errors due to typos).
//The crystal ball is fixed in place, so I don't want my player to take it, but I would like them to use it
createItem("crystalBall",
TAKEABLE(),
{
getVerbs:function() {
return [VERBS.examine, VERBS.use];
},
loc:"Office",
regex:/^ball|crystal ball$/,
use:function() {
msg("You use the crystal ball (yay).");
},
alias: "Crystal ball",
}
);
I also suggest adding a chapter on the wiki about editing the verb list of an item (by changing its getVerbs attribute).
Hi all,
re spoken command: What you're looking for here is ARIA.
It is included in the W3C HTML5 standard, so anything starting with <!DOCTYPE html>
should definitely have access to ARIA.
How to use it?
If output returned by JS still is in divs, it's ridiculously easy to implement. All you need is add two attributes to the div: role="status"
and aria-live="polite"
So, for example:
<div id="output1" role="status" aria-live="polite">This is the game output...</div>
I'll do a small demo.
<button onclick="document.getElementById('demodiv').innerHTML = '<p>Upon clicking the button, the text gets inserted. At the same time, it gets spoken by any active screenreader.</p>'">Clic. this button to show demo...</button>
<button onclick="document.getElementById('demodiv').innerHTML = ''">Clear the div again.</button>
<div id="demodiv" role="status" aria-live="polite"></div>
Note that this method has one major drawback: In roundbased fights, the output will come in fast. No issue for speech as due to the polite parameter of aria-live the new messages won't interrupt the screenreader (as opposed to assertive mode). But for braille display users - they're not so lucky, as there's no "polite" mode for braille messages. Basically, one message will pop up on the braille display after the other, rapidly, making the unfortunate user incapable of interacting with the site. So make sure there's an option to switch this reporting behaviour off, especially when using round-based fights.
Yours,
Sturmjaeger
For other experimenters, here is a template for a gun, or other kinds of ranged weapons, with basic ammunition management:
https://pastebin.com/6zSAJKbb
Here I am (again), this time with a question.
Is there a function allowing you to pause the text until the player presses a key. This would be useful for long narration, or to create some suspense:
msg("You open the chest, and...");
//Wait for key
if(this.isMimic){msg("The chest comes to life! It's a trap!")}
else { msg("You found a treasure!"); }
For now, the only way I found is to use indirectly the showMenu
function, by offering the player a single choice which is "continue".
msg("You open the chest, and...");
showMenu("", {"continue"}, function() {
if(this.isMimic){msg("The chest comes to life! It's a trap!")}
else { msg("You found a treasure!");
});
Is there a function allowing you to pause the text until the player presses a key. This would be useful for long narration, or to create some suspense:
No there is not, and thanks for reminding me; it is something I have realised is going to have to be included. Creating something generic (so can be used with mouse and keyboard, both with a the text box and without, has so far stumped me, but it will happen eventually.
By the way, your earlier points have now been added to the code.
Thanks.
I am having a lot of fun with this framework, even if I am doing my own experiments for the moment, and not a lot of "pure" writing. I am already fluent in javascript, so it is much easier for me to work with this than Quest5's UI, or even Inform7's mix of code and full sentences. Having your result displayed instantly without compiling time is also a huge plus.
I see that you have started tackling the RPG angle. This will be interesting as well.
In the meantime, here is another pastebin: https://pastebin.com/GC5a3xDa
I saw that there is only a "real time" clock, so I coded for myself a custom clock with a turnscript, and a function to display the time, with a couple of options.
I also added a utilitary function that you could put in your utils, that takes a number and automatically adds "st", "nd", "rd" or "th" depending on the number.
I saw that there is only a "real time" clock, so I coded for myself a custom clock with a turnscript, and a function to display the time, with a couple of options.
It is not a real time clock, it uses turnscripts. It does use the built-in JavaScript display functions, however.
I also added a utilitary function that you could put in your utils, that takes a number and automatically adds "st", "nd", "rd" or "th" depending on the number.
Already done that too. It is in lang-en.js, and called toOrdinal
(though mine gives the word, first, second, third, etc.).
is this still actively being updated and work done I haven’t seen a post to this thread in a while so it’s why I was wondering s
Yes it is. Updates occasionally appear on the GitHub site linked at the bottom of the OP. I am having a go at creating a couple of games in it to see what there is missing. The editor is progressing slowly...
OK do you know when you would be able to play current games in it for example games that are already on the site
It will not be possible to play current games on it, it will not be backwards compatible.
It would be possible to play new games on it right now, but without an editor you need at least a passing knowledge of JavaScript to create a game. There is a tutorial to show you how, including how to publish your game.
oh OK I’m not concerned with building games I’m just more concerned with playing them the way it stands right now the web player is not built for excess ability for blind people lease not that I can tell inquest on the computer works but there’s no way to stop the speech from talking after making a command for example when you type in go north the speech player keeps giving room descriptions every time and there’s no way to stop the speech so that after you’ve already visited a room once it will just say the room name and that’s it
@H2359 Blind people barely use the computer anyway. Some have special computers that read everything out on the screen to them. One of my counselors had one. Anyways, I doubt blind people can feel the literal light coming out of the screen to make a game, or something else, I don't know. Are you blind? All those computers do the read out loud until the end thing.
jmnevil54, from communications elsewhere, I think H2359 really is blind, and uses a screen reader of some sort.
I would certainly want games to be playable by as wide an audience as possible, and it does seem particularly suitable with those with impaired vision.
jmnevil54, what you said is pretty much nonsense. I'm legally deafblind and started using computers at age seven. Blind people heavily rely on computers (and smartphones) for their everyday life, and quite some play text-based games (ask around in Avalon - the legend lives or Alter Aeon...).
Hence, I highly recommend taking blind people seriously. Both as users, and as developers. Regardless of any light (what did you even get at there?)
Pixie, I've been working with QuestJS for two months now and I absolutely love how customizable it is. Will upload the library (with accessibility improvements) once I'm done.
One question though: How can you pass variables to a regex in QuestJS?
regex:/^me|myself|player|(insert the player's choosen name here...)$/,
Normally in JavaScript, a regex would be a string, so you could add the variable in quite easily. But Somehow I couldn't figure out how to do this in QuestJS...
PS. In the Wiki, you should turn this PLAYER into a PLAYER() in tutorial one ;-) Could cause some copy-paste-confusion...
Hi Nile
In JavaScript a string is different to a regex, but you can create a regex from a string:
regex: new RegExp("^me|myself|player|" + playerName + "$"),
Hi, Pixie,
I tested this thoroughly now and am slightly clueless. If I do the following:
createItem("me", PLAYER(), { regex:new RegExp("^me|myself|player|"+this.firstName.toLowerCase()+"$"), firstName:"Joe", desc:"To do", });
The game throws the error that no player object got found; in the console I get the message that "undefined is not an object". When I console.log the string I use for the new RegExp, everything looks fine thoug (^me|myself|player|joe$). If I use
regex:function() { return new RegExp("^me|myself|player|"+this.firstName.toLowerCase()+"$"); },
the game initializes fine, but once I enter "look joe", the command only gets echoed, no action executed, and the text input doesn't get cleared.
typeof(this.firstName.toLowerCase())
is string. What am I missing?
Okay. I think I have figured everything out.
the regex property does not execute functions. If you specify a function for regex, the regex will fall back to using the default (for PLAYER(), this is /^me|myself|player$/). I'm not sure why regex doesn't execute functions. I'd have to find out where in the lib the regex property gets defined - I guess I'll get to that in the next days.
Using variables in the regex directly doesn't work, as at the time the regex gets evaluated, the properties my variables referred to did not exist yet. It's a subtle difference, but an important one: Functions run each time when needed, so generally aall objects are already created when the function gets called for the first time; but strings, integers, booleans and all the other non-function values get evaluated before the object is fully created. At least that's how I explain my variables always ending up as "undefined" when I do the following:
regex:new RegExp("^me|myself|player|"+this.firstName),
As a Quick, hacky fix I created the following function:
function setRegex(obj, regexString) {
w[obj].regex = new RegExp(regexString);
}
You can call this function whenever you need to change the regex of any object. Just pass it the object.name property as first argument and the string of your regular expression (so quotation marks instead of slashes) as second parameter.
This works, but is unpleasantly hacky mn my opinion. Pixie, do you have an idea why setting the regex property to a function doesn't work?
Alright, that's all from my side ;-) Happy coding/writing y'all.
I would guess this
is not defined. I cannot see what it would refer to. Which makes it very odd that you got typeof(this.firstName.toLowerCase())
to work, but maybe te context was different?
New to Quest and am really enjoying it. Working on a game I hope to publish shortly. The move to all JS is very exciting to me and I will keep my eye on its development.
I ran across Blockly a few years back. Might this be of use (or at least an inspiration) in the forthcoming editor UI?
https://developers.google.com/blockly/
Steve
That would be excellent, and I seem to remember someone suggesting it to Alex a long time ago (thanks for reminding me!). How easy it will be to integrate I do not know, but definitely something to try.
Hi,
I might have found a "bug" -- at least something that isn't quite working as advertised. Let's assume we have a container -- e.g. a wallet -- and want to put countables in it, for example coins. If we create each coin uniquely, and then type TAKE COIN, the coin gets taken from the wallet without complaint (provided the wallet is open). But if I turn this into a countable, I always get the response: "There's no coins here.", which has to do with how the COUNTABLE() template processes take. The take is only successful if the coins are in the same room as the player -- but not if they are in a container in the same room, or in a container in the player's inventory.
I'll try to find a fix for this, but as I don't fully understand scope yet, I'm not sure I could find a workaround so wanted to put this out there.
Thanks for highlighting that. I am guessing TAKE COINS FROM WALLET works... Hmm, no that fails too, even for a unique coin because there is no such command!
I have made an update. The fix requiring tweaking the scoping, and the TAKE command as well as adding the extra command.
Just curious. Has any progress been made to move Quest into HTML or away from Visual Basic? I haven't heard anything from that front in a while. ^_^ Keep up the great work everyone!
Anonynn.
It is on-going. The editor is going much slower because it is using two frameworks, React and Electron, that I am not familiar with, so properly understanding them is taking some time. I am also hoping to use Blockly, which again is new, and may not work with React/Electron.
I have recently changed it so it will read a Quest 5 file, to make conversion easier, but you would still have to modify code by hand to convert that to JavaScript.
You can fint it all here:
https://github.com/ThePix/QEdit