Too Many Rooms

steve the gaming guy
18 Nov 2004, 17:13
I started working on the next part of the game while I was waiting for a reply on my other question on here. Unfortunately, I've bumped into a massive issue.
In the original game of King's Quest V, you walk through a large desert. After you walk four screens of nothing but sand, a message prompts you that you are becoming dehydrated. If you go two more screens and do not find an oasis, you die. There are a few objects needed in the desert to complete the game.
I have created a grid in Excel showing the entire desert and the entire length you can walk without dying based on where the oases are placed. It comes to a whopping 115 rooms. There must be a more simple way to create this grid. I was thinking that maybe I could have the player keep arriving in the same room if they go in one direction but the problem then lies with how do I make them die of dehydration after a total of 6 moves in the desert AND how do I place the oases?
Does this make sense? It's difficult to explain without showing the Excel grid.

Below is a very crude example of the grid which could potentially be roughly 115 rooms. (Note, above the top row will be impassable mountain cliffs.)

X = empty desert
O = oasis
E = is the beginning of the desert
D = death rooms (killed by scorpions if entered)
I = item
oi = oasis and an item in the same room


X X X X X X oiX X X X X X E
X X X X X X X X X X X X X E
X X X X X X X X X X O X X X E
X X X X X X O X X I X X X X X D
X X X X X X X X X X X X X X X D
X X X X X X X X X X X X X X X D
X X X X X X oiX X X X X X X X
X X X X X X X X X X X X X
X X X X X X X X X X
X X X X X X X
X X X X X
X X X
X



:!: :?: :!: :?:

Alex
18 Nov 2004, 18:59
I would have the directions set as scripts. They would increment or decrement a co-ordinate and/or "distance travelled" variable, act accordingly and then put the player back in the same room.

davidw
18 Nov 2004, 19:28
I'd probably avoid having 115 locations in a desert. You're not talking about exciting gameplay here if a player has to slog his way through 115 pretty near identical locations.

steve the gaming guy
18 Nov 2004, 19:35
Alex wrote:I would have the directions set as scripts. They would increment or decrement a co-ordinate and/or "distance travelled" variable, act accordingly and then put the player back in the same room.


Alex,
Thank you for the input. I'm not entirely sure how to set a co-ordinate though. I'll try to work with it.

I'd probably avoid having 115 locations in a desert. You're not talking about exciting gameplay here if a player has to slog his way through 115 pretty near identical locations.



davidw,
I agree. However, the description of the identical rooms are minimal. It would be something like "desert - all you can see is sand dunes in all directions". Therefore, you can click through them quite quickly until you notice the description for the room changing.
Further, if you map out the location of the objects as you find them, there's only about 30 of these rooms that you'd actually have to pass through. At least you don't have to click and wait for an animated character to walk the length of the computer screen before appearing to the next one.
I believe it will be much easier to map through on text than it was when I mapped out the original one years ago.

The burden of this part of the game is on me trying to design it, not the player when it is finished. Since I am trying to make this game very closely related to the original, maps are available at many sources online so it should work out quite nicely.

:roll:

paul_one
18 Nov 2004, 19:54
Yeah - what Alex said.

I'd have 1 room as a "sand"-room, and keep going back to that room.
Make "game" properties of x and y (and the distance of course), and then check these against a "map".

OK - I know this doesn't sound helpful... But let's try it this way:

When you go north, you increase the y value and check the x&y values to see if you have got to an oasis or an exit to the desert (also increasing the distance)... If not, you go back to the "desert" room. They go north again - the y value is moved up again and you check again. You move east, you increase x. You move south you decrease y, west decrease x...

To check the x and y values, I'd say have an array of "oasis[]" string variables... example below:
set string <oasis[0]; 2,5>
set string <oasis[1]; 3,2>
set string <oasis[2]; 3, 5>

Now that way you check through each value with a:
for <i=0;i=$ubound(oasis)$> {
set string <checking; #game:x#,#game:y#>
if (#checking#; #oasis[i]#) then {
#move player to oasis room...#
} else {
#move player to desert room#
}

That might be a bit rough, and I'm not sure it's going to work as I typed it. But that might give you an idea of what we're talking about.

steve the gaming guy
18 Nov 2004, 20:27
Computer Whizz,

I was sort of following you with the 'set string <oasis[0]; 2,5>' and so on ...

But I think my brain exploded when I saw:

for <i=0;i=$ubound(oasis)$> { 
set string <checking; #game:x#,#game:y#>
if (#checking#; #oasis[i]#) then {
#move player to oasis room...#
} else {
#move player to desert room#
}


Where in QDK would I enter such commands? And as far as setting the string for the 3 oases as you showed in your example, are those extra rooms? I'm sorry but I don't have a lot of experience with strings so I'm basically just copying and pasting the examples into QDK and seeing what happens. In this particular code, I'm not sure where I'd be pasting it.

:cry:

paul_one
18 Nov 2004, 21:46
Well, that code would go into the direction script (when they typed go north or whatever). You'd need to add bits to it though, and I'm not sure it'd be 100% correct.

Now if the oasis' are different (say one has two palm tree's, and then another has a doorway to another world) then you'd have another variable array named something like "oasis_rooms[0]" with the name of the rooms in... Then move them to that room using the goto<> script command.

You can have 2 rooms if you want, for 30 oasis' (2 different rooms entirely, one with an exit to another world, another with only a sand beach, palm tree's and water)... Just have the array like so:
oasis[0] = room3
oasis[1] = room3
oasis[2] = room3
oasis[3] = room4
oasis[4] = room3
oasis[5] = room3

See what I mean?

Erm, I don't really feel up to giving out a more-full explaination or typing out a quick demo (as I already am typing another one, and reading stuff, and doing PC maintanance) so I may have to get back to you tomorrow...
Have a little think about it... Try to make some guesses, - maybe look at what I've typed, and instead of cut and pasting - perhaps selecting the commands in QDK and then typing in the appropriate stuff.

ac19189
19 Nov 2004, 01:21
After ten rooms I would have to say no more cant take it I like my hair in my hear thank you :P thats to many rooms for my little mind to add 8)

steve the gaming guy
19 Nov 2004, 03:34
Computer Whizz wrote:
You can have 2 rooms if you want, for 30 oasis' (2 different rooms entirely, one with an exit to another world, another with only a sand beach, palm tree's and water)... Just have the array like so:
oasis[0] = room3
oasis[1] = room3
oasis[2] = room3
oasis[3] = room4
oasis[4] = room3
oasis[5] = room3

See what I mean?


I see what you mean. Luckily, there's only about 5 significant rooms in this vast desert so I believe there is only about 3 or 4 rooms that contain an oasis [to drink from to save from dying of thirst, not as a portal to another world :) ]

I will work with your ideas.

so I may have to get back to you tomorrow...
Have a little think about it... Try to make some guesses, - maybe look at what I've typed, and instead of cut and pasting - perhaps selecting the commands in QDK and then typing in the appropriate stuff.



Great, I can't wait. As I said, I will work with your ideas. However, in reference to the cutting and pasting, I was referring to that bizarre code that contained the i=0 and what not. I did find the $ubound()$ function but I don't know what it means. So as you suggest to select commands in QDK and typing the appropriate stuff. I don't know what to type to create anything that looks like what you devised. (i=0...#game:x#, #game:y#...etc...)

Anyway, I will work with it. Time to get into the nitty gritty of these commands.

:arrow: ac19189, as I mentioned earlier in this line of posting, it's not necessary to go to all the rooms. Those are only there for a complete realistic design. For those who wish to map out the entire desert just to see what's out there, that's part of the fun of certain games. Otherwise, read the walkthrough of the game online to get through it in no time.

Ending note, (I'm long-winded as always) after I finally figure out how to get it to work properly based on my learnings from Alex and Computer Whizz, if I still feel that the desert sequence will be too dull and pointless, I will alter the game to adjust the fun level of it and hack out the monotony.

bye,

steve the gaming guy
19 Nov 2004, 04:59
Ok...two responses in a row. I decided to try something out. Took me a while to throw it together but here is a small example of what I'm looking for. I haven't overcome the "using the same room" deal but I did work out a basic idea for getting thirsty and then getting some water for the journey back out of the desert.

' "desert land"
' Created with QDK 3.52 - UNREGISTERED VERSION

define game <desert land>
asl-version <350>
gametype singleplayer
start <start>
game author <steve>
game info <Created with QDK 3.52 - UNREGISTERED EVALUATION VERSION.>
define variable <thirst>
type numeric
value <0>
onchange {
if ( %thirst% = 4 ) then msg <You are thirsty. You better find an oasis soon.>
if ( %thirst% = 6 ) then {
msg <You crumble under deep dehydration and wither to a dried plum.>
wait <press any key>
playerlose
clear
}
}
end define
end define

define synonyms
end define

define room <start>
west <desert>
end define

define room <desert>
east <start>
west {
inc <thirst; 1>
goto <desert1>
}
end define

define room <desert1>
south {
inc <thirst; 1>
goto <desert6>
}
east {
inc <thirst; 1>
goto <desert>
}
west {
inc <thirst; 1>
goto <desert2>
}
end define

define room <desert2>
south {
inc <thirst; 1>
goto <desert7>
}
east {
inc <thirst; 1>
goto <desert1>
}
west {
inc <thirst; 1>
goto <desert3>
}
end define

define room <desert3>
south {
inc <thirst; 1>
goto <desert8>
}
east {
inc <thirst; 1>
goto <desert2>
}
west {
inc <thirst; 1>
goto <desert4>
}
end define

define room <desert4>
south {
inc <thirst; 1>
goto <desert9>
}
east {
inc <thirst; 1>
goto <desert3>
}
west {
inc <thirst; 1>
goto <desert5>
}
end define

define room <desert5>
south {
inc <thirst; 1>
goto <desert10>
}
east {
inc <thirst; 1>
goto <desert4>
}
west <oasis>
end define

define room <desert6>
north {
inc <thirst; 1>
goto <desert1>
}
west {
inc <thirst; 1>
goto <desert7>
}
end define

define room <desert7>
north {
inc <thirst; 1>
goto <desert2>
}
east {
inc <thirst; 1>
goto <desert6>
}
west {
inc <thirst; 1>
goto <desert8>
}
end define

define room <desert8>
north {
inc <thirst; 1>
goto <desert3>
}
east {
inc <thirst; 1>
goto <desert7>
}
west {
inc <thirst; 1>
goto <desert9>
}
end define

define room <desert9>
north {
inc <thirst; 1>
goto <desert4>
}
east {
inc <thirst; 1>
goto <desert8>
}
west {
inc <thirst; 1>
goto <desert10>
}
end define

define room <desert10>
north <desert5>
east <desert9>
end define

define room <oasis>
prefix <the>
look <You've reached the oasis. What a pleasant treat to find among the desert sands.>
east <desert5>
command <drink> {
msg <You reach down and have a refreshing sip of water.>
set numeric <thirst; 0>
}
command <drink water> {
msg <You reach down and have a refreshing sip of water.>
set numeric <thirst; 0>
}

define object <oasis water>
alias <oasis>
look <Beautiful water. Nectar of the gods.>
take {
msg <You reach down and have a refreshing sip of water.>
set numeric <thirst; 0>
}
prefix <the>
article <it>
gender <it>
end define

end define

define text <intro>

end define

define text <win>

end define

define text <lose>

end define

007bond
19 Nov 2004, 05:36
this is what i was talking about in my list of Quest's needs. The ability to set the room type to small, indoor rooms, or big, outdoor areas like parks, or in this case a desert. Why is it that everyone opposes these sorts of ideas of mine, until someone else has the same idea/problem?

steve the gaming guy
19 Nov 2004, 15:59
007bond wrote:this is what i was talking about in my list of Quest's needs. The ability to set the room type to small, indoor rooms, or big, outdoor areas like parks, or in this case a desert. Why is it that everyone opposes these sorts of ideas of mine, until someone else has the same idea/problem?


I can only assume you are referring to the following bit from your lengthy Quest's needs post:

4. Different room types: Hallways, Halls (Large Rooms), Standard Rooms (Loungeroom), Stairwells (Large ones (in buildings), and Small Ones (In Backyards), Back and Front Yards, Caves, Forests, Parks, and Misc. Outside areas.



Am I right? Based on what is typed in this line, I personally did not pick up on that you meant anything related to what I am currently posting about (ie. the vast desert).

I mean no offense but maybe in the future, if you need a specific problem answered, have your post referring to that one problem. At least for now, hopefully what has been posted so far concerning my desert scenario has helped you or given you ideas.

By the way, the demo of the desert that I posted above works well so feel free to copy and paste it into Wordpad and save as an ASL file to try it out. It is super short but it demonstrates how you can walk into the desert and become thirsty and if you don't find the oasis soon thereafter, you die of dehydration.

ac19189
19 Nov 2004, 16:07
Ok I see what your saying now. You are going to have so much fun adding all the room I can see that now :P its really unlike anything I have seen on quest before so should be fun to look at. :wink:

paul_one
19 Nov 2004, 17:14
Steve - I meant something like this:
' "desert land"
' Created with QDK 3.52 - UNREGISTERED VERSION

define game <desert land>
asl-version <350>
gametype singleplayer
start <start>
game author <steve>
game info <Created with QDK 3.52 - UNREGISTERED EVALUATION VERSION.>
define variable <thirst>
type numeric
value <0>
onchange {
if ( %thirst% = 4 ) then msg <You are thirsty. You better find an oasis soon.>
if ( %thirst% = 6 ) then {
msg <You crumble under deep dehydration and wither to a dried plum.>
wait <press any key>
playerlose
clear
}
}
end define

startscript {
set string <oasis[0]; 0,6>
set string <oasis[1]; 2,3>

set string <oasis_room[0]; oasis1>
set string <oasis_room[1]; oasis2>
}

properties <desert_x=0; desert_y=0>

end define

define synonyms
end define

define room <start>
west <desert>
end define

define room <desert>
east <start>
west {
inc <thirst; 1>
inc <#game:desert_x#>
goto <$desertroom$>
}
end define

define room <oasis1>
prefix <the>
alias <oasis>
look <You've reached the oasis. What a pleasant treat to find among the desert sands.>
east <desert>
command <drink> {
msg <You reach down and have a refreshing sip of water.>
set numeric <thirst; 0>
}
command <drink water> {
msg <You reach down and have a refreshing sip of water.>
set numeric <thirst; 0>
}

define object <oasis water>
alias <oasis>
look <Beautiful water. Nectar of the gods.>
take {
msg <You reach down and have a refreshing sip of water.>
set numeric <thirst; 0>
}
prefix <the>
article <it>
gender <it>
end define

end define

define room <oasis2>
prefix <the>
alias <oasis>
look <You've reached the oasis. What a pleasant treat to find among the desert sands.>
east <desert>
command <drink> {
msg <You reach down and have a refreshing sip of water.>
set numeric <thirst; 0>
}
command <drink water> {
msg <You reach down and have a refreshing sip of water.>
set numeric <thirst; 0>
}

define object <oasis water2>
alias <oasis>
look <Beautiful water. Nectar of the gods.>
take {
msg <You reach down and have a refreshing sip of water.>
set numeric <thirst; 0>
}
prefix <the>
article <it>
gender <it>
end define

end define

define function <desertroom>
for <i; 0; $ubound(oasis)$> {
set string <dest; #game:desert_x#,#game:desert_y#>
if (#dest# = #oasis[i]#) then set string <returning; #oasis[i]#>
else {
if ( #game:desert_x# < 0 ) or (#game:desert_y# < 0 ) then set string <returning; start>
else {
set string <returning; desert>
}
}
}
return <#returning#>

end define

define text <intro>

end define

define text <win>

end define

define text <lose>

end define

But for some reason, this gives me a run-time error, telling me "invalid key"... There might be an error in there somewhere, as I can't really check out what's going on when Quest crashes like that.

steve the gaming guy
19 Nov 2004, 17:26
I see.

Run-Time error '35603':

Invalid Key.


I'm sure Alex knows what it means!

paul_one
19 Nov 2004, 18:04
Heh... It has something to do with my calling the $desertroom$ function. Maybe a "set string <room; $desertroom$>" and then "goto <#room#>" might work... I'll try that.

steve the gaming guy
19 Nov 2004, 21:06
It may or may not have something to do with it. The bit of string below is the only part that I cannot find when I load it up in QDK. I found the $desertroom$ function though.

set string <dest; #game:desert_x#,#game:desert_y#>
if ( #dest# = #oasis[i]# ) then set string <returning; #oasis[i]#> else {
if ( #game:desert_x# < 0 ) or ( #game:desert_y# < 0 ) then set string <returning; start> else set string <returning; desert>
}
}
return <#returning#>

paul_one
19 Nov 2004, 21:53
EDIT::

Right, this is code which works. Here you go:

' "desert land"
' Created with QDK 3.52 - UNREGISTERED VERSION

define game <desert land>
asl-version <350>
gametype singleplayer
start <start>
game author <steve>
game info <Created with QDK 3.52 - UNREGISTERED EVALUATION VERSION.>
define variable <thirst>
type numeric
value <0>
onchange {
if ( %thirst% = 4 ) then msg <You are thirsty. You better find an oasis soon.>
if ( %thirst% = 7 ) then {
msg <You crumble under deep dehydration and wither to a dried plum.>
wait <press any key>
playerlose
clear
}
}
end define

startscript {
set string <oasis[1]; 6,0>
set string <oasis[2]; 2,3>

set string <oasis_room[1]; oasis1>
set string <oasis_room[2]; oasis2>
}

properties <desert_x=0; desert_y=0>

end define

define synonyms
end define

define room <start>
west <desert>
end define

define room <desert>
east <start>
west {
inc <thirst; 1>
set numeric <tempy; #game:desert_x# + 1>
property <game; desert_x = %tempy%>
set string <room; $desertroom$>
goto <#room#>
}
end define

define room <oasis1>
prefix <the>
alias <oasis>
look <You've reached the oasis. What a pleasant treat to find among the desert sands.>
east <desert>
command <drink> {
msg <You reach down and have a refreshing sip of water.>
set numeric <thirst; 0>
}
command <drink water> {
msg <You reach down and have a refreshing sip of water.>
set numeric <thirst; 0>
}

define object <oasis water>
alias <oasis>
look <Beautiful water. Nectar of the gods.>
take {
msg <You reach down and have a refreshing sip of water.>
set numeric <thirst; 0>
}
prefix <the>
article <it>
gender <it>
end define

end define

define room <oasis2>
prefix <the>
alias <oasis>
look <You've reached the oasis. What a pleasant treat to find among the desert sands.>
east <desert>
command <drink> {
msg <You reach down and have a refreshing sip of water.>
set numeric <thirst; 0>
}
command <drink water> {
msg <You reach down and have a refreshing sip of water.>
set numeric <thirst; 0>
}

define object <oasis water2>
alias <oasis>
look <Beautiful water. Nectar of the gods.>
take {
msg <You reach down and have a refreshing sip of water.>
set numeric <thirst; 0>
}
prefix <the>
article <it>
gender <it>
end define

end define

define function <desertroom>
set string <returning; 1>
set numeric <upper; $ubound(oasis)$>
for <i; 1; %upper%> {
set string <dest; #game:desert_x#,#game:desert_y#>
msg <#oasis[i]#==#dest#==>
if ( #dest# = #oasis[i]# ) then {
set string <returning; #oasis_room[i]#>
msg <this should work>
}
else {
if ( #returning# = 1) then {
if ( #game:desert_x# < 0 ) or (#game:desert_y# < 0 ) then set string <returning; start>
else {
set string <returning; desert>
}
}
}
}
return <#returning#>

end define

define text <intro>

end define

define text <win>

end define

define text <lose>

end define


I realised that the for wasn't going through all the variables, so I changed that bit. Then I also realised that if it DID go through all the array then the ending result will 99% of the time be desert. So I changed that by checking "if ( #returning# = 1 )".
So hope you have fun. Get rid of the "msg<#dest#==#oasis[i]#>" to get rid of those lines after every room movement.

Change it so your desert map grid is similar to this:
10,0 9,0 8,0 7,0 6,0 5,0 4,0 3,0 2,0 1,0
10,1 9,1 8,1 7,1 6,1 5,1 4,1 3,1 2,1 1,1
10,2 9,2 8,2 7,2 6,2 5,2 4,2 3,2 2,2 1,2
etc...

So moveing west or south increases x or y, and moving north or east decreases it.

Also - moving off the desert isn't really dealt with. So if you're at the side and move sideways even more you will automatically go back to start - no matter where you are. Same for moving too far north.

steve the gaming guy
20 Nov 2004, 18:12
Computer Whizz,

Very nicely done. Thanks! As the code is written currently, it demonstrates the repeating room until you either die or you find the oasis. It allowed you only to move west and east.
Since all of the code does not appear in QDK for some reason, I took it upon myself to try and figure out how to tweak what you have created.

Below are two sets of codes for the $desertroom$ function. One works, one doesn't.
The first one is where I kept the #game:desert_x < 0# but I changed the 'y' one to show "game:desert_y > 0# in order to allow travel south. (also copying & tweaking the script that was in the command for traveling west as you had created originally).
The second code shows my further tweaking to try and allow passage north which didn't work. But I thought I'd show you what I came up with. And thanks again for your help!

define function <desertroom>
set string <returning; 1>
set numeric <upper; $ubound(oasis)$>
for <i; 1; %upper%> {
set string <dest; #game:desert_x#,#game:desert_y#>
if ( #dest# = #oasis[i]# ) then {
set string <returning; #oasis_room[i]#>
msg <this should work>
}
else {
if ( #returning# = 1 ) then {
if ( #game:desert_x# < 0 ) or ( #game:desert_y# > 0 ) then set string <returning; start> else set string <returning; desert>
}
}
}
return <#returning#>

end define


define function <desertroom>
set string <returning; 1>
set numeric <upper; $ubound(oasis)$>
for <i; 1; %upper%> {
set string <dest; #game:desert_x#,#game:desert_y#>
if ( #dest# = #oasis[i]# ) then {
set string <returning; #oasis_room[i]#>
msg <this should work>
}
else {
if ( #returning# = 1 ) then {
if ( #game:desert_x# = 0 ) and ( #game:desert_y# = 0 ) then set string <returning; start> else set string <returning; desert>
}
}
}
return <#returning#>

end define

paul_one
20 Nov 2004, 19:59
No, no, no... The function should work just fine.

Try adding the exit north and removing one from the variable... So west is plus, south is plus, east is minus, north is minus... That way it's inverted.

And the code is there is QDK - it's kind of hidden though.
Do you see that "edit script" in the bottom right hand corner of the "for" thingy in QDK?
Well that's where the code is hidden.

The function works just fine, you may wish to add setting x and y to 0 though - otherwise a player could keep going into the start room, back out to the desert and pressing north to get -10 on the x factor and whatever...

I'll do a 4 directional thing if you want... It's good to see you trying to understand though.

steve the gaming guy
21 Nov 2004, 19:49
Ok, I've been messing with it some more. I did find the hidden code that you talked about. It's under "Run a script".
Do you think there is a way (for testing purposes) to visually see the grid numbers to make sure it's working right? Like for the first oasis. You have to walk west 6 or 7 times so as you keep walking west, it shows 1,0 2,0 3,0 4,0 and so on.

When I added the script to the north command and changed it to '- 1' I could not find the other oasis that you created. I found it accidentally one time but according to the script, it is supposed to be at location 2,3 which apparently it's not. Either that or I don't have the script in correctly.. Further, for some reason after going north 3 or 4 screens, I end up back in the start room.

As far as do I want you to create a 4-directional thing...sure, that would be fine. But please only do it if you have some spare time. You've helped a whole lot already and I thank you!

EDIT
Ok, I've messed further with it and added the status variables. I did some tweaking again naming the script for north and south as temp instead of tempy and making it minus one and plus one. Leaving it like that shows the x coordinate increase as it is supposed to but if you try to go north, it remains as '-1' and does not change any further unless you go south which then remains as '1'. (we are referring to the y coordinate here. I will continue messing with it....

EDIT (10 minutes after the last one :) )
How do I change the code to where it will change the x coordinate to 1 the very first time I step into the desert leaving the start room?
Further, how can I do the same for leaving the oasis? I've made n,s,e,w as all returning to the desert from an oasis. As I indicated above, I can see 1,0 2,0 3,0...., once I reach the oasis at 6,0 if I continue west, the first desert screen does not increase so it shows 6,0 again until you walk further west again. So it looks like this...

1,0 2,0 3,0 4,0 5,0 6,0 6,0 7,0...

I think Im Dead
22 Nov 2004, 08:30
Man you all suck, but I'm pretty high right now, so I don't want to explain this code...

Eh...GridMap.asl

That's basically a coordinate based movement system. Run it in Questnet Server, then connect with a Quest client to see how it works, I can't guarantee it working as a single player Quest game. You can move in all eight compass directions, the description isn't really set, so it just shows your coordinates in the room, but if you wander around the room, there are three objects in there that can obstruct your path. Their messaging is a little messed up because I was in the process of adding a dynamic description system that will take the x-size, y-size and z-size from an objects properties and then describe it according to an array of properties for that objects type(tree, rock, grass, human, dwarf, troll, mountain, whatever).

It's not necessarily more complex than you need for your project though. In actuallity, this code could easily enough be modified into a general "travel" or "lost" room that changes it's appearance according to the player's range near or far from the desired location.

Either way, study, then emulate me.

P.S. Ignore the WORK ON messages at the top, it's residue from an old pre-documented engine I use as a template to start from.

paul_one
22 Nov 2004, 09:58
Hilarious once again ITID...

I just liked this as it's a bit easier for people to comprehend and look at in a normal editor.

Also, we weren't talking about a 'proper' co-ordinate system... It was basically the need to have about 5 different rooms.

And I'll have a look into typing up about 5-ish lines into that code...

::EDIT::
Well, it WAS 5 lines of code (roughly)... But just copied over and over again - and then slightly altered... Time to make a function I think!

Anyway, the below code will get you to the second room, I also fixed it so going too far north or east takes you back to the starting room.

I may actualy turn this into a library function... Might be usefull... But this should do for you at the moment... more "custom-made" code.
' "desert land"
' Created with QDK 3.52 - UNREGISTERED VERSION

define game <desert land>
asl-version <350>
gametype singleplayer
start <start>
game author <steve>
game info <Created with QDK 3.52 - UNREGISTERED EVALUATION VERSION.>
define variable <thirst>
type numeric
value <0>
onchange {
if ( %thirst% = 4 ) then msg <You are thirsty. You better find an oasis soon.>
if ( %thirst% = 7 ) then {
msg <You crumble under deep dehydration and wither to a dried plum.>
wait <press any key>
playerlose
clear
}
}
end define

startscript {
set string <oasis[1]; 6,0>
set string <oasis[2]; 2,3>

set string <oasis_room[1]; oasis1>
set string <oasis_room[2]; oasis2>
}

properties <desert_x=0; desert_y=0>

end define

define synonyms
end define

define room <start>
west <desert>
end define

define room <desert>

north {
inc <thirst; 1>
set numeric <tempy; #game:desert_y# - 1>
property <game; desert_y = %tempy%>
set string <room; $desertroom$>
goto <#room#>
}

east {
inc <thirst; 1>
set numeric <tempy; #game:desert_x# - 1>
property <game; desert_x = %tempy%>
set string <room; $desertroom$>
goto <#room#>
}

south {
inc <thirst; 1>
set numeric <tempy; #game:desert_y# + 1>
property <game; desert_y = %tempy%>
set string <room; $desertroom$>
goto <#room#>
}

west {
inc <thirst; 1>
set numeric <tempy; #game:desert_x# + 1>
property <game; desert_x = %tempy%>
set string <room; $desertroom$>
goto <#room#>
}
end define

define room <oasis1>
prefix <the>
alias <oasis>
look <You've reached the oasis. What a pleasant treat to find among the desert sands.>
east <desert>
command <drink> {
msg <You reach down and have a refreshing sip of water.>
set numeric <thirst; 0>
}
command <drink water> {
msg <You reach down and have a refreshing sip of water.>
set numeric <thirst; 0>
}

define object <oasis water>
alias <oasis>
look <Beautiful water. Nectar of the gods.>
take {
msg <You reach down and have a refreshing sip of water.>
set numeric <thirst; 0>
}
prefix <the>
article <it>
gender <it>
end define

end define

define room <oasis2>
prefix <the>
alias <oasis>
look <You've reached the oasis. What a pleasant treat to find among the desert sands.>
east <desert>
command <drink> {
msg <You reach down and have a refreshing sip of water.>
set numeric <thirst; 0>
}
command <drink water> {
msg <You reach down and have a refreshing sip of water.>
set numeric <thirst; 0>
}

define object <oasis water2>
alias <oasis>
look <Beautiful water. Nectar of the gods.>
take {
msg <You reach down and have a refreshing sip of water.>
set numeric <thirst; 0>
}
prefix <the>
article <it>
gender <it>
end define

end define

define function <desertroom>
set string <returning; 1>
set numeric <upper; $ubound(oasis)$>
for <i; 1; %upper%> {
set string <dest; #game:desert_x#,#game:desert_y#>
msg <#oasis[i]#==#dest#==>
if ( #dest# = #oasis[i]# ) then {
set string <returning; #oasis_room[i]#>
msg <this should work>
}
else {
if ( #returning# = 1) then {
if ( #game:desert_x# < 0 ) or (#game:desert_y# < 0 ) then {
set string <returning; start>
property <game; desert_x=0; desert_y=0>
}
else {
set string <returning; desert>
}
}
}
}
return <#returning#>

end define

define text <intro>

end define

define text <win>

end define

define text <lose>

end define

steve the gaming guy
22 Nov 2004, 13:52
oh, I forgot that I had deleted the msg line that shows the coordinates. oops, hehe.

But taking this for example, when you first enter the desert to the west from the start room, it does not count the first desert room in the grid.


You are in start.
You can go west.

> west
You are in desert.
You can go north, south, east or west.

> west
6,0==1,0==
2,3==1,0==
You are in desert.
You can go north, south, east or west.

> west
6,0==2,0==
2,3==1,0==
You are in desert.
You can go north, south, east or west.


If that is something I cannot change, that's ok. I can still work with it. I'll take a look at ITID's code too just to see if I understand that as well.

paul_one
23 Nov 2004, 09:33
Just add the west code from the desert into the west script for the start room...

So instead of "west <desert>" it'd be:
set numeric <tempy; #game:desert_x# + 1>
property <game; desert_x = %tempy%>
set string <room; $desertroom$>
goto <#room#>


That will work.

steve the gaming guy
23 Nov 2004, 13:47
Computer Whizz wrote:Just add the west code from the desert into the west script for the start room...

So instead of "west <desert>" it'd be:
set numeric <tempy; #game:desert_x# + 1>
property <game; desert_x = %tempy%>
set string <room; $desertroom$>
goto <#room#>


That will work.


*smacks forehead*
Of course! That didn't even cross my mind to try that. Thanks for the advice.

I think Im Dead
23 Nov 2004, 18:18
And then of course you could use numeric variables, and what's that indent for?

paul_one
23 Nov 2004, 19:44
numeric variables... could do. I just like properties.
And erm, the indent was from a crappy cut&paste I did, cutting from the beginning of the set to the end of that code.

steve the gaming guy
23 Nov 2004, 20:03
Numeric variables? hmmm, interesting. I'm still an (less than) amateur programmer so what do I know??? :)

Whizz,
The desert is working nicely. I'm currently playing with it (tweaking) to stop sending the player back to start. Not too complicated. I am making it a bit difficult on my next step though. Three starting rooms before entering the desert.
In the code that you helped me immensely with, the start room was basically at 0,0. I am considering the start room as a safe room where you won't be thirsty in while you are in it and once you've exited the desert back into it. But further, I'm widening the start area so that 0,1 and 0,2 are also start rooms (start2, start3). I've almost gotten it right but am having a problem with the code adding coordinates incorrectly.

An example, from start (0,0), go west one room desert (1,0), south one room (1,1), east one room (should be start2) but it's desert (0,1). It seems to be skipping part of the code because of too many 'else' entries.

Below is the function that I've been messing around with:

define function <desertroom>
set string <returning; 1>
set numeric <upper; $ubound(oasis)$>
for <i; 1; %upper%> {
set string <dest; #game:desert_x#,#game:desert_y#>
msg <#oasis[i]#==#dest#==>
if ( #dest# = #oasis[i]# ) then set string <returning; #oasis_room[i]#> else {
if ( #returning# = 1 ) then {
if ( #game:desert_x# = 0 ) and ( #game:desert_y# = 0 ) then {
set string <returning; start>
property <game; desert_x=0; desert_y=0>
}
else {
set string <returning; desert>
else {
if ( #game:desert_x# = 0 ) and ( #game:desert_y# = 1 ) then {
set string <returning; start2>
property <game; desert_x=0; desert_y=1>
}
}

}
}
}
}
return <#returning#>

end define

paul_one
24 Nov 2004, 07:44
Remove you else, and just add the start2 room to the "oasis" array... so you can have your oasis[1] -> [x] ... then have your start2 and start3 at [x+1] [x+2].... For example:

set string <oasis[1]; 0,6> ' Oasis at 0-West, 6-South
set string <oasis[2]; 2,3> ' Oasis at 2-West, 3-South
set string <oasis[3]; 4,4> ' Oasis at 4-West, 4-South
set string <oasis[4]; 0,1> ' Start2 at 0-West, 1-South

Just remember to put the corrosponding room:
set string <oasis_room[1]; oasis1> ' Oasis1 room @ 0,6
set string <oasis_room[2]; oasis2> ' Oasis2 room @ 2,3
set string <oasis_room[3]; oasis3> ' Oasis3 room @ 4,4
set string <oasis_room[4]; start2> ' Start2 room @ 0,1


See, the oasis stuff doesn't NEED to be an oasis - the same for the deadly rooms etc... They can just be added to the "list", and if it is there than it will go there!
I may have a little fiddle and have it not go to the location if it's not in the list and either x or y is a zero. That way he gets a message he can't go that way... Or destroy the exit... Probably that one.

steve the gaming guy
24 Nov 2004, 14:22
I see what you're saying. I will work with that idea. I was able to incorporate an extra oasis while playing around with the code so I have a basic understanding of what you created here. Basically, the only rooms that I don't want the player to go to are the deadly rooms and of course too far north because there is supposed to be a cliff there. Anywhere else, they will just die if they walk to far (thanks to the "thirst" variable).
Remember at the beginning of this post, I plotted out the map as shown below. The highest "E" (0,0) on the map would be the 'start' room as you created so now you can see how I needed two more start rooms beneath it. The only other thing that I need to add is a room above the 'oi' (7,0) on the top row as shown below. I guess the new room would technically be (7,-1). But based on your latest response about adding rooms, that should not be a big deal. I'll let you know how it goes. Big Thanks again!!!!!


steve the gaming guy wrote:
X = empty desert
O = oasis
E = is the beginning of the desert
D = death rooms (killed by scorpions if entered)
I = item
oi = oasis and an item in the same room


X X X X X X oiX X X X X X E
X X X X X X X X X X X X X E
X X X X X X X X X X O X X X E
X X X X X X O X X I X X X X X D
X X X X X X X X X X X X X X X D
X X X X X X X X X X X X X X X D
X X X X X X oiX X X X X X X X
X X X X X X X X X X X X X
X X X X X X X X X X
X X X X X X X
X X X X X
X X X
X






P.S. I just thought of something...since I've plotted the entire map out here, when I finally finish the game, anyone can simply look at this post if they get lost in the desert!!

steve the gaming guy
24 Nov 2004, 16:20
Ok, here's the latest. I've tweaked, copy & pasted the code around to make it work. I've added a new room above the (7,0) room as I indicated in the last post. The problem now lies in stopping the player from going to the other (x, -1) rooms. The only room with a negative y coordinate should be the temple room.

Here's the code so far:


startscript {
set string <oasis[1]; 4,2>
set string <oasis[2]; 9,3>
set string <oasis[3]; 6,3>
set string <temple[1]; 7,-1>
set string <oasis_room[1]; oasis1>
set string <oasis_room[2]; oasis2>
set string <oasis_room[3]; oasis3>
set string <temple_room[1]; temple1>
}


and

define function <desertroom>
set string <returning; 1>
set numeric <upper; $ubound(oasis)$>
for <i; 1; %upper%> {
set string <dest; #game:desert_x#,#game:desert_y#>
msg <#oasis[i]#==#dest#==>
msg <#temple[i]#==#dest#==>
if ( #dest# = #oasis[i]# ) then set string <returning; #oasis_room[i]#> else {
if ( #returning# = 1 ) then {
if ( #game:desert_x# = 0 ) and ( #game:desert_y# = 0 ) then {
set string <returning; start>
property <game; desert_x=0; desert_y=0>
}

else {
set string <returning; desert>
if ( #game:desert_x# = 0 ) and ( #game:desert_y# = 1 ) then {
set string <returning; start2>
property <game; desert_x=0; desert_y=1>
}
if ( #dest# = #temple[i]# ) then set string <returning; #temple_room[i]#> else {
if ( #returning# = 1 ) then {
if ( #game:desert_x# = 0 ) and ( #game:desert_y# = 0 ) then {
set string <returning; start>
property <game; desert_x=0; desert_y=0>
}
else {
set string <returning; desert>
}
}
}
}
}
}
}
return <#returning#>

end define


I know I'm making the function code look messy but it seems to be working. QDK kept reminding me that a "}" was missing so I added them accordingly.

paul_one
25 Nov 2004, 11:27
No... Add the temple to the oasis array like so:
set string <oasis[4]; 7,-1>
set string <oasis_room[4]; temple1>


It checks to see if there are any rooms first - then check if the x/y value is below 0. So that should be just fine. There's no need for a "temple" or "deathroom" or "heavan" or "anythingelse" array, just stick it all in the oasis one... Just because it's oasis doesn't mean it HAS to be an oasis :D .

having that, and using my code would (should... haven't checked it) work.

paul_one
25 Nov 2004, 11:37
OK - I totally coded my function wrong :oops:.
This is the proper function that should allow you t create 'edge'-rooms... (-1 rooms).
You could even create rooms of -2 or -3 (by createing a "jump" north, or "run" north for example to get -2 or -3).

As I said above - just add it to the oasis array...

' ######### CORRECTED CODE ############
' "desert land"
' Created with QDK 3.52 - UNREGISTERED VERSION

define game <desert land>
asl-version <350>
gametype singleplayer
start <start>
game author <steve>
game info <Created with QDK 3.52 - UNREGISTERED EVALUATION VERSION.>
define variable <thirst>
type numeric
value <0>
onchange {
if ( %thirst% = 4 ) then msg <You are thirsty. You better find an oasis soon.>
if ( %thirst% = 7 ) then {
msg <You crumble under deep dehydration and wither to a dried plum.>
wait <press any key>
playerlose
clear
}
}
end define

startscript {
set string <oasis[1]; 6,0>
set string <oasis[2]; 2,3>
set string <oasis[3]; 2,-1>

set string <oasis_room[1]; oasis1>
set string <oasis_room[2]; oasis2>
set string <oasis_room[3]; temple1>
}

properties <desert_x=0; desert_y=0>

end define

define synonyms
end define

define room <start>
west <desert>
end define

define room <desert>

north {
inc <thirst; 1>
set numeric <tempy; #game:desert_y# - 1>
property <game; desert_y = %tempy%>
set string <room; $desertroom$>
goto <#room#>
}

east {
inc <thirst; 1>
set numeric <tempy; #game:desert_x# - 1>
property <game; desert_x = %tempy%>
set string <room; $desertroom$>
goto <#room#>
}

south {
inc <thirst; 1>
set numeric <tempy; #game:desert_y# + 1>
property <game; desert_y = %tempy%>
set string <room; $desertroom$>
goto <#room#>
}

west {
inc <thirst; 1>
set numeric <tempy; #game:desert_x# + 1>
property <game; desert_x = %tempy%>
set string <room; $desertroom$>
goto <#room#>
}
end define

define room <oasis1>
prefix <the>
alias <oasis>
look <You've reached the oasis. What a pleasant treat to find among the desert sands.>
east <desert>
command <drink> {
msg <You reach down and have a refreshing sip of water.>
set numeric <thirst; 0>
}
command <drink water> {
msg <You reach down and have a refreshing sip of water.>
set numeric <thirst; 0>
}

define object <oasis water>
alias <oasis>
look <Beautiful water. Nectar of the gods.>
take {
msg <You reach down and have a refreshing sip of water.>
set numeric <thirst; 0>
}
prefix <the>
article <it>
gender <it>
end define

end define

define room <oasis2>
prefix <the>
alias <oasis>
look <You've reached the oasis. What a pleasant treat to find among the desert sands.>
east <desert>
command <drink> {
msg <You reach down and have a refreshing sip of water.>
set numeric <thirst; 0>
}
command <drink water> {
msg <You reach down and have a refreshing sip of water.>
set numeric <thirst; 0>
}

define object <oasis water2>
alias <oasis>
look <Beautiful water. Nectar of the gods.>
take {
msg <You reach down and have a refreshing sip of water.>
set numeric <thirst; 0>
}
prefix <the>
article <it>
gender <it>
end define

end define

define room <temple1>
alias <Golden Temple>
description <This temple is made of shimering gold!|nIt has statues outside and looks amazingly holy...|n|n...You step back in awe.>
south <desert>
end define

define function <desertroom>
set string <returning; 1>
set numeric <upper; $ubound(oasis)$>
for <i; 1; %upper%> {
set string <dest; #game:desert_x#,#game:desert_y#>
msg <#oasis[i]#==#dest#==>
if ( #dest# = #oasis[i]# ) then {
set string <returning; #oasis_room[i]#>
msg <this should work>
}
}
if ( #returning# = 1) then {
if ( #game:desert_x# < 0 ) or (#game:desert_y# < 0 ) then {
set string <returning; start>
property <game; desert_x=0; desert_y=0>
}
else {
set string <returning; desert>
}
}
return <#returning#>

end define

define text <intro>

end define

define text <win>

end define

define text <lose>

end define

As you can see, west 2 and north one will take you to the temple...

steve the gaming guy
26 Nov 2004, 14:10
Right. Very good. I see where you're going there.
Is there a way to make (2,-1) the only negative number available? In other words, can a player go (0,0) (1,0)...and not have the option to go north to (0,-1) or (1,-1)?
And then when they reach (2,0), they have an option to go north to (2,-1)?

Is it possible? :?


2,-1
6,0 5,0 4,0 3,0 2,0 1,0 0,0
6,1 5,1 4,1 3,1 2,1 1,1 0,1

paul_one
26 Nov 2004, 16:13
Yeah... well I *WAS* going to have a quick break now... maybe eat a banana and read up on some Apache stuff, but hell - programming's my life so I'll have a look into it whie eating a banana!
I'll get back in a few..

paul_one
26 Nov 2004, 17:21
Right - I've got just great so far... I just need one itty-bitty thing...

Alex, createing exit's with scripts.... Possible?
In the helpfile you have
create exit [north/east/whatever] <#room#; #other room#>

But I need a "do" command... To get my original exit's back.
Any way possible to get this effect?
since:
create exit north <desert; do <script>>
obviously won't work because of the <>'s inside of each other.

I fear this is a feature unsupported by Quest, which means this isn't available Steve... But I got SO far - the script delete's exit's when you reach an edge... it's just that I need to re-create them again.

::EDIT::
I've just had another thought Steve........ Just add a seperate room into point 2,0
(Named desert_temple I guess)... If you alias it right, and add in the exits, then it'll act just like a normal desert room.

Then, you can just add an exit to the temple yourself to that one room!

steve the gaming guy
26 Nov 2004, 17:44
Computer Whizz wrote: the script delete's exit's when you reach an edge... it's just that I need to re-create them again.

::EDIT::
I've just had another thought Steve........ Just add a seperate room into point 2,0
(Named desert_temple I guess)... If you alias it right, and add in the exits, then it'll act just like a normal desert room.

Then, you can just add an exit to the temple yourself to that one room!


I think you're onto something. Let's say (2,0) is an oasis room with its own exit to the temple room. The temple room's only exit would be back to the oasis at (2,0).
Now that we need no negative grid points, we can add a script that if they try to go #game:desert_y# < 0, then "You can't go further north because the cliff is blocking you"
Does that sound right? I'll work with it and see if it functions properly. I've been busy at work (like I'm supposed to be always) so I haven't been able to mess with it much this morning.

paul_one
26 Nov 2004, 20:23
Right, here is the following code so far... it works... Kinda... :D

Just alter the "create exit north <desert;>"... So, you can use that sort of checking with the north direction to see if you can go north.. or east.
Well, here you go (remember - it won't work if you just cut and paste it because one line isn't completed!!)

' "desert land"
' Created with QDK 3.52 - UNREGISTERED VERSION

define game <desert land>
asl-version <350>
gametype singleplayer
start <start>
game author <steve>
game info <Created with QDK 3.52 - UNREGISTERED EVALUATION VERSION.>
define variable <thirst>
type numeric
value <0>
onchange {
if ( %thirst% = 4 ) then msg <You are thirsty. You better find an oasis soon.>
if ( %thirst% = 7 ) then {
msg <You crumble under deep dehydration and wither to a dried plum.>
wait <press any key>
playerlose
clear
}
}
end define

startscript {
set string <oasis[1]; 6,0>
set string <oasis[2]; 2,3>
set string <oasis[3]; 2,-1>

set string <oasis_room[1]; oasis1>
set string <oasis_room[2]; oasis2>
set string <oasis_room[3]; temple1>
}

properties <desert_x=0; desert_y=0>

end define

define synonyms
end define

define room <start>
west <desert>
end define

define room <desert>

script {
set numeric <ED_north1; #game:desert_y# - 1>
set numeric <ED_east1; #game:desert_x# - 1>
set string <edgedetect[1]; $desertroom(%ED_east1%; #game:desert_y#)$> ' This checks to see if a valid room is east 1.
set string <edgedetect[2]; $desertroom(#game:desert_x#; %ED_north1%)$> ' This checks to see if a valid room is north 1.
msg <====EVAL====|n_
north = %ED_north1%|n_
east = %ED_east1%|n_
edge1 = #edgedetect[1]#|n_
edge2 = #edgedetect[2]#>
if ( #edgedetect[1]# = FALSE ) then create exit east <desert;> else create exit east <desert; do
' This may say "create" but it should be removing the exit... Else re-create exit (put in to get exit back after destroying it.

if ( #edgedetect[2]# = FALSE ) then create exit north <desert;> ' Same here...

}

north do <desert_exit(N)>
' inc <thirst; 1>
' set numeric <tempy; #game:desert_y# - 1>
' property <game; desert_y = %tempy%>
' set string <room; $desertroom$>
' goto <#room#>

east do <desert_exit(E)>
' inc <thirst; 1>
' set numeric <tempy; #game:desert_x# - 1>
' property <game; desert_x = %tempy%>
' set string <room; $desertroom$>
' goto <#room#>

south do <desert_exit(S)>
' inc <thirst; 1>
' set numeric <tempy; #game:desert_y# + 1>
' property <game; desert_y = %tempy%>
' set string <room; $desertroom$>
' goto <#room#>

west do <desert_exit(W)>
' inc <thirst; 1>
' set numeric <tempy; #game:desert_x# + 1>
' property <game; desert_x = %tempy%>
' set string <room; $desertroom$>
' goto <#room#>

end define

define room <oasis1>
prefix <the>
alias <oasis>
look <You've reached the oasis. What a pleasant treat to find among the desert sands.>
east <desert>
command <drink> {
msg <You reach down and have a refreshing sip of water.>
set numeric <thirst; 0>
}
command <drink water> {
msg <You reach down and have a refreshing sip of water.>
set numeric <thirst; 0>
}

define object <oasis water>
alias <oasis>
look <Beautiful water. Nectar of the gods.>
take {
msg <You reach down and have a refreshing sip of water.>
set numeric <thirst; 0>
}
prefix <the>
article <it>
gender <it>
end define

end define

define room <oasis2>
prefix <the>
alias <oasis>
look <You've reached the oasis. What a pleasant treat to find among the desert sands.>
east <desert>
command <drink> {
msg <You reach down and have a refreshing sip of water.>
set numeric <thirst; 0>
}
command <drink water> {
msg <You reach down and have a refreshing sip of water.>
set numeric <thirst; 0>
}

define object <oasis water2>
alias <oasis>
look <Beautiful water. Nectar of the gods.>
take {
msg <You reach down and have a refreshing sip of water.>
set numeric <thirst; 0>
}
prefix <the>
article <it>
gender <it>
end define

end define

define room <temple1>
alias <Golden Temple>
description <This temple is made of shimering gold!|nIt has statues outside and looks amazingly holy...|n|n...You step back in awe.>
south <desert>
end define

define function <desertroom>
set string <returning; 1>
set numeric <upper; $ubound(oasis)$>
if ( $numberparameters$ > 0 ) then {
msg <$parameter(1)$ === $parameter(2)$>
if ( $parameter(1)$ < 0 ) or ( $parameter(2)$ < 0 ) then {
set string <hypoth; $parameter(1)$,$parameter(2)$ >
set string <returning; FALSE> ' We put this here because the IF below will correct this.
for <i; 1; %upper%> {
if ( #hypoth# = #oasis[i]# ) then {
set string <returning; TRUE>
msg <If you understand all THIS code then you're on the right tracks!>
}
}
}
else set string <returning; TRUE>

}
else {
for <i; 1; %upper%> {
set string <dest; #game:desert_x#,#game:desert_y#>
msg <#oasis[i]#==#dest#==>
if ( #dest# = #oasis[i]# ) then {
set string <returning; #oasis_room[i]#>
msg <this should work>
}
}
if ( #returning# = 1) then {
if ( #game:desert_x# < 0 ) or (#game:desert_y# < 0 ) then {
set string <returning; start>
property <game; desert_x=0; desert_y=0>
}
else {
set string <returning; desert>
}
}
}
return <#returning#>

end define

define procedure <desert_exit>

if ( $numberparameters$ < 1 ) then {
msg <ERROR!!!1>
}
else {
inc <thirst; 1>

if ( $parameter(1)$ = N ) then {
set numeric <tempy; #game:desert_y# - 1>
property <game; desert_y = %tempy%>
}
if ( $parameter(1)$ = E ) then {
set numeric <tempy; #game:desert_x# - 1>
property <game; desert_x = %tempy%>
}

if ( $parameter(1)$ = S ) then {
set numeric <tempy; #game:desert_y# + 1>
property <game; desert_y = %tempy%>
}

if ( $parameter(1)$ = W ) then {
set numeric <tempy; #game:desert_y# - 1>
property <game; desert_y = %tempy%>
}

set string <room; $desertroom$>
goto <#room#>
}

end define

define text <intro>

end define

define text <win>

end define

define text <lose>

end define

As you can see - I made several improvements. Made the north/south/east/west codes into a procedure. Added a "hypothetical" movement addition to the $desert_room$ function, and destroying exits... Only problem is I can't re-create the exit's once they're gone...

::EDIT::
Wow - looking at it posted like this makes it look like alot of work :shock: ... Anyway, the line that isn't complete has " create exit north <desert;> " on it - so if you search for that, you'll see it.
That whole area is about checking the hypothetical exit - so it shouldn't be too hard to mimic it in the exit script in any way...
If you want help, or to pick my brains at all - I'm right here.

steve the gaming guy
26 Nov 2004, 21:47
Side question. Before you changed the most recent procedure, a recurring bit of code that's been existing is
   set string <returning; 1> 
set numeric <upper; $ubound(oasis)$>
for <i; 1; %upper%> {
set string <dest; #game:desert_x#,#game:desert_y#>

How would someone like me (lacking programming experience) know to type <upper; $ubound(oasis)$>. I have no idea what that means. Or for that matter, what "for <i; 1; %upper%>" means. I assume you code most of this, if not all, by hand. That's impressive to me hand-coded or not.

Back to the puzzle at hand... Before your last post with the new code, I was asking about making a way to not go into a negative area. I assume that is what the new code is supposed to be doing. I've played around with it a lot and I don't think it's working it. I want to get away from moving back to start. Isn't there a way to just tell the player that they can't go any further and make them NOT move to the next room?
In other words, we're at 3,2 and I move north two times bringing us to 3,0. If I choose north again, I would like to have a message telling them they can go no further north (instead of moving us back to start). When I try to alter it myself, I only screw it up and the function no longer works at all.

I see where you were talking about where we needed a "destroy" exit command. I could only find the "destroy GO TO exit" which is something we don't have.

With that in mind and after I fried my brain staring at the code for the past half hour or so, I hope my explanation is making sense.

paul_one
26 Nov 2004, 22:37
Yes, I code most of this by hand - and although I am flattered by your words, these sorts of things come as natural for a more experienced coder (those that grow up on BASIC for example).

I'll give you a quick run-through.

<upper; $ubound(oasis)$>
Do you remember me refering to <oasis[i]> as an array? Well all an array is is like a list or spreadsheet (or a number of spreadsheet's etc... - But Quest only allows a list of variables).. So let's get that straight now:
All these oasis variable's are: an array in the form of a list...

Now, to get the highest number in that list, you use $upper()$ to get the highest possible [i] value... That way you can do all sorts of things with that list, and make sure you don't go over the edge.

The "for<i; 1; %upper%>" is a "loop"... In basic you would use a similar syntax of:
"for i = 0 to 10 step 1
#code here#
next i"
Now this just means go through #code here# and then increase i until you get to 10... so:
"for i = 0 to 10
print "hi"
next i" would print hi out 11 times (step 1 doesn't need to be there, and is in fact default).
Now for Quest, you use:
"for <i; 0; 10; 1> {
#code here#
}"
To do exactly the same... The last 1 is totally optional as that is a "step". i is the variable to use.

It's also worth using the Quest help file, Alex has put ALOT of thought and effort into it - and I constantly find myself going through it.
When you open it, click on ASL reference, and expand the [+]... Then just explore around there (just a breif look will do)... Once you look through there you get a bit more of a deeper understanding of what's going on.

Heh. With your question:
Instead of trying to alter the functions, try to see how I use the functions - and then alter the exit's script.
Here, using the "north" exit, this code should work:
north {
if ( #edgedetect[2]# = FALSE ) then msg <Sorry, you can't go here!> else do <desert_exit(N)>
}

Then just remove these lines from the "script {}" part of the desert room.
if ( #edgedetect[1]# = FALSE ) then create exit east <desert;> else create exit east <desert; do
' This may say "create" but it should be removing the exit... Else re-create exit (put in to get exit back after destroying it.

if ( #edgedetect[2]# = FALSE ) then create exit north <desert;> ' Same here...

Now when you try to go too far north you can't go there...

steve the gaming guy
27 Nov 2004, 05:09
Ok, I'm soooo relieved! I think it's totally complete now!!!

I added what you told me to add then I took out what you told me to take out (both in your last post)... I made a few minor changes which included adding a few more oasis rooms and changing coordinate locations. I added two more start rooms at locations 0,1 and 0,2. Those were the most difficult to coordinate but after about an hour or so, I finally got it to work.
I couldn't have done it without your tremendous help. I will definitely be adding you in the beginning credits of my game when it is complete.

paul_one
27 Nov 2004, 13:40
Thanks very much...

Now I'm off to have a bacardi breezer and some custard creams.... GO ME!
You've been good to work with/for... Nice little subject there!