Making an object a start point

jaydee
Hi all, Im quite new to coding and writing text adventures and I need a bit of advice or some kind of tutorial for my problem:

first of all I've created a room which i no longer wish to use as my starting point, how do i change the attributes to make another room the starting point?

secondly, I want to create an object within a room and make that object my start point, so for example: I'm in a box then once I'm out of the box I'm find myself in a dark room.

From inside the box i cant see any objects or light switches but once im outside i can locate the light switch and reveal the box in the room.

how would you achieve this? any help would be appreciated thank you.

XanMag
Assuming you want to keep the room in the game... Click on your player that you should find under the room that is currently your starting point. You'll find this in the left most pane in the GUI editor. Click on the player and simply drag him/her to the room you wish the player to start the game in.

Instead of making the box an object, make it a room. In the room description, just type in something like... "It is very dark in here and it smells of packing peanuts and cardboard. You can't see much but a sliver of light creeping through an thin opening just above your head. You could probably go out from here."

Then, when the player chooses to go 'out' have an exit associated with the room that the box is in. If you want it to be impossible to re-enter the box, just make it a one way exit.

I'd have a light switch in the room that when 'used' you raise a flag and call it something like 'lightson'. Then, in the starting room (with the box in it), I'd have an 'If' script. And use the flag to generate two different descriptions for the room. If object switch has flag lights on, then print message "blah blah blah... you also see a box in the middle of the room." and in the else box print a message that says something like "You can't see much here except an illuminated light switch against a dark wall."

Let me know if this helps. If you don't understand it, I'll either take screenshots of a quick game or post the code here.

Good luck.

XanMag

XanMag
Also, in the room with the box in it... if you don't want it to appear as a room, simply add an object called box to the room and remove the room box from the game.

jaydee
that's a good start, thanks. I only started using this program yesterday and I'm unfamiliar with coding so I'm still trying to pick it up as i go. if you could, some screenshots/working code would be fantastic!!

Also a brief explanation of flags and how i could assign attributes to the player object would be a huge help later in the game, i need to add scenarios where your unable to use your hands, or talk when silenced or move when immobilized etc....

XanMag
Sounds like you will have a lot of questions! That's great. I will try to post something with (codes or pics) quick at lunch today to help. If I can't get that done in my little 30 minute window, it'll have to wait until later this evening! Keep toying around with Quest though. The more you tinker the easier it gets!

I did quickly copy-paste my flag room code from my tutorial. It is below. If you copy and paste this in a new game, you should be able to see how I used simple flags here. It's not much to get you started, but it's the best I can do in the three minutes before I leave for work!

  <object name="flag setting unsetting room">
<inherit name="editor_room" />
<description><![CDATA[In this room, you will hopefully master flag setting and unsetting!<br/><br/>There are flags in the room. Look at them. To raise them, type "raise flag (of your choice)". To lower them, type "lower flag (of your choice)".<br/><br/>This room assumes you have knowledge of 'If'/'Then' statements. If you don't type "if then help".<br/><br/>Notice that when you raise a flag, I have set that particular flag on that flag object to 'raised'. If you look at the particular flag, I have used an 'If'/'Else' script to give a different viewpoint of the flag. The country's flag with a flag titled 'raised' will look as though it is standing erect. When you "lower" the flag, I unset that country's flag 'raised' so it appears in the look at description as on the ground.]]></description>
<alias>flag setting and unsetting room</alias>
<enter type="script">
</enter>
<object name="The Flag of England">
<inherit name="editor_object" />
<alt type="stringlist">
<value>english flag</value>
</alt>
<usedefaultprefix type="boolean">false</usedefaultprefix>
<look type="script">
if (GetBoolean(The Flag of England, "raised")) {
msg ("You behold the proud English flag rippling in the breeze. To lower the flag, simply type 'lower' flag.")
}
else {
msg ("The English Flag and its pole rest on the ground. To raise the flag, simply type 'raise' flag.")
}
</look>
<raise type="script"><![CDATA[
msg ("You lift the English Flag from the ground and nestle the pole it is tied to neatly into the ground. The English Flag is now raised!<br/><br/>In code, we have set flag 'object' 'The Flag of England' 'flag name' \"raised\"")
SetObjectFlagOn (The Flag of England, "raised")
]]></raise>
<lower type="script"><![CDATA[
msg ("You lift the English Flag from the earth and rest it gently on the ground.<br/><br/>In code, we have Unset flag 'object' 'The Flag of England' 'flag name' \"raised\".")
SetObjectFlagOff (The Flag of England, "raised")
]]></lower>
</object>
<object name="The Flag of the USA">
<inherit name="editor_object" />
<usedefaultprefix type="boolean">false</usedefaultprefix>
<raise type="script"><![CDATA[
msg ("You lift the American Flag from the ground and nestle the pole it is tied to neatly into the ground. The Stars and Stripes is now raised!<br/><br/>In code, we have set flag 'object' 'The Flag of the USA' 'flag name' \"raised\"")
SetObjectFlagOn (The Flag of the USA, "raised")
]]></raise>
<lower type="script"><![CDATA[
msg ("You lift the American Flag from the earth and rest it gently on the ground.<br/><br/>In code, we have Unset flag 'object' 'The Flag of the USA' 'flag name' \"raised\".")
SetObjectFlagOff (The Flag of the USA, "raised")
]]></lower>
<look type="script">
if (GetBoolean(The Flag of the USA, "raised")) {
msg ("You behold the proud American flag rippling in the breeze. To lower the flag, simply type 'lower' flag.")
}
else {
msg ("The American Flag and its pole rest on the ground. To raise the flag, simply type 'raise' flag.")
}
</look>
</object>
<object name="German Flag">
<inherit name="editor_object" />
<usedefaultprefix />
<look type="script">
if (GetBoolean(German Flag, "raised")) {
msg ("You behold the proud German flag rippling in the breeze. To lower the flag, simply type 'lower' flag.")
}
else {
msg ("The German Flag and its pole rest on the ground. To raise the flag simply type 'raise' flag.")
}
</look>
<raise type="script"><![CDATA[
msg ("You lift the German Flag from the ground and nestle the pole it is tied to neatly into the ground. The German Flag is now raised!<br/><br/>In code, we have set flag 'object' 'German Flag' 'flag name' \"raised\"")
SetObjectFlagOn (German Flag, "raised")
]]></raise>
<lower type="script"><![CDATA[
msg ("You lift the German Flag from the earth and rest it gently on the ground.<br/><br/>In code, we have Unset flag 'object' 'German Flag' 'flag name' \"raised\".")
SetObjectFlagOff (German Flag, "raised")
]]></lower>
</object>


Good luck and please ask questions if you have them!

XanMag

jaydee
Thanks for that, hopefully it will prove useful, I'm enjoying playing around and trying new things at the moment even if it is a little frustrating. You also mentioned about the player object being in the starting room, i cant seem to see the object for the player which means that Quest is automatically generating right?

XanMag
Every new game starts with a player object. This intro game in the picture is simply named player.

Just click on the player in the circle I've drawn and move it to whatever room/object you want the player to start in when you start your game. Let me know if that helps.

EDIT: And, if by some chance, you have deleted your player. Add an object to the game and name it player or whatever name you want - make sure you click on Type and choose from whatever option you want. Click on 'game' in the object room pane (far left), then click on the 'Player' tab on the right and choose the player object.

Player drag.jpg

XanMag
Here is what I would suggest for your box-room question...

Download the attached "game" and open it with Quest. Look at your game and look at my game. Use mine as a template to create what you want. Ask if you have questions! Happy gaming.


jaydee
Thanks for that, i think I've got it sorted, one other question, when leaving the box I go into a dark room, I turn on the lights and it plays the printed message but the description for the room in full light does not show, i have to leave the room and re-enter for the full description, is there any way to refresh a rooms description after you switch on the light, I'm kind of figuring i might have to have an additional script to move the player to the room after the switch has been turned on or is there an easier way?

TinFoilMkIV
you can call ShowRoomDescription () if you want to force the game to display the current rooms description.

jaydee
thanks, is there anyway to make an autoscript for it or can i just add script with message showroomdescription ?

jaydee
Slightly unorthodox but i found a little loophole to refresh a room description, I've created a new room called "Light flickers on" after flipping a switch two scripts play, Move object player to room light flickers on, then move object player to whatever room you were in... a bit long winded but it gets the same results

TinFoilMkIV
I would just add it to the script that runs when you hit the light switch. Just stick it after whatever you're normally doing with it, also don't forget the empty perentesis after it, that's part of what tells quest that its a function. When you're editing the script for the switch there should be a page looking button that says switch to code view, I'd use that to manually add it into your script as its not an option you normally have access to in the gui editor. So it will come out something like this.

//stuff that the light switch does here
ShowRoomDesicription()

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

Support

Forums