Title Screen Issues

I'm using quest 5.7.0 (5.7.1 crashes if I try to run it, apart from reinstalling it and choosing the 'Launch Quest' tickbox at the finish screen) and I need to know how to make it so that when you type something other than '4' on the title screen, you aren't just stuck forever.
The code is like this:

if (result = "4") {
  msg ("test")
}

Just give me some suggestions, please!
(picture of interface code: https://i.imgur.com/DR1E30e.png)


Put an else there.

I don't even know why this is a problem in the first place...


I know that, but should I put for the else? I tried undo, and that didn't work.


I feel like there is some extra code at work here, that you're not showing us, because this is strange!
Something like:

else {
  msg ("")
}

It's not exact, but you get the point.
I feel that using the undo command confuses it even more, since you basically told it to undo:

if (result = "4") {
  msg ("test")
}

an example (but I'm not clear on what you want/need exactly)

<game name="example_game">
  <attr name="example_integer_attribute" type="int">0</attr>
  <attr name="start" type="script">
    <![CDATA[
      msg ("Game's Example Integer Attribute: " + game.example_integer_attribute)
      if (game.example_integer_attribute < 5) {
        game.example_integer_attribute = game.example_integer_attribute + 1
        msg ("Game's Example Integer Attribute: " + game.example_integer_attribute)
        msg ("The Scripting continues (is looped) until Game's Example Integer Attribute is 5 or more")
        do (game, "start")
      } else {
        msg ("Game's Example Integer Attribute: " + game.example_integer_attribute)
        msg ("The Scripting has ended")
      }
    ]]>
  </attr>
</game>

K.V.

Hello.

That shouldn't freeze the game up. It should just 'ignore' the input from the player during that turn.

In fact, I just tested it to make double sure. With your script, if I enter "4", it prints test. If I enter something other than 4, it is ignored, then play resumes.


I am posting your image here. (Hope you don't mind.)

image

Here's how I did that, if you'd like to do it that way in the future:

![image](https://i.imgur.com/DR1E30e.png)

Now, here's some code that will print a message if the player enters something other than 4 (it's the same suggestion jmnevil54 and HK made, but it's a screenshot):

image


When you call for get input, whatever the player enters next will become result. It will not be a command. So, if the player enters something other than what you set up (4 in this example), nothing will print to the screen and nothing will 'happen' until the next command is entered.

Quest ignores it if the player doesn't enter "4" in your script because you told Quest to get input, but you only told Quest what to do with "4". You have to tell Quest what to do ELSE the result is not 4.


Example:

IF...ELSE...

You are in a room.
You can see an IF button and an IF...ELSE... button.

> look at IF button

msg ("Enter 4 to start.")
get input {
  if (result = "4") {
    msg ("test")
  }
}

> press IF button
Enter 4 to start.
test

> press IF button
Enter 4 to start.

NOTE: I entered "5" here, but nothing 'appeared' to happen. I will enter 'look' next, and it will work fine.

> look
You are in a room.
You can see an IF button and an IF...ELSE... button.

> look at IF...ELSE... button

msg ("Enter 4 to start.")
get input {
  if (result = "4") {
    msg ("You entered 4!")
  }
  else {
    msg ("You didn't enter 4.")
    msg ("You entered:")
    msg (result)
  }
}

> press IF...ELSE... button
Enter 4 to start.
You entered 4!

> press IF...ELSE... button
Enter 4 to start.
You didn't enter 4.
You entered:
5


CLICK HERE FOR THE EXAMPLE GAME'S ENTIRE CODE
<!--Saved by Quest 5.7.6404.15496-->
<asl version="550">
  <include ref="English.aslx" />
  <include ref="Core.aslx" />
  <game name="IF...ELSE...">
    <gameid>83845a50-11a1-4ff8-840f-7981a616f9d4</gameid>
    <version>1.1</version>
    <firstpublished>2017</firstpublished>
  </game>
  <object name="room">
    <inherit name="editor_room" />
    <object name="player">
      <inherit name="editor_object" />
      <inherit name="editor_player" />
    </object>
    <object name="button1">
      <inherit name="editor_object" />
      <alias>IF button</alias>
      <look><![CDATA[<pre><code>msg ("Enter 4 to start.")<br/>get input {<br/>  if (result = "4") {<br/>    msg ("test")<br/>  }<br/>}</code></pre>]]></look>
      <press type="script">
        msg ("Enter 4 to start.")
        get input {
          if (result = "4") {
            msg ("test")
          }
        }
      </press>
      <displayverbs type="stringlist">
        <value>Look at</value>
      </displayverbs>
    </object>
    <object name="button2">
      <inherit name="editor_object" />
      <alias>IF...ELSE... button</alias>
      <look><![CDATA[<pre><code>msg ("Enter 4 to start.")<br/>get input {<br/>  if (result = "4") {<br/>    msg ("You entered 4!")<br/>  }<br/>else {<br/>  msg ("You didn't enter 4.")<br/>  msg ("You entered:")<br/>  msg (result)<br/>}<br/>}</code></pre>]]></look>
      <press type="script">
        msg ("Enter 4 to start.")
        get input {
          if (result = "4") {
            msg ("You entered 4!")
          }
          else {
            msg ("You didn't enter 4.")
            msg ("You entered:")
            msg (result)
          }
        }
      </press>
      <displayverbs type="stringlist">
        <value>Look at</value>
      </displayverbs>
    </object>
  </object>
  <verb>
    <property>press</property>
    <pattern>press;push</pattern>
    <defaultexpression>"You can't press;push " + object.article + "."</defaultexpression>
  </verb>
</asl>

Play the example game online:
http://textadventures.co.uk/games/view/lfrby60ufuowbkkjnrio1w/if-else


Casino online
[url=https://www.gclub28.com/][color=#262626]gclub[/color][/url]


K.V.

What's that stuff?

...it's not quite potted meat (I don't think)...

It comes in a can...


^@somjit-1980 Major spam.


@K.V. OMG, I just got that joke! I don't even watch old TV!


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

Support

Forums