Axe Software Forums
  Quest Developer Forum
  I don't understand

Post New Topic  
profile | register | faq

Author Topic:   I don't understand
Shadow posted 07-02-2003 01:13 GMT   Click Here to See the Profile for Shadow   Click Here to Email Shadow  
I have been experimenting with different texts and such, trying to figure quest out (and I really really want to understand or I wouldn't be posting so much!). I am not sure but I think this code is right:

' "practice"
' Created with QDK 3.12

define game <practice>
asl-version <311>
start <room>
game info <Created with QDK 3.12>
end define

define synonyms
end define

define room <room>
alias <room>
look <There is a door.>
command <open #thing#>
if < door = #thing# > and property <door; open=1> {
then msg <You open a door.>
property <door; open=0>
}

define object <door>
alias <door>
prefix <a>
invisible
type <door>
properties <open=1>
end define

end define

define text <intro>

end define

define text <win>

end define

define text <lose>

end define


But it isn't working like I think it should. I don't get a message when I use the command open door. I simply don't understand what I am doing wrong. I have tried using #object# instead of thing, but that just doesn't work either.
Can someone please tell me what I am doing wrong?

Shadow* (I think I am stupid, how about you?)

Computer Whizz posted 07-02-2003 19:37 GMT     Click Here to See the Profile for Computer Whizz  Click Here to Email Computer Whizz     
No, you're not stupid....
Just a simple human error.

Again, I'm not 100% confident but perhaps if you try swapping "< door = #thing# >" to "< #thing# = door >" then that might work...

Try it and get back to the forums...

Computer Whizz

Shadow posted 07-02-2003 20:10 GMT     Click Here to See the Profile for Shadow  Click Here to Email Shadow     
*cries* it didn't work....*turns around and goes back to the drawing board yet again*
MaDbRiT posted 08-02-2003 02:49 GMT     Click Here to See the Profile for MaDbRiT  Click Here to Email MaDbRiT     
Hi,

Here is a very basic working example of an openable door that creates an exit when opened. In this case trying to open the door a second or third time tells you "it is already open"

quote:

' Quest 3.11 ASL

define game <demo>

asl-version <311>

game version <1.0>
game author <MaDbRiT>
game copyright <© 2003 AGB>
game info <Extra Info>

start <office>

command <open #@object#> {
if action <#object#; open> then {
doaction <#object#;open>
}
else msg <You cannot open the #object#.>
}


end define

define room <office>
look <Your office is scruffy and in dire need of a tidy up! There is _
a door in the west wall.>
prefix <your>

define object <door>
type <door>
look <a stout wooden door.>
invisible
properties <closed>
action <open> {
if property <$thisobject$; closed> then {
property <$thisobject$; not closed>
msg <It swings open.>
create exit west <office;hallway>
}
else msg <It's already open>
}
end define

end define

define room <hallway>
look <a long dilapidated hall.>
prefix <the>
east <office>
end define

define text <intro>
This demo shows a closed door, coded so that it may be opened to reveal an exit.
end define

define text <win>
Enter win text here
end define

define text <lose>
Enter lose text here
end define


This is ONE way to do it, and relatively simple, but it is not the best. Ideally you should create an openable type and have open / close actions with traps for repeated use, messages when things are opened and closed, varying descriptions etc..

All the above features are included in the 'openable' type that is part of my Q3EXT library, which might be worth looking at to see how it works even if you don't use it.

Al

p.s. a MUCH better version of my library is almost ready for release now, after having a major re-write over Xmas.

Shadow posted 08-02-2003 11:50 GMT     Click Here to See the Profile for Shadow  Click Here to Email Shadow     
*hugs Al and goes off in search of the library for further study* Thankyou so much :D
Shadow
Shadow posted 08-02-2003 00:57 GMT     Click Here to See the Profile for Shadow  Click Here to Email Shadow     
*ish so proud of herself* I have realized that if you type it out by hand instead of using the editor it works so much better. I defined the same two types one in editor and one by hand but only the one by hand worked :-s I don't know if that is a glitch or if I just did it wrong. But I can make an opening and closing door now, with a command for the whole game and an openable closeable type door :) *does a happynekkidpagandance back to the drawing board*
Shadow posted 08-02-2003 14:01 GMT     Click Here to See the Profile for Shadow  Click Here to Email Shadow     
Well, everything was just going fine and dandy until I tried to use a close command and I haven't the slightest idea what is wrong with my coding. I did everything exactly the same with my open command but once I open the door and then try to close it it tells me the door is already closed. *is going insane*. What am I doing wrong?

' Created with QDK 3.12

define game <>
asl-version <311>
start <Character Creation: The Border of Reality>
game info <Created with QDK 3.12>
command <open #@object#> if action <#object#; open> then doaction <#object#; open> else msg <You can't open #object#.>
command <close #@object#> if action <#object#; close> then doaction <#object#; close> else msg <You can't close #object#.>
end define

define type <door>
action <open> if property <$thisobject$; closed> then {
msg <You open $thisobjectname$.>
property <$thisobject$; not closed>
}
else msg <$thisobjectname$ is already open.>
action <close> if property <$thisobject$; not closed> then {
msg <You close $thisobjectname$.>
property <$thisobject$; closed>
}
else msg <$thisobject$ is already closed.>
end define

define synonyms
end define

define room <Character Creation: The Border of Reality>
alias <Border of Reality>
look <You have just stepped from reality into the world of E'tanalesia. As you step across the thin border that separates fantasy from the real world, you realize that you are no longer you but someone completely different. The room you are in is small and unfurnished yet it harbors and extremely cozy feeling. The walls glow with an unnatural light and seem to be the only light source in the room. To the north you see a plain wooden door that appears to be the only way out.>

define object <a plain wooden door>
alias <a plain wooden door>
alt <door>
prefix <a>
invisible
type <door>
properties <closed>
end define

end define

define text <intro>

end define

define text <win>


I am so close that I can taste it on the tip of my tongue. Please any suggestions?
end define

define text <lose>

end define

MaDbRiT posted 08-02-2003 18:19 GMT     Click Here to See the Profile for MaDbRiT  Click Here to Email MaDbRiT     
Hi Shadow

A simple syntax error is preventing your code working as expected. The line:

quote:

action <close> if property <$thisobject$; not closed> then {


needs to be re-written as:
quote:

action <close> if not property <$thisobject$; closed> then {

That'll cure it!

Al

Shadow posted 09-02-2003 00:23 GMT     Click Here to See the Profile for Shadow  Click Here to Email Shadow     
Al, will you marry me? (and teach me all of your coding genius?) Thankyou so much :D
The newest message board pest,
Shadow

Post New Topic  Post Reply
Hop to:


Contact Us | Axe Software

Powered by: Ultimate Bulletin Board, Freeware Version 2000a
Purchase our Licensed Version- which adds many more features!
© Infopop Corporation (formerly Madrona Park, Inc.), 1998 - 2000.