Basically the title, I want some locations to be known before you have been there in the case your character already has a map for example.
Grid_CalculateMapCoordinates (room A, player) // (this shouldn't be necessary, but we'll include it in case this script is run before the map is properly initialised)
Grid_CalculateMapCoordinates (room B, player) // (now the grid system knows the coordinates for room B)
room B.grid_render = true // (so we can set it to be visible on the grid)
Grid_DrawRoom (room B, false, player)
I don't know what the corridor is still so I don't know if I need it, it's working without though so I'll wait and see what mrangel says.
I had a look through through the Attributes tap in the room I wanted to show and didn't find the right one, I'm betting it's in there and I just can't see it.
I found "visited" in attributes and set that to true but that didn't do anything. Now I have no idea.
The attribute you want is called
grid_render, but… a room's coordinates on the map aren't calculated until the map draws an exit that leads there.
Before you can show a room on the map, you need to call the function
Grid_CalculateMapCoordinates to work out where the room is relative to other rooms. It takes two parameters: the first is the room, and the second is the player object. Once this function has been called on the player's starting room, you can only call it on a room adjacent to one that's already had its coordinates calculated.
If you want the player's start room and another room to both be visible at the start, but not all of the rooms in between, then you'll need to calculate the grid coordinates yourself, which is a more complex process. If you want to do that, let us know and I'm sure someone will help you out.
How about a script in the start script that moves the player to each room to be pre-mapped, then move the player to the starting room, then start the game???
I'm gonna try out mrangels way and if I can't figure that out i'm gonna try the genius DarkLizerd way, can't believe I didn't think of that. I imagine the proper way is more stable and it would be nice to be able to show some rooms you can't actually see the way too so you have like a goal and you have to find the path there.
This page is so god damn useful omg: http://docs.textadventures.co.uk/quest/functions/corelibrary/grid_calculatemapcoordinates.html
You don't normally need this function, thank you very much! :D
Well, I did everything mrangel said to do but it's not working.
Grid_CalculateMapCoordinates (Harthmead courtyard, player) Grid_CalculateMapCoordinates (General goods store, player)
I put that in the run script description of an object for testing, nothing happens though. The player is in Harthmead courtyard, I tried doing it with and without
Grid_CalculateMapCoordinates (Harthmead courtyard, player) because I was not sure what you meant when you said:
Once this function has been called on the player's starting room, you can only call it on a room adjacent to one that's already had its coordinates calculated.
Mainly I want to use this for towns so you can see the whole map when you enter the town and you know where the shops are and stuff like that. I wanted to show that I have made the rooms very close to each other and made the "walls" only where there are not paths.
OK... So you've done the programmatically correct approach...
I don't know if you tried the quick and dirty method...
How about option #3?
Drop Quest's "box" map.
Use a picture that you have drawn of your town.
Then use the image layering that someone else here is working on, and place a picture on the map
where the player is.
Maybe an "X", A stick figure, or even just a stick pin...
That way, you have your town map, the player can see everything, and you can place everything you
want the player the see. and, it may be a little easer to control.
OK, maybe I didn't explain so well.
Let's say the player starts in
room A, and you want
room B to be shown on the map. The shortest distance between those two is through two other rooms,
corridor 1 and
The script you'd use is:
Grid_CalculateMapCoordinates (room A, player)// (this shouldn't be necessary, but we'll include it in case this script is run before the map is properly initialised)
Grid_CalculateMapCoordinates (corridor 1, player)// (by "only adjacent rooms", I meant that you can only run this function on the room the player is in, or a room that has an exit from a room that's already been done. So we need to do this for every room you pass through on the way)
Grid_CalculateMapCoordinates (corridor 2, player)
Grid_CalculateMapCoordinates (room B, player)// (now the grid system knows the coordinates fgor room B)
room B.grid_render = true// (so we can set it to be visible on the grid)
Grid_DrawRoom (room B, false, player)// and then finally draw it)
[EDIT: Added the missing parameter to Grid_DrawRoom)
corridor 1 and
corridor 2 are the
Exit: Harthmead courtyard and
Exit: General goods store right? It says:
Error compiling expression 'Exit: General goods store': SyntaxError: Unexpected character: :Line: 1, Column: 5
I assume I need to express the "corridor" in a different way or a corridor and an exit are totally different.
No; you don't need to specify the exits manually. But you do need to make sure that the rooms you calculate the coordinates for are connected to each other (so there's no gaps in between)
Sorry, I missed out a parameter. It should be
Grid_DrawRoom (room B, false, player).
(The second parameter could be 'true' or 'false'. It just controls whether the room will be redrawn if it's already on the map - you normally set it to
true to notify the map that a room may have gained or lost exits)
And I didn't see your last message DarkLizard, no I didn't try the quick and dirty method. Programmatically correct is a term I am gonna adopt. And that's me doing the image layering too, I don't really want to do the map that way, I would rather just use the map generator in the engine, I just wish that it was a little simpler. I would have thought a checkbox to say the room is visible on the map would be a commonly needed enough feature to implement by default.
Grid_CalculateMapCoordinates (General goods store, player)
Grid_DrawRoom (General goods store, false, player)
That works on its own in fact, I'll try a series of rooms now.
I got a string of three rooms beyond the one I was in to be made visible with this. The names are just for tests, now I can make the town how I want it.
Grid_CalculateMapCoordinates (General goods store, player) Grid_CalculateMapCoordinates (Goods Store Back Room, player) Grid_DrawRoom (General goods store, false, player) Grid_DrawRoom (Goods Store Back Room, false, player) Grid_DrawRoom (back back room, false, player)
Mrangel, when you said corridor 1 and corridor 2, did you mean rooms used as "corridors" between rooms? Because if that's what you mean that was very confusing.
room B.grid_render = true is not needed at all, unless that makes sure that the next time you visit the whole map is still showing like the last time you were there?