'input bar' or 'command bar' vanishes after call function loop

Isychos
06 Aug 2016, 06:35

I'm using the Quest GUI version (in browser), and am very inexperienced. I may need extensive explanation. I'm having a problem with the input bar (or command bar, I'm not sure what the official label is. Player input.) It vanishes whenever I use "call function". I've seen it in various situations, but I'm only going to ask about this specific instance. I write a function, it's 'print msg, get input, else if, else if, else'. Two possible answers to the print msg question. Which work perfectly. The "Else" script is to print msg, call function (same function) so it repeats. like "invalid answer... question again". And it seems to work, the question DOES re display, however, the input bar vanishes - so the player cannot do anything. They see the error msg, AND see the question posed again, but no prompt. I don't understand why this is happening. And I don't really know how to ask about it.
I won't understand answers with extensive lines of code, I do know how to read basic stuff - but without precise copy/paste instructions it won't help me.

Thanks anyone!


The Pixie
06 Aug 2016, 08:44

Could you copy-and-paste the code you have into a post? It is hard to know what is going on without seeing exactly what you have (click the "Code view" button above the script to see code that can be easily copied).


hegemonkhan
06 Aug 2016, 09:36

there's something off/wrong with how you set it up, which is causing something to be 'lingering' and thus it's waiting on that 'lingering' thing (issue/mistake/error/input) to finish up, so that it can then move on (allowing you to input again - looping/doing-again your function/action/event/question-input), and on top of this, it's also not waiting too, and moves on, which is what causes the error/glitch you're getting as while it moved on, and is waiting for your input, it's still waiting on whatever that 'lingering' issue/mistake is, and thus no input-command bar (I'm not sure technically what it's called either, lol. As, 'input and 'command', as broad terms, are the same term. So that's why I used 'input-command bar', lol).

I've messed up some loops myself, the easiest way (aside from having an endless/never-ending/infinite loop - but this crashes quest, which tells you that you've got an endless loop to fix up / change-to-prevent-it-from-being-endless, lol) is by having another/2nd input-getting occuring when the first input-getting still hasn't gotten its input yet (looping with getting input, either typed-in input or the menu as a popup window --- and it probably errors too with the inline-hyperlink menu too, but I've never personally tested/tried it), as unfortunately, this is an issue with quest, as it has no way of pausing scripting.


which is why we need to see your code, so we can find what's wrong due to whatever you accidentally did, and fix it up for you.

Or, you didn't do anything wrong, and you've found a bug in the quest software itself (which we can send as a 'pull request' for Alex and/or however else can do so, to look into fixing up when he/she got the time).


example of an endless loop:

<game name="blah">
  <attr name="start" type="script">
    endless_loop_function
  </attr>
</game>

<function name="endless_loop_function">
  msg ("hi")
  endless_loop_function
</function>

// hi
// hi
// hi
// hi
// ... and on and on... hi hi hi hi ....

// quest crashes (this is because: while the loop is endless/infinite, your computer/quest resources/storage/memory is not, they're finite)

// endless/infinite loops are bad!

// but good job in understanding the concept of looping (repeating an action/event/scripting/function/verb/etc. The technical term for the type of loop if I understood your post correctly is 'tail recursion' which is the generally the best type of recursion as recursion in general if done badly can eat/use up a lot of resources/storage/memory. If you're interested, google: 'recursion', or more specifically: 'recursion (computer science)') and in realizing how to loop! You (probably/maybe this is the cause of your issue/error) just need to craft it so it's just a conditionally continuing loop, not an endless/infinite loop, hehe.

and (I think) this is an example of quest not working due to having two (or more) getting-inputs at the same time:

<game name="blah">
  <attr name="start" type="script">
    multiple_getting_inputs_at_same_time_endless_loop_function
  </attr>
</game>

// using the 'get input' Script/Function:

<function name="multiple_getting_inputs_at_same_time_endless_loop_function">
  msg ("What is your name?")
  get input {
    player.alias = result
  }
  multiple_getting_inputs_at_same_time_endless_loop_function
</function>

// or, using the 'show menu' Script/Function:

<function name="multiple_getting_inputs_at_same_time_endless_loop_function">
  show menu ("Sex?", split ("male;female", ";"), false) {
    player.sex = result
  }
  multiple_getting_inputs_at_same_time_endless_loop_function
</function>


HK edit:

err technically, 'recursion' requires repeating smaller forms of itself (I was lazy and forgot this definition of it above, lol). Which you're not doing, and thus you're just doing plain/normal 'looping/iteration' (and not recursion).

a simple example, if you know higher math well: fiberaci numbers (factorials):

what's the total combinations when using numbers '1 to 10' ???

in simple terms (I'm probably getting this completely wrong... I'm bad at math, lol --- too lazy to write/code a program using recursion to get the correct answer for me):

10 x 9 x 8 x 7 x 6 x 5 x 4 x 3 x 2 x 1 = 362880

recursion/factorial: (10 or 10-0) x (10-1) x (10-2) x (10-3) x (10-4) x (10-5) x (10-6) x (10-7) x (10-8) x (10 - 9)
// we stop at '1' as this is the 'base/lowest' case (actually since we're multiplying, '2' would be the base/lowest case, as anything times 1 is itself: no change)


Isychos
06 Aug 2016, 14:25

Thanks!

I went through everything it'd possibly be waiting for, and found it was an audio file. If the "Wait for sound to finish before continuing" drop down is set to "no" it works (but of course the sound plays up to 8 seconds after the fact, annoying.) When set to "yes" it does indeed wait for the sound to finish before the call function pops the question again, but sans input bar. It's a 2 second .wav file, which is bigger than any of the other sounds I use in the game. I think it's just too much for the GUI - could be my system as well.

Think it's a "bug"? Can I manually correct the script? It seems correct - just goes from false, false to true, false. I played around with it but wasn't able to change anything without causing a system error.


Isychos
06 Aug 2016, 14:33

I checked it in a few other instances and it seems consistent that setting a sound file to wait ("yes") kills the input/command bar.


hegemonkhan
06 Aug 2016, 14:38

I'm not knowledgeable with the workings of media and/or graphical code stuff (just trying to learn the regular coding, lol), others who're more knowledgeable can help you (and they'll probably still need to see your code involved).


Isychos
06 Aug 2016, 17:22

I don't really know how to see the code. GUI is all menus. Here is what I get with the "code view" button, I edited out the 'thens' for the if and else if because those work correctly. The name of this function is "XYquestion" This is the broken version:

PrintCentered ("X or Y?")
msg ("(Choose X or Y)")
get input {
if (result = "X") {
blah
}
else if (result = "Y") {
blah
}
else {
PrintCentered ("ONLY X or Y!!")
play sound ("sound.wav", true, false)
XYquestion
}
}

That is the entire code available to me for that individual function. Setting the "Wait for sound to finish before continuing" value just changes the true to false.


The Pixie
06 Aug 2016, 21:39

I see nothing wrong with that. What happens if you remove the "play sound" line altogether? I have never used sounds, so that would be my suspicion.


hegemonkhan
07 Aug 2016, 00:02

there's a few ways to see/get-into-your (entire/full or individual parts of) game code:

entire/full game code:

  1. simply right click on your Game (or Library) File (*.aslx), and open it with a text software (notepad, wordpad, notepad++, Apple: text editor, etc).

  2. within the GUI~Editor, at the horizontal menu bar at the top of the screen, look for the 'code view' notepaper-like button between the 'play' and '?/help' buttons. This is a toggle to switch back and forth between the GUI~Editor mode and your code view mode (you do have to save when switching between these modes, to preserve any change made/done within either mode).

individual parts of your game code (such as 'whatever' Object's 'whatever' Verb/Script Attribute, or a Function/Command/Turnscript/Timer/etc):

  1. in the GUI~Editor, for its 'run as script -> add new script' are some controls/buttons, such as: [add new script] rectangle button and the smaller square buttons above it (X:delete, blue up arrow: move script/code line up a line, blue down arrow: move script/code line down a line, scissors:cut, two papers:copy, yellow thingy:???, paper:code view, paper thing with green diagonal arrow:pop up). You just click on its little square 'paper:code view' button, to see the code for just this individual Verb/Function/Command/Turnscript/etc.

see here for an example (for seeing an individual Verb's code):

http://docs.textadventures.co.uk/quest/tutorial/using_scripts.html (err: this must be an old version image... it's actually missing the individual 'tv' Object's 'watch' Verb's code view button, lol. Well, this is where you'll find it / it is the location that I've been trying to describe in words in this post, even if this image doesn't have it there, lol)

  1. look between the '[run as script] box and the 'circle ^ thingy add new script' for the small square buttons for that Verb's code display via the 'code view' small square button

  2. between the 'file-edit-add-tools-help' top menu bar and the tabs, is another menu bar and on its right side is the paper-like code view toggle button to see the entire game code.


the default new game code looks like this:

// your entire game code must be contained within this 'asl' 'creation' tag block:
<asl version="550"> // the 'version="###" must match up with the version of the 'quest.exe', your quest software/engine, that you've downloaded. You only type in the first 3 digits though into this. Even though the most recent version of quest is "560", it didn't signicantly change things enough, so you still type in "550" here, and NOT "560".

  // your included/added library files to be used in/for/with your game/game file (the order of them matters as the quest engine itself is 'built-up' upon added libraries):
  <include ref="English.aslx" />
  <include ref="Core.aslx" />

  // the special 'game' Game Object for holding global and unique game settings/attributes/info/descriptions:
  <game name="whatever">
    <attr name="gameid" type="string">some long randomly generated hash string/sequence of numbers/letters/dash symbols</attr>
    <attr name="version" type="string">1.0</attr> // this is just for your game making documentation of your upgrades/bug fixes/improvements/progress/versions/etc of your game (your game making "version history number")
    <attr name="firstpublished" type="string">2016</attr> // self explanatory, lol

    // these aren't here upon creating a new game, but these are some of the other Attributes you can fill (create/add) in:
    <attr name="author" type="string">you_the_game_maker_the_owner_of_the_game</attr>
    <attr name="subtitle" type="string">if_you_want_your_game_to_have_a_subtitle</attr>
    <attr name="description" type="string">this is the description that people see/can-read when they check out to play your game on the quest site, so they can get some idea what the game is like, about, what features it has, and etc - whatever you want to tell them about your game to get them to play it, lol</attr>
    <attr name="category" type="string">whatever you want to put here</attr> // self explanatory: RPG, Fantasy, Sci-Fi, CYOA, survival, adult, kids, teens, romance, etc etc etc (what type of game is your game, lol)
    // etc etc etc Attributes

  </game>

  // this stuff should hopefully be self-explanatory:
  <object name="room">

    <inherit name="editor_room" />
  
    <object name="player">
  
      <inherit name="editor_object" />
      <inherit name="editor_player" />
 
    </object>

  <object>

</asl>

here it is without my comments messying it up, lol:

<asl version="550">

  <include ref="English.aslx" />
  <include ref="Core.aslx" />

  <game name="whatever">

    <attr name="gameid" type="string">whatever</attr>
    <attr name="version" type="string">1.0</attr>
    <attr name="firstpublished" type="string">2016</attr>

  </game>

  <object name="room">

    <inherit name="editor_room" />

    <object name="player">

      <inherit name="editor_object" />
      <inherit name="editor_player" />

    </object>

  <object>

</asl>

quest shortens its String Attributes:

(Quest's syntaxes have changed a bit over its versions, which causes some annoyances, for me anyways lol, as it still uses some of the older syntaxes, when I like the new syntaxes, lol)

long/full (new) form:

<attr name="ATTRIBUTE_NAME" type="string">ATTRIBUTE_VALUE</attr>

to its shortened and slightly different (old) form:

<ATTRIBUTE_NAME>ATTRIBUTE_VALUE</ATTRIBUTE_NAME>

so for example:

<attr name="author" type="string">HK</attr>

is shown as (changed to) this:

<author>HK</author>

Isychos
07 Aug 2016, 01:41

@The Pixie obviously, taking away the sound all together erases the problem, I don'teven have to test it to know that 100%. The problem is inside the setting "Wait for sound to finish before continuing" When set to "yes" it makes the code after playsound "true, false". THAT makes the input bar never reappear. If that setting is set to "no" then it's "false, false" and there is no problem.

What I'm not understanding is why the setting "true, false" is killing the input bar. I can't see any reason that it should.


The Pixie
07 Aug 2016, 08:19

That sounds like a bug to me. I have reported it here:
https://github.com/textadventures/quest/issues/872

However, it woud be good if you could upload a sample game to the bug report so Alex can see an example of it not working properly; far more chance of it being fixed if you do.

Not sure if it will work in this case, but you can make the command bar appear and disappear with code:

request(Show, "Command")

You could try putting that line after the play sound.


XanMag
07 Aug 2016, 14:05

Help me understand something - perhaps I misread your posts...

You want to wait until the sound is finished playing before the player can continue, correct? If so, why does it matter if the command bar is there at all? Is it because the player can click things in the panes? If so, there is a way to disable clicks I believe. Also, why would a two second .wav file play up to eight seconds after the fact? That confuses me. And, if it is only a two second sound file, why would you need to wait for the sound to stop playing before allowing the player to continue?

If you are looping something until the player responds with something that is required for the proper continuation of the game, is it possible that the player NEVER enters a correct response? If so, you may want to remove the player from the loop entirely and force them to restart it with some sort of input. I guess it depends on your format. Just curious.

I'm not being facetious, I am just trying to figure your problem out? Sorry, if I misunderstand! =)


Isychos
08 Aug 2016, 04:43

@the Pixie - good idea! I'm gonna play with that and get back to you.

@XanMag - The sound plays after the fact because it simply takes that long to load. The game from this instance has absolutely no panes or clickable links. The reason I want the sound to play BEFORE the next print msg displays is for effect; the sound needs moments to load. Sometimes even just a few extra seconds - but we all know it only takes a player a few extra seconds to type a whole new command. If you just stubbed your toe in the game and a sound is set to play "ouch!" - then you move NW, W and a sound plays "ouch!" - doesn't make sense to the gamer now that the stubbed toe is 4 seconds behind us. Ideally, you can set progression to wait for the sound to finish, so there is no way for the player to get ahead of it.

To explain further, say I load up the game with a restart command. I play though one time, then while the browser is still open hand it to someone else in the room to "restart" and play again. THIS run will have all sounds functioning on time, because they have had a chance to preload.

I don't understand what you mean why it wouldn't matter if the player command bar reappears. The question is asked again - the player needs to try answering it because the first response was invalid. My game involves NO clicking at all, meaning no player prompt = no game. I DID try force starting it with another command, but the problem is NO INPUT BAR! Lol, how can they type a command to restart the loop if there is no where to input?

I bet we are both still confused.


Isychos
08 Aug 2016, 05:33

Ok, this might just need a new thread, but for the life of me I cannot figure out WHERE or HOW to enter code. Where can I input the request(Show, "Command")?? I've gone through every single combination of drop down menus to just get a simple 'enter code' without some preset parameters. I can't change or add any text to the 'code view' screen without it causing a system error. This is basic fundamentals; should be piece of cake to look up, but I really can't find anything helpful that doesn't pertain to the desktop version.


XanMag
08 Aug 2016, 06:10

There is a little button in the GUI that looks like a notecard - it's 2nd or 3rd from the right and is in the very top row of "buttons". You can also find a code view button at the top of each section where you can add new scripts. The top most button shows the ENTIRE game code and the individual code view buttons show the code for just that section of script.

Be warned though... If you change code behind the GUI, there is a chance that you screw things up and your game becomes unplayable/unloadable until that error gets fixed.

As far as your sound goes... Everything you said makes sense but I still have NO idea why it takes several seconds for your sound to play?! X2 has quite a bit of sound, most much more complex than a 2 second .wav file and it plays immediately. That's my biggest confusion.


Isychos
08 Aug 2016, 07:43

There is no button on the top of my screen besides the clearly labeled copy, paste etc. I've been unsuccessful trying to implement anything within the 'code view' screens. Any lines of code I've tried to enter result in a system error and the code being reset to however it was before it was opened. (and the entire webpage reloads.) I did some tests and I can fiddle with certain things inside the 'code view' screens, like editing print msgs, basically anything you WOULDN'T need to use code view for... but none of the functions I've tried are allowed - even to test or break, it says system error and it is instantly undone.

Can you show me, from the text I did paste in the earlier reply where in that view I would place a request(show, "") sort of command?

I tried to place it after the sound and then I tried putting it after the original question as a redundancy. No dice.


XanMag
08 Aug 2016, 08:16

I've scrolled back up to your original post and see that you are using the "browser" version as opposed to the downloaded desktop version of Quest... Is this correct? Perhaps the online version does not have the option to see code view? Can anyone who has messed with the online version confirm this? I've never worked with anything other than downloaded Quest version. This may explain why your sound is delayed and why I'm having trouble understanding your problem.

EDIT: I just messed with it via my phone, and it appears I'm correct. From my phone anyway, it doesn't appear you can see/alter the entire games code view (only snippets within individual scripts) using the online version. I'm guessing this IS 100% the cause of your issues. Again, someone correct me if I'm wrong.

If I interpreted correctly, you should, if possible, download Quest to your PC. It is WAY more stable and more flexible than the online version.


The Pixie
08 Aug 2016, 10:06

The code should go in a new line after the 'play sound' command, I think (assuming the code pauses at that point).

PrintCentered ("ONLY X or Y!!")
play sound ("sound.wav", true, false)
request(Show, "Command")
XYquestion

The online version does have a code view option (for individual scripts), and I have used it successfully a few times. I tried it just now in a test game, and added the line to a couple of scripts, and it added fine for me. Can you add the line to a different script and see what happens?

As XanMag says the offline editor is better if that is an option (only runs on Windows), but you rarely need the overall code view that he is talking about. The big advantage is you can set attributes on objects.


Isychos
08 Aug 2016, 16:03

I am sure the downloaded version is better, I did attempt to use it but it isn't compatible with my computer. My operating system is obsolete. (XP)

Specifically, request(show, "command") isn't allowed anywhere - I'm yet to find something that is. It seems like it isn't impossible, maybe it just doesn't like that particular phrase. I'm trying to give the player health, so if I truly cannot alter the code view I won't be able to do that either. Shucks.

I think I can add attributes to objects, but I don't really know how that's supposed to be implemented. Most likely everything I am doing can be compiled into a fraction of code, I'm sure.

I'm sure my PC is the culprit, but it's still pretty amazing what Quest can do inside the browser for me. Being able to literally work on my game no matter what computer I may chance upon is super sweet.


hegemonkhan
08 Aug 2016, 18:59

you could download an older version of quest, I can't remember now which version transitioned from XP, but you can just try each one going back:

540
530
520

and you'll get to the one that works with XP. The versions haven't change quest that much, you pretty much have all the same functionality, except for maybe a few new features.

you can see the version history here (you can also click on its article links for more info):

http://docs.textadventures.co.uk/quest/upgrade_notes.html

this is a really useful link, btw.


Alex Warren
08 Aug 2016, 20:30

I think v5.5 works with XP, it's basically exactly the same as v5.6 (the only change in v5.6 was an upgrade to the embedded version of Chrome).


Isychos
08 Aug 2016, 21:17

I did have 5.5, it pretended to work but whenever I'd try to save I'd get a window that said "Psych, sukka!!" and the whole program would close. (ok, the window had a typical error, but it felt like that.) However, if I used an even older version would it be the same for other people to play after I publish it? Meaning, could they play the game online on the site without downloading the older version themselves? Thats the only reason I keep trying to make the in browser work; I want people who don't know/care about text gaming to be able to play without going through their own hoops.

Someday I'll have a magic computer that runs on unicorn dreams, and all this will be behind us.


XanMag
08 Aug 2016, 23:32

"Meaning, could they play the game online on the site without downloading the older version themselves?"

A big plus of Quest is that all you need is an Internet connection if you play online. If you download the game rather than play online (which is pretty important for bigger games), you will need to download Quest software. Now, I'm fairly confident that you'll run into very little if any problems. A simple test would be to download the newest Quest version and play some of the older games. I've downloaded, played/tested a lot of games using the newest version and ran into zero problems playing those games and I'm sure some of those Quest games were written with much older versions. I think this makes sense, right?

So, in short, I think you will need to have people download Quest if they are going to download your game and there will not be any problems (I don't think). If they play online as most do, I'm also pretty sure there will be no problems.

Perhaps I missed the mark, but I don't think your players will experience any issues whether downloading or playing online.


Isychos
08 Aug 2016, 23:51

v5.5 did not work, so I went all the way back and dled the v5.0 I made 2 rooms with a N/S exits. when you open the game to test, anything typed results in an immediate error screen and the entire program crashing. (meaning closing and everything you made disappearing forever.) It simply will not work for me, I always assume it's because my OS is so old but... I don't see why my having XP would instantly kill older versions. I have old Adrift, even Frotz on my system which work fine. I can't see why Quest just won't happen, but really, it won't!

Should I make a new thread for this?


hegemonkhan
09 Aug 2016, 03:52

I don't think that the downloaded quest engine/software (quest.exe) can play older version games (older quest software can play those older games as those were the games for that quest software), don't know about Alex' online quest server, in whether it can play older version games or not.

maybe it's not a quest or not an XP issue, maybe you got some messed up internet/browser settings and/or messed up by a virus.


or maybe you're missing some needed internet patches/files, such as maybe the '.net' and etc internet files.


Isychos
09 Aug 2016, 04:49

It is all possible. Too bad I can't find out!

hegemonkhan, you should come to the discord chat.


Alex Warren
09 Aug 2016, 06:26

Quest is always backwards compatible, it can still play games written for v1.0.

If v5.0 is also broken for you that points to something very wrong with your system, as quite a lot changed since that version - that one embeds IE instead of Chrome. Could be a driver issue or something? It's not something I can really help with, unfortunately.


hegemonkhan
09 Aug 2016, 10:49

@ Isychos:

thanks for the welcome to the discord chat... maybe I might at some point, but school is about to start in about a week for me, and I'll be too busy for chatting and posting here, though if I have the spare time, I'll be posting here when I can, and/or try the discord chat thing.