Help! Newbie!

I'm new and in my game, I want my character to get out of bed first before she can open the curtains, so how do I make that?


Hi,
You first need to set a Boolean attribute on the player called stand, and initially set it to false. Then everything that affects with the interaction of the player gets checked against that.
I've made up the following game for you to show you how I would do it.

<!--Saved by Quest 5.7.6606.27193-->
<asl version="550">
  <include ref="English.aslx" />
  <include ref="Core.aslx" />
  <game name="Get out of bed">
    <gameid>cc1bb045-18e6-46ea-8f7d-4b838f800774</gameid>
    <version>1.0</version>
    <firstpublished>2018</firstpublished>
    <author>Doctor Agon</author>
  </game>
  <object name="room">
    <inherit name="editor_room" />
    <object name="player">
      <inherit name="editor_object" />
      <inherit name="editor_player" />
      <stand type="boolean">false</stand>
    </object>
    <object name="bed">
      <inherit name="editor_object" />
      <look>A nice, warm, double bed. It has lovely thick pillows and a feather-down quilt.</look>
      <climbout type="script">
        if (player.stand = true) {
          msg ("You are already out of bed.")
        }
        else {
          msg ("You get out of bed.")
          player.stand = true
          UnlockExit (Exit1)
        }
      </climbout>
      <climbin type="script">
        if (player.stand = False) {
          msg ("You are already in bed.")
        }
        else {
          msg ("You get into bed.")
          player.stand = false
          LockExit (Exit1)
        }
      </climbin>
    </object>
    <object name="curtains">
      <inherit name="editor_object" />
      <inherit name="openable" />
      <feature_container />
      <look><![CDATA[The curtains are a soft pink colour.<br/>The curtains are {either curtains.isopen:open|closed}.]]></look>
      <openscript type="script">
        if (GetBoolean(player, "stand")) {
          msg ("You open the curtains.")
          HelperOpenObject (curtains)
        }
        else {
          msg ("You cannot open the curtains from in the bed.")
        }
      </openscript>
      <closescript type="script">
        if (GetBoolean(player, "stand")) {
          msg ("You close the curtains.")
          HelperCloseObject (curtains)
        }
        else {
          msg ("You cannot close the curtains from in the bed.")
        }
      </closescript>
    </object>
    <exit name="Exit1" alias="east" to="room2">
      <inherit name="eastdirection" />
      <locked />
      <lockmessage>You need to get out of bed, you lazy thing.</lockmessage>
    </exit>
    <object name="pillows">
      <inherit name="editor_object" />
      <scenery />
      <look>The pillows are soft and fluffy.</look>
    </object>
    <object name="quilt">
      <inherit name="editor_object" />
      <look>The quilt is made from feather-down.</look>
    </object>
  </object>
  <object name="room2">
    <inherit name="editor_room" />
    <exit alias="west" to="room">
      <inherit name="westdirection" />
    </exit>
  </object>
  <verb>
    <property>climbout</property>
    <pattern>climb out;get out</pattern>
    <defaultexpression>"You can't climb out;get out " + object.article + "."</defaultexpression>
  </verb>
  <verb>
    <property>climbin</property>
    <pattern>climb in;get in</pattern>
    <defaultexpression>"You can't climb in;get in " + object.article + "."</defaultexpression>
  </verb>
</asl>

Hope this helps.


I'm totally lost...(sorry)...but I'm using the type of Quest game-making browser like that guy in the Quick Tutorial and I have NO idea what the above codes and programs are.

Mind if you simplify that down more?

Thanks. :D


You first need to set a Boolean attribute on the player called stand, and initially set it to false.

It might be simpler to make "in bed" a separate room; with some commends like "get up" to move to the bedroom.
Maybe include copies of the door/curtains/etc that you can look at but not otherwise interact with.


(filler for getting my edited post, updated/posted)


@ Awkwardudette:

if you downloaded and installed quest onto your computer:

  1. create a new Text Adventure game, name it, and save it (somewhere you can find it, like on the desktop)
  2. quit/close out of your game
  3. right click on your 'XXX.aslx' game file itself (on your desktop or where-ever you saved it at), and choose to open it with whatever text editor software (notepad, wordpad, Apple: text editor, etc)
  4. (what you're seeing, is your entire default game code for a new game)
  5. highlight all of it
  6. delete (all of) it
  7. highlight ALL of Doctor Agon's code (which is full/entire game code, hence why we, could and needed to, delete all of the default new game code in step 6) in his post's code box
  8. copy ALL of Doctor Agon's code (which is full/entire game code, hence why we, could and needed to, delete all of the default new game code in step 6) in his post's code box
  9. paste ALL of Doctor Agon's code (which is full/entire game code, hence why we, could and needed to, delete all of the default new game code in step 6) in his post's code box, into your (blank) 'XXX.aslx' game file
  10. save your 'XXX.aslx' game file (so you: save-over, over-ride/over-write, your 'xxx.aslx' game file)
  11. close/quit out of it
  12. now open it up in quest (double click on the file, or start quest up and open up your 'xxx.aslx' game file)
  13. you can now study it in the GUI/Editor, and/or play/test it

if you're creating your game online:

  1. you got to publish it, so you can then download it into your computer
  2. download it into your computer
  3. you may have to unzip it (if you don't already have an unzip software on your computer, let me know), if it's a 'XXX.quest' file, so you can get to the 'XXX.aslx' game file
  4. now you can follow the above section's (1-11) instructions
  5. the only difference is that you'll have to upload/publish your game file again to the site, to be able to work on it, since you don't have quest downloaded and installed on your computer or usually you're using a mobile-device (or using/have an Apple computer - not sure if quest works on apple computers and/or if KV got it working on apple computers or not --- I think he's using a linux machine/OS, but maybe he can get it to work with/on apple computers too -- I was a bit lost in his coding, it's beyond my level/knowledge/ability, so I'm not sure about what it can do, lol), hence why you're working on-line with quest

you just got your first lesson in coding, 'copy and pasting code', lol. You're now coder, as you've done coding, lol.


Hi Awkwardudette ,
Sorry, I was a bit rushed this morning and didn't have time to do a step-by-step run through of the program and what you need to do your end to achieve the same result. So here goes and if you have any further questions, let me know:

1	Click on the ‘player’ object in the game-tree on the left-hand side. 
Click on the ‘Attributes’ tab, click add on the ‘Attributes’ box (the third one at the bottom) and enter ‘stand’. Make this attribute a boolean and then set it initially to false.
The other items in the room are going to check against this attribute and enable us to open the door, and the curtains.
2	Create another room, by clicking on the ‘Add room’ icon on the top of the screen and give it a name. Let’s call it ‘room2’ for now. Also create an exit from the original room to this new location.
3	In the game-tree on the left-hand side, underneath the original room, you’ll see 
‘Exit: room2’. If you tick the check-box marked ‘Locked’, it will ask you for a name to unlock the exit later on in the game. Give this a suitable name, ‘Exit1’.
Change the message ‘Print message when locked’ to something like, 
‘You need to get out of bed, you lazy thing.’
4	Now let’s create the bed. In the original room. Create the ‘bed’ object.
Give it an appropriate look-at description; 
eg. A nice, warm, double bed. It has lovely thick pillows and a feather-down quilt.
5	On the ‘Verbs’ tab of the bed object, click the add verb button, and enter
climb out; get out
Have it run a script, and choose ‘If’ from the menu.
Now we need to choose ‘Object attribute equals’
Choose the player as the object, enter stand, where it asks for the attribute, then enter ‘True’ in the last box. This then checks if the player is already standing.
In the ‘Then’ box underneath, have it print a suitable message 
‘You are already out of bed.’
6	In the ‘Else’ box. Print message: ‘You get out of bed’
Set a variable or attribute: player.stand = True
Unlock exit: Exit1

if (player.stand = true) {
  msg ("You are already out of bed.")
}
else {
  msg ("You get out of bed.")
  player.stand = true
  UnlockExit (Exit1)
}


7	Do a similar Verb now for ‘climb in; get in’

if (player.stand = False) {
  msg ("You are already in bed.")
}
else {
  msg ("You get into bed.")
  player.stand = false
  LockExit (Exit1)
}

8	Now for the curtains.
9	Create the curtains object, and on the features tab, set it to be a container.
Set the container type to be ‘Openable/Closable’
Script to run when opening object:
Select the ‘If’ option.
Object has flag. Select the player. Flag name ‘stand’.
Print an appropriate message. ’You open the curtains.’
Open object: object ‘curtains’
In the Else box print a suitable message: ‘You cannot open the curtains from in the bed.’

if (GetBoolean(player, "stand")) {
  msg ("You open the curtains.")
  HelperOpenObject (curtains)
}
else {
  msg ("You cannot open the curtains from in the bed.")
}

Do a similar thing for the Script to run when closing object

if (GetBoolean(player, "stand")) {
  msg ("You close the curtains.")
  HelperCloseObject (curtains)
}
else {
  msg ("You cannot close the curtains from in the bed.")
}

10	Go to the curtains look at description:
Print a suitable message.
It might also be a good idea to have it state if the curtains are open or closed.

The curtains are a soft pink colour.
The curtains are {either curtains.isopen:open|closed}.

I hope you're able to follow this, and as I've said, any questions, feel free to ask.
Was trying to edit post to insert screenshots but unable to do so. Sorry.


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

Support

Forums