Can I use an array for this JS function? (Trying to print random things to the command box.)

Is this feasible?

request (SetInterfaceString, "TypeHereLabel=I'D LIKE THIS TO PRINT ONE OF 3 RANDOM THINGS.")

I know very little JS. I'm thinking something similar to this may work:

var textArray = [
    'Enter your command here...',
    'This is where you type...',
    'The name of this game is not an acronym.',
];
var randomNumber = Math.floor(Math.random()*textArray.length);

Then, maybe this(?):

request (SetInterfaceString, "TypeHereLabel=textArray[randomNumber]");

Or should I set up a string list attribute for game with the responses?
Could JS iterate through that?


In over my head, but learning to dog-paddle...


Got it!

Here's what I came up with:

GAME ATTRIBUTE:

<cmdprompts type="stringlist">
      <value>Quest is the best way to create a text adventure!</value>
      <value>Type here...</value>
      <value>Enter your command here...</value>
      <value>Are you parsing or pointing and clicking?</value>
    </cmdprompts>
TURN SCRIPT-->

cmdprompt = (PickOneString(game.cmdprompts))
request (SetInterfaceString, "TypeHereLabel=" + cmdprompt + "")

Yay!
Now I can alter that whenever I please!

What's that? You entered: HINTS ON?
Well, now the command prompt can give you a little clue about what to type into it, depending on the circumstance(s)!


What's that? You entered: HINTS ON?
Well, now the command prompt can give you a little clue about what to type into it, depending on the circumstance(s)!

That is an excellent idea!


Oops, I posted those under the wrong account.

(Aargh! That's the second time I've done that...)

I write in two styles, each under a different pseudonym. ( I say 'two styles', but I basically just avoid using 'foul' language when writing as W.H. Dunnlatch. I initially published two versions of my first game, censored and explicit - but under Richard Headkid, but, the way the site is set up, the kiddies would see the explicit versions listed if they ever clicked on my name, so I decided to use separate accounts to avoid the accidental warping of any young minds.)

I'm logged into this account in one browser, and I'm logged into W.H. Dunnlatch in another browser.

In this instance, I accidentally posted as my alternative Nom De Guerre. So, that's the reason I'm responding in place of W.H. Dunnlatch (which is actually me).

Sorry about that.


Pix,

Thanks for the kind words!

I'm planning on using this during get input, too.

Please answer the NPC's question...


Here's the work in progress: http://textadventures.co.uk/games/view/rr9vezzxkeaovamsaqgxcw/they-call-ya-mister-quest-prototype-in-progress


Hi Richard Headkid,

How did you place an image of a gun (or any image) in your command prompt, if you don't mind me asking? Thanks.


  • I downloaded FontForge, then download the Rye font from GoogleFonts, then downloaded the 'wild west' font from DaFont (this may be the wrong font name - I list it all if you click on CREDITS from the main page).

  • Then, I changed the value of > to the revolver glyph from the Wild West font using FontForge.

  • I saved that font as Rye Custom. (Also using FontForge)

  • I converted Rye Custom to Base64 (using the BASH! shell), then embedded it into the CSS I added in to the game's main source code in the main source cod in the Quest editor. From there, I can just call it up with SetWebFont(). NOTE: In the future, my embedded Base64 code will be in a library to make editing the main code easier.)

  • This is what I call fun!

Here are links to the guides (many thanks to The Pixie!):
https://github.com/ThePix/quest/wiki/UI-Part-02:-HTML-elements-and-CSS-attributes

https://github.com/ThePix/quest/wiki/UI-Part-03:-Fonts


NOTE: Make sure the fonts you download are 100% free and the author has put in print that it's okay to alter and use them publicly!


How did you place an image of a gun (or any image) in your command prompt, if you don't mind me asking? Thanks.

If it was me, I would insert an image in the txtCommandPrompt element. Still complicated, but probably not as much.


Yeah, I second that!

The revolver is printed rather than '>' if the font is set to Rye Custom.

^ is a horse

= is a badge

+ is a dude on a horse

All these things were for the Inform 7 version (http://textadventures.co.uk/games/view/ogj8kixyx0emjknru3nckg/they-call-ya-mister). The location/status bar displays the different images depending on whether you're wearing the badge, the horse is following you, you are riding the horse, etc.

Plus, the revolver is pointing right at your printed commands (old commands? whatever the terminology is).

Inserting an image is a much better idea...


The Glulx version I linked to above is complete, but unlisted and pending feedback.

The following links to the Quest port (which I linked to earlier in this thread, but oh well), still in progress. (Type HELP. I added a few nice tips so the player can control the GUI.)

http://textadventures.co.uk/games/view/rr9vezzxkeaovamsaqgxcw/they-call-ya-mister-quest-prototype-in-progress


Wow! That is way above my pay grade!


I was leery of CSS up until about two months ago. (Maybe three...)

Then, I discovered CTRL + SHIFT + I in the Chrome/Chromium browser. You can play with the CSS and see the results instantly, all in the same window!

Pay a few visits to w3schools, too, and you'll be dangerous in no time!

FontForge:

It was all drag and drop.

I opened Rye in one window, and it showed the glyph for each character/keystroke. I opened Wild West (or whatever it was) in another window. Then, I just dropped a few from one window to the other and saved it.

It's GUI, and fairly user-friendly.


The image is probably the way to go.

I bet The Pixie drops a code on us shortly. (In fact, if no code appears within 48 hours, I'll type 'BLORPLE' as fast as I can, a hundred times in a row. (And that's my least favorite 'word' to type!))


Here's a link to a thread which describes two ways to alter CSS:
http://textadventures.co.uk/forum/samples/topic/-sem6m7qe02a6jr9spodig/add-css-and-javascript-to-your-game#e5199563-7888-479a-a37a-91c836df9959

I think there are new CSS options in 5.7, as well, but I haven't played with them yet.


Dcoder,

<h1>&#9774;</h1> (or at the begginning of a line in markdown # &#9774;) gives you

Conversely, <h1>&#9760;</h1>yields:

That there's HTML Unicode UTF-8.

It works in HTML or Markdown, and I REALLY wish I found the page I'm linking to below BEFORE I started making my game!

https://www.w3schools.com/charsets/ref_utf_symbols.asp

<h1>&#9785;</h1>

<h1>&#9786;</h1>

<div style="font-size:500%">&#9758;&nbsp;&#9756;</div>

☞ ☜


"I'm 'a tear [expletive deleted] up, if I get the chance..."
-Todd Shaw (A.K.A. Too $hort)


I have updated the docs about using the UTF-8 codes, with that link. It is trivial in Quest 5.7 using them
http://docs.textadventures.co.uk/quest/ui-style.html


 trivial

  • denoting a subgroup that either contains only the identity element or is identical with the given group.

  • of little value or importance.


♰ definitions from Google Search


I'm thinking both definitions are relevant here. (Ha-ha!)
(I'm kidding! It's pretty cool! No CSS nor images to fool with!)


"It's ALL Trivial!"
-Chris Haney


Rich: Thanks for sharing all of your resources! In that w3schools site, I could see all of the special characters in my Firefox browser when I clicked the "Try it" buttons. But when I put them in the offline editor, Interface tab, custom cursor box, some of them would work and some wouldn't. No particular rhyme or reason that I could see (not a big deal though). I might try some of the other stuff that you mentioned when I have the time...


Log in to post a reply.

Support

Forums