Hello - and a few newbie Qs

For help with creating games using Quest

Moderators: Pertex, Alex, sgreig, Cryophile, jaynabonne

demonboy
Posts: 34
Joined: Thu Apr 05, 2012 6:16 pm

Hello - and a few newbie Qs

Postby demonboy » Thu Apr 05, 2012 7:34 pm

First of all I just wanted to say 'hello' to Alex and everyone on this forum. I am very excited about this as I used to play text adventure games on my Vic-20 as a young teenager! Last year I tried Inform 7 but a) it was a bit buggy (I was in Linux) and b) it was a little too complicated for my ageing brain. Quest looks fantastic, I have to say, and I'm encouraged to see an active forum too.

OK, some questions. These are really simple questions and I'm sure they've been asked before but I'm only using the Wiki for my guidance and can't find a quick answer to these. Bear in mind I'm not used to scripts, I'm using the WYSIWYG editor. If I solve any questions I'll keep them in in case others are looking for the same solution.

1) Is it easy to publish from desktop to the web? How is this done? In the web version does it save your progress?
OK, I've just seen that this can't be done at the moment. Ignore this one.

2) I want an object to only be taken when the person asks for it. If they just try and take it, they get a ticking off, but if they say 'can I have X' then I want to be able to add it to their inventory. I got as far as going to the Inventory tab of the object X, Run script, Ask question/Text and then in the field I placed 'have', then print the message to confirm that they have it, then Move object to ... to where? I was looking for 'inventory'. Also I'm not convinced this is quite right as the field 'have' doesn't really seem to cover the question.

3) Turning lights on and off. How do I reveal the room only after a light has been turned on?
Think I have solved this with this setting:
Image

4) How do I reveal an exit once a light has been turned on? I have the following:

Corridor
- wall
- - switch

The switch is switched off to start with. Under options when the switch is switched on I thought I would run a script that 'Creates' an exit' or 'creates an object', but neither of these seem to work. Should the room and/or the exit exist already? Perhaps the new room should be under the switch? What's the trick?

This was just a simple script that had 'If object is switched on [object name] / Elseif object is switched off'. Couldn't be easier, I just confused myself somehow.

5) What's the best way to approach paying for something? The player is not allowed an object until they have paid their bill. They cannot pay their bill until they find their wallet. They can pick up, read and take the bill but until they pay it they don't get the object.

In order to pay the bill I have read that I need to set up a shop. I have seen that there is a shop library, which is a zip file containing Shopping.aslx and Shopping_lib.aslx. Where do I put these? I've tried putting them in the root of my new game and adding library. When I select 'add library' it says "Unable to copy file. The following error occurred. The file ../../Shopping.aslx already exists". Except it doesn't, at least not in my Library tree. Why is this happening? Is this library for Q4 and not Q5 or is it now included in Q5 by default? If so, where is it?

6) The 'Intro' guide here http://quest5.net/wiki/Introduction doesn't really make sense if you are using the WYSIWYG. So far I have done the following (assume it tells the user to press a key):

a) Set Game start script to move the player to the startroom.
b) In start room I've added the following:

Image

The problem is that it does not wait for the player to press a key. Instead it prints this out:

Image



Any help on these would be gratefully received. No doubt you'll be hearing from me again as I continue to post up seemingly-obvious questions. I presume the version I am using is new and therefore not every subject is covered by the wiki, but if there is anywhere else I can be looking for these answers, please let me know.

Thanks in advance.

Jamie
Last edited by demonboy on Sat Apr 07, 2012 3:30 pm, edited 1 time in total.

sgreig
Posts: 391
Joined: Wed Feb 15, 2012 10:16 pm
Location: Winnipeg, MB, Canada
Contact:

Re: Hello - and a few newbie Qs

Postby sgreig » Sat Apr 07, 2012 2:09 am

Hi Jamie,

I'll take a crack at answering some of your questions.

1) Is it easy to publish from desktop to the web? How is this done? In the web version does it save your progress?
OK, I've just seen that this can't be done at the moment. Ignore this one.


If you mean can you upload a game you're working on with the desktop client so you can work on it with the web editor, then no. You can ask Alex to upload the file for you, but at the moment you can't UL/DL files to/from the web editor. You can publish finished games to the web player, however.

2) I want an object to only be taken when the person asks for it. If they just try and take it, they get a ticking off, but if they say 'can I have X' then I want to be able to add it to their inventory. I got as far as going to the Inventory tab of the object X, Run script, Ask question/Text and then in the field I placed 'have', then print the message to confirm that they have it, then Move object to ... to where? I was looking for 'inventory'. Also I'm not convinced this is quite right as the field 'have' doesn't really seem to cover the question.


There's no "inventory" to move it to, per se. What you do is change the parent attribute of the object to "player". I don't want to fire up Quest to take a screenshot, but in the editor, you would choose "Set variable or attribute to" and enter object.parent = player, replacing "object" with whatever the object name is. That moves the object to the player's "inventory".

#3 seems right to me.

4) How do I reveal an exit once a light has been turned on? I have the following:

Corridor
- wall
- - switch

The switch is switched off to start with. Under options when the switch is switched on I thought I would run a script that 'Creates' an exit' or 'creates an object', but neither of these seem to work. Should the room and/or the exit exist already? Perhaps the new room should be under the switch? What's the trick?


Off the top of my head, I'm not sure of a simple way to do this. I'm not sure if Quest has an ability to conditionally "hide" or "reveal" exits, so I suppose you could do it by creating/deleting the exits in the script. I would think there has to be a more elegant solution. Perhaps Alex or Pertex can weigh in on this one?

For #5, I don't know anything about the shop template, but I would imagine it's probably designed for something a little more complex than what you're describing here. The way I would go about this would be to create a custom "pay" command, and in the script, I would first check to see if the player had a wallet with an if statement, and if not it would generate an appropriate response. If the player did have the wallet, then I would set a flag like "item_to_be_paid_for.paid = true". Then, in the script of the object under the inventory tab, I would have a small script that would only allow the object to be taken if that flag was present.

As for #6, where are you putting the script? The wait for key press function is a little persnickety. If you search this forum you should be able to find information on how to get it working properly.

If anyone else wants to give their 2 cents or correct something I've said, please feel free. :-)

MerchantToo
Posts: 19
Joined: Mon Feb 06, 2012 8:48 am
Location: Nederland

Re: Hello - and a few newbie Qs

Postby MerchantToo » Sat Apr 07, 2012 8:30 am

As for the error you get with shopping, that aslx file should be somewhere else than the root directory of your game. When you try to add a library, Quest makes a copy of it exactly in the place you have put it, and seeing that there's aleady something there with the same name it errors. So make a library directory, and put any libraries you want in there. Then you can add a specific library to a game without the problem you've got now. :D

demonboy
Posts: 34
Joined: Thu Apr 05, 2012 6:16 pm

Re: Hello - and a few newbie Qs

Postby demonboy » Sat Apr 07, 2012 9:00 am

Thank you both for your replies, in particular to sgreig for your really comprehensive answer. I appreciate it.

I'll take a look at your suggested ideas later. My Quest project is an 'after-hours' project, one to be cracking on with after I've done my daily chores. This time I intend to see it through though. I got quite far with the (same) story on Inform 7 but things happened and it got binned.

I'll be back :wink:

User avatar
Alex
Site Admin
Posts: 2109
Joined: Fri Jun 27, 2003 11:06 pm
Location: London, UK
Contact:

Re: Hello - and a few newbie Qs

Postby Alex » Sat Apr 07, 2012 5:16 pm

When you use a "wait" script, only the script inside the wait is run after the user has pressed a key. If you use this inside a game start script, there is more script that runs afterwards which moves the player to the start room. This is, of course, not inside your "wait" script, so it runs immediately.

I've made this a bit easier in Quest 5.2. Now, the player is only moved to the start room when there are no outstanding "wait" scripts, so this whole area works a bit more as you might expect.

demonboy
Posts: 34
Joined: Thu Apr 05, 2012 6:16 pm

Re: Hello - and a few newbie Qs

Postby demonboy » Sat Apr 07, 2012 5:27 pm

Thanks, Alex.

What I did, and I'm not sure if this is a bit unorthodox, is open the intro.aslx and mygame.aslx in Dreamweaver and copy over the relevant bit from intro.aslx into my game. I was struggling with importing the Intro.aslx into my library (it was saying it was already there when it wasn't...long story but I can explain in more detail if you require), so the copying solution worked for me.

And actually, perhaps the copying thing wasn't such a good idea as I've noticed that the engine is giving the full description of the room, even though I have unticked the option 'Show room description when entering the room' Any idea why it is doing this, or perhaps the bit of script I failed to copy over to my game?

[Edit] It seems I have all the answers now except the one about the shop, which I'll worry about later, and the asking of the object before adding it to the inventory. I'm still none the wiser on this so any help would be appreciated. I'm not sure the suggested answer sgreig gave is correct because what you are suggesting is moving the object to the player's inventory, away from the desk on which it sits. Surely it has to sit on the desk, the desk is the parent to the object. If I move the item to the inventory (physically moving the object using the tree in the left) then it has no association with the desk and now it is immediately in the inventory.

Am I missing a trick here? Do all possible items that could exist in the inventory, go under Player in the tree?
Last edited by demonboy on Sat Apr 07, 2012 5:48 pm, edited 1 time in total.

sgreig
Posts: 391
Joined: Wed Feb 15, 2012 10:16 pm
Location: Winnipeg, MB, Canada
Contact:

Re: Hello - and a few newbie Qs

Postby sgreig » Sat Apr 07, 2012 6:53 pm

I think I might have caused some more confusion, so let me try to explain myself a bit better. I'm assuming this "transcript" is similar to the behavior you're trying to create:

You are in a store.
You can see an object and a shopkeeper here.
You can go east.

> take object
The shopkeeper replied, "Hey! You haven't paid for that yet!"
> pay for object
You don't seem to have your wallet.
> east

You are in the east room.
You can see a wallet here.
You can go west.

> take wallet
Taken.
> west

You are in a shop.

> pay for object
The shopkeeper processes your payment and thanks you.
> take object
Taken.


If that's along the lines of what you're trying to do, this isn't really too difficult, it's just wrapping your head around how to solve the problem that provides the challenge, as with most programming languages.

So, what you want first is a script on the object that checks to see if the object has been paid for or not, and if not, won't allow the object to be taken. For this example, the script will look for a flag on the object called "paid". If that flag exists, the script knows the object has been paid for. (We'll set this flag a little later in the example.) (Bear in mind, my screenshots are taken from the web editor version of Quest, but it's almost identical to the downloaded client so you shouldn't have any trouble.)

What you want to do is create the object, and in the inventory tab, change default behavior to "run script" and use the script I have here, obviously using the object in your game instead of my sample one here.

Quest - Test-133136.png
Quest - Test-133136.png (40.85 KiB) Viewed 736 times


Now with part out of the way, we need a custom pay command. It will look like this:

Quest - Test-134531.png
Quest - Test-134531.png (36.07 KiB) Viewed 736 times


And that's all there is to it. I'll attach the game file to this post so you can try it yourself. You should be able to figure out how to adapt this to your game, but if you have more problems we'll obviously try to help out. :)

buyingobject-sample.aslx
(1.68 KiB) Downloaded 22 times

demonboy
Posts: 34
Joined: Thu Apr 05, 2012 6:16 pm

Re: Hello - and a few newbie Qs

Postby demonboy » Sat Apr 07, 2012 7:33 pm

That must have taken you a little time to reply so thank you so much for that, sgreig. This now answers my question about the shopping issue, which is great. I could complicate things further by asking how you buy different items at different prices and subtract those costs from the kitty, but I think I'm trying to run before I can walk!

Regarding Q2 in my OP, however, that was slightly different to buying something. In Q2 what I was trying to get across was how you can acquire an object by asking for it instead of just taking it. What I was trying to work out was how I tell Quest that a player is asking for an object and therefore is given it. How does Quest know that? I'm trying to get the player to type in 'Can I have that book' and for Quest to understand that because the words 'can', 'have' and 'book' were typed it, it must be a question about wanting the book, and therefore to give it to him and add it to his inventory.

To be honest, though, I have other questions about Quest that are more important than this issue. Please don't spend any more time trying to answer that problem as your one about shopping is enough to get me going. Thanks, sgreig.

demonboy
Posts: 34
Joined: Thu Apr 05, 2012 6:16 pm

Re: Hello - and a few newbie Qs

Postby demonboy » Sat Apr 07, 2012 8:03 pm

OK, almost there. I have an object called a 'bill'. It is set up thus:

Image

Under that, I have a command, set up thus:

Image

How do I then let Quest know to accept the player typing 'pay bill'? It is coming back saying 'I don't understand your command'. Do I have to set a verb under 'bill' and then run a script on that verb?

Also, how do I differentiate between 'pay the bill', 'pay bill', pay for the bill' etc?

sgreig
Posts: 391
Joined: Wed Feb 15, 2012 10:16 pm
Location: Winnipeg, MB, Canada
Contact:

Re: Hello - and a few newbie Qs

Postby sgreig » Sat Apr 07, 2012 8:44 pm

Ah, that's my fault. Sorry.

When you create custom commands, the part stored between the #'s has to be specified as either a string or an object. In your case, you would use "pay for #object_bill#", or you could simply just leave it as "pay for #object#". Then at which point you would either check for object_bill.paid or object.paid, depending which one you used. This screwed me up in my game as well until Alex explained it to me. :)

As for making the player have to ask for an object, the principle is exactly the same. I would create an "ask" command that sets a flag on the object to true when it's used, then in the take script for the object, just check for that flag to determine if the object can be taken or not.

demonboy
Posts: 34
Joined: Thu Apr 05, 2012 6:16 pm

Re: Hello - and a few newbie Qs

Postby demonboy » Sun Apr 08, 2012 3:37 am

Good morning sgrieg, I'm in India so I'm guessing I'm a fair few hours ahead of you, hence my delayed response. I figured if I posted now I might jut catch you before you go to bed!

So are you saying I set a Verb (under the object 'bill') to 'pay', with a script that says:
If: expression 'pay for #bill#'
Then:


What's the missing bit in the Then part of the script? How do I say Then 'bill.paid = true' or something?

sgreig
Posts: 391
Joined: Wed Feb 15, 2012 10:16 pm
Location: Winnipeg, MB, Canada
Contact:

Re: Hello - and a few newbie Qs

Postby sgreig » Sun Apr 08, 2012 4:46 am

What I mean is that in command pattern, you have to have it set to either "pay for #object_bill#" or "pay for #object#". If you set it to "pay for #bill#" it won't work because Quest won't be able to tell if #bill# is an object or a string.

demonboy
Posts: 34
Joined: Thu Apr 05, 2012 6:16 pm

Re: Hello - and a few newbie Qs

Postby demonboy » Sun Apr 08, 2012 5:27 am

Just remembered you included the aslx file for me to check. Will examine this first, thanks!

demonboy
Posts: 34
Joined: Thu Apr 05, 2012 6:16 pm

Re: Hello - and a few newbie Qs

Postby demonboy » Sun Apr 08, 2012 10:50 am

Success! I have managed to 'pay for bill'! Thank you, sgreig! Wonderful stuff. Also I came across the way of adding different variations, i.e. adding the semi-colon, so I'm pretty made up now.

Thank you so much for your patience, it's really appreciated.

sgreig
Posts: 391
Joined: Wed Feb 15, 2012 10:16 pm
Location: Winnipeg, MB, Canada
Contact:

Re: Hello - and a few newbie Qs

Postby sgreig » Sun Apr 08, 2012 8:33 pm

Glad I could help. :)


Return to “Quest Forum”

Who is online

Users browsing this forum: Baidu [Spider] and 3 guests