move to an undiscovered room
deroesi
15 Apr 2014, 01:48Hi guys!
I'm currently getting an error ....
(Error running script: Error evaluating expression 'DictionaryItem(coordinates, coordinate)': The given key was not present in the dictionary.)
....when i try to move the player to a room which wasnt yet discovered on the map (which is strange because a "shortcut script" at the beginning moves the player to whatever undiscovered room successfully.
what could i do wrong, or is it a bug?
thanks!
--stephan
I'm currently getting an error ....
(Error running script: Error evaluating expression 'DictionaryItem(coordinates, coordinate)': The given key was not present in the dictionary.)
....when i try to move the player to a room which wasnt yet discovered on the map (which is strange because a "shortcut script" at the beginning moves the player to whatever undiscovered room successfully.
what could i do wrong, or is it a bug?
thanks!
--stephan
jaynabonne
15 Apr 2014, 06:25I'm not sure about 5.5, but I know with 5.4, you could not jump around in the map, due to how the map incrementally generated location coordinates (room to room). If you jumped to a room that was not already laid out, it would have "difficulty". It sounds like it is still the case, unfortunately.
deroesi
15 Apr 2014, 13:51mhh thats unfortunate... is there a way to completely hide the textoutput
for a while? (so i could "walk" there step by step, and the player doesnt get spammed with
room descriptions )
thanks for your help
--stephan
for a while? (so i could "walk" there step by step, and the player doesnt get spammed with
room descriptions )
thanks for your help
--stephan
deroesi
15 Apr 2014, 19:06is it possible to change/uncheck the "Show room description when entering the room" setting during gameplay? the "game" node is not visible in the set attribute object list... is there a way to do it?
thanks!
thanks!
jaynabonne
15 Apr 2014, 19:30I had written some code once that silently traversed all the rooms to build up the map variables. I can't remember if it also built up the map. Let me see if I can do something. Are you using Quest 5.5?
deroesi
15 Apr 2014, 21:30yes 5.5
a script to build up the map sounds like a great idea (especially if you already have one ) in the worstcase i could create
an action to move through all rooms before the game starts (40+ rooms uncool but doable i think ) good thinking! thanks!
a script to build up the map sounds like a great idea (especially if you already have one ) in the worstcase i could create
an action to move through all rooms before the game starts (40+ rooms uncool but doable i think ) good thinking! thanks!
jaynabonne
16 Apr 2014, 06:16Well, you could try this. I wanted to test it, but I didn't have time to create a setup with a number of rooms. If you're willing to give it a go...
It is recursive, so we need to be careful there. If (worst case) all forty of your rooms were in a single line, it would recurse to a depth of 40.
I'm not sure what the effect will be. Let me know.
The line commented out also draws the room on the map. So if you wanted the entire map filled out up front, you could un-comment that line.
Just call this at startup time with the first room of your map (could even be VisitRoom(game.pov.parent) if the player is in the start room).
It is recursive, so we need to be careful there. If (worst case) all forty of your rooms were in a single line, it would recurse to a depth of 40.
I'm not sure what the effect will be. Let me know.
<function name="VisitRoom" parameters="room">
if (not GetBoolean(room, "genvisited")) {
room.genvisited = true
Grid_CalculateMapCoordinates (room, game.pov)
//Grid_DrawRoom (room, false)
foreach (exit, AllExits()) {
if (exit.parent = room) {
VisitRoom (exit.to)
}
}
}
</function>
The line commented out also draws the room on the map. So if you wanted the entire map filled out up front, you could un-comment that line.
Just call this at startup time with the first room of your map (could even be VisitRoom(game.pov.parent) if the player is in the start room).
deroesi
17 Apr 2014, 05:41hehe, thanks!! (again), it works perfectly as far i can tell... great!
m4u
09 May 2014, 14:55Hi Jay, this is only working with the first player object. What if we have different player objects during the game? The same with the map up front. It disappears...
jaynabonne
10 May 2014, 18:21It looks like map variables are per-POV now, so you'd have to run it for each.
I'm not sure what you mean about the map disappearing.
I'm not sure what you mean about the map disappearing.
m4u
11 May 2014, 14:22I mean when you create the whole map in the first move, if you switch to another player it disappears and shows only the room for the new player...
m4u
13 May 2014, 19:08So, Is it possible to draw the whole map from the beggining for each player?
jaynabonne
13 May 2014, 20:09You'd probably have to call the above (with the DrawRoom line not commented out) with each player set as the game.pov.
Aerdureth
15 May 2014, 01:37Hello,
I am having a similar problem. My goal is to teleport the player to an entirely different room when he touches a certain object. Since I got the same error as the person who made this thread, I used the script and called it when the player first enters the first room. But now, I am getting the following error: Error running script: No parameters passed to VisitRoom function - expected 1 parameters
Did I call it at the wrong place, or forgot to add something?
I would be very glad, if somebody could help me.
Best wishes,
Aerdureth
I am having a similar problem. My goal is to teleport the player to an entirely different room when he touches a certain object. Since I got the same error as the person who made this thread, I used the script and called it when the player first enters the first room. But now, I am getting the following error: Error running script: No parameters passed to VisitRoom function - expected 1 parameters
Did I call it at the wrong place, or forgot to add something?
I would be very glad, if somebody could help me.
Best wishes,
Aerdureth
jaynabonne
15 May 2014, 03:12I think the error is telling you: it wants a parameter and you didn't pass any. If the starting room is the room the player is in, then just do:
But you should do it at game startup time. If you try to do it after you teleport the player, it's already too late since the room they're landing in has not been set up properly.
Keep in mind that it only works if the rooms are all connected. If you have rooms that are disjoint, then the initial call to VisitRoom won't visit your new set of rooms. I haven't explored how to make that work - I believe it would be setting some variables for the room before calling VisitRoom on the disjoint room set. I'd have to look at the code to see what they are. But the more important question is: if the rooms are not connected, where should they show up in the map anyway? You might be better off giving the areas different z-values (that is, accessing them via up and down) and connecting them with some sort of exit.
VisitRoom(game.pov.parent)
But you should do it at game startup time. If you try to do it after you teleport the player, it's already too late since the room they're landing in has not been set up properly.
Keep in mind that it only works if the rooms are all connected. If you have rooms that are disjoint, then the initial call to VisitRoom won't visit your new set of rooms. I haven't explored how to make that work - I believe it would be setting some variables for the room before calling VisitRoom on the disjoint room set. I'd have to look at the code to see what they are. But the more important question is: if the rooms are not connected, where should they show up in the map anyway? You might be better off giving the areas different z-values (that is, accessing them via up and down) and connecting them with some sort of exit.
Aerdureth
15 May 2014, 10:14Ah, thank you very much!
I was wondering, why the player made such strange jumps on the map when I moved him. I probably confused the map quite a bit. The rooms in question (the lair of the cyclops and his weapon chamber) are totally disjoint since I do not want the player to access them by any other means than touching a specific object. Do you think, I could place the new area above or below the room with the object and connect them via a hidden and blocked exit?
I was wondering, why the player made such strange jumps on the map when I moved him. I probably confused the map quite a bit. The rooms in question (the lair of the cyclops and his weapon chamber) are totally disjoint since I do not want the player to access them by any other means than touching a specific object. Do you think, I could place the new area above or below the room with the object and connect them via a hidden and blocked exit?
Silver
25 Aug 2014, 18:00A trap door would be an ideal way of being transported rapidly into the cyclops' lair.
Silver
26 Aug 2014, 18:44I'm a bit confused about this. Does the error occur only with being transported to unconnected rooms when the game map is enabled or does moving the player to an unconnected room not work at all?
HegemonKhan
27 Aug 2014, 02:20I don't know about this thread's posted code, but you can move your player to an unconnected (no exit usage) room, as quest does not care if the room has exits or not:
MoveObject (player, your_desired_destination_room)
~OR~
player.parent = your_desired_destination_room
----------
see my 'explore and travel' code (though it's quest v540, so it may not work if you're using v550), but you can at least look at it (though it's a bit advanced for a newbie to coding, as it uses lists and dictionaries):
MoveObject (player, your_desired_destination_room)
~OR~
player.parent = your_desired_destination_room
----------
see my 'explore and travel' code (though it's quest v540, so it may not work if you're using v550), but you can at least look at it (though it's a bit advanced for a newbie to coding, as it uses lists and dictionaries):
<asl version="540">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="Testing Game Stuff">
<gameid>eef801a1-4e6b-4b0a-bdbf-8f3ecfa8389c</gameid>
<version>1.0</version>
<firstpublished>2013</firstpublished>
<turns type="int">0</turns>
<statusattributes type="simplestringdictionary">turns=</statusattributes>
<start type="script">
msg ("Important Note:")
msg ("Type in: help")
</start>
</game>
<object name="homeland">
<inherit name="editor_room" />
<object name="player">
<inherit name="editor_object" />
<inherit name="editor_player" />
</object>
</object>
<object name="grassland">
<inherit name="editor_room" />
</object>
<object name="plains">
<inherit name="editor_room" />
</object>
<object name="desert">
<inherit name="editor_room" />
</object>
<object name="tundra">
<inherit name="editor_room" />
</object>
<object name="swampland">
<inherit name="editor_room" />
</object>
<object name="mountains">
<inherit name="editor_room" />
</object>
<object name="forest">
<inherit name="editor_room" />
</object>
<object name="wasteland">
<inherit name="editor_room" />
</object>
<object name="coastland">
<inherit name="editor_room" />
</object>
<object name="hills">
<inherit name="editor_room" />
</object>
<command name="help_command">
<pattern>help</pattern>
<script>
help_function
</script>
</command>
<command name="explore_command">
<pattern>explore</pattern>
<script>
explore_function
</script>
</command>
<command name="travel_command">
<pattern>travel</pattern>
<script>
travel_function
</script>
</command>
<object name="data_object">
<inherit name="editor_object" />
<travel_string_list type="simplestringlist">homeland</travel_string_list>
<homeland_events_string_list type="simplestringlist">grassland_discovery;plains_discovery;desert_discovery;tundra_discovery;swampland_discovery;forest_discovery;mountains_discovery;hills_discovery;wasteland_discovery;coastland_discovery</homeland_events_string_list>
<homeland_events_script_dictionary type="scriptdictionary">
<item key="grassland_discovery">
list add (data_object.travel_string_list, "grassland")
msg ("You've discovered the grassland! Now, you can travel to the grassland and explore it!")
</item>
<item key="plains_discovery">
list add (data_object.travel_string_list, "plains")
msg ("You've discovered the plains! Now, you can travel to the plains and explore it!")
</item>
<item key="desert_discovery">
list add (data_object.travel_string_list, "desert")
msg ("You've discovered the desert! Now, you can travel to the desert and explore it!")
</item>
<item key="tundra_discovery">
list add (data_object.travel_string_list, "tundra")
msg ("You've discovered the tundra! Now, you can travel to the tundra and explore it!")
</item>
<item key="swampland_discovery">
list add (data_object.travel_string_list, "swampland")
msg ("You've discovered the swampland! Now, you can travel to the swampland and explore it!")
</item>
<item key="forest_discovery">
list add (data_object.travel_string_list, "forest")
msg ("You've discovered the forest! Now, you can travel to the forest and explore it!")
</item>
<item key="mountains_discovery">
list add (data_object.travel_string_list, "mountains")
msg ("You've discovered the mountains! Now, you can travel to the mountains and explore it!")
</item>
<item key="hills_discovery">
list add (data_object.travel_string_list, "hills")
msg ("You've discovered the hills! Now, you can travel to the hills and explore it!")
</item>
<item key="wasteland_discovery">
list add (data_object.travel_string_list, "wasteland")
msg ("You've discovered the wasteland! Now, you can travel to the wasteland and explore it!")
</item>
<item key="coastland_discovery">
list add (data_object.travel_string_list, "coastland")
msg ("You've discovered the coastland! Now, you can travel to the coastland and explore it!")
</item>
</homeland_events_script_dictionary>
</object>
<turnscript name="global_turnscript">
<enabled />
<script>
game.turns = game.turns + 1
</script>
</turnscript>
<function name="help_function">
msg ("Type 'explore' to explore your area.")
msg ("Type 'travel' to travel to different areas.")
</function>
<function name="explore_function"><![CDATA[
switch (game.pov.parent) {
case (homeland) {
result_1 = ListCount (data_object.homeland_events_string_list) - 1
if (result_1 >= 0) {
result_2 = StringListItem (data_object.homeland_events_string_list,GetRandomInt(0,result_1))
invoke (ScriptDictionaryItem (data_object.homeland_events_script_dictionary,result_2))
on ready {
foreach (item_x, split ("grassland_discovery;plains_discovery;desert_discovery;tundra_discovery;swampland_discovery;forest_discovery;mountains_discovery;hills_discovery;wasteland_discovery;coastland_discovery",";")) {
if (result_2 = item_x) {
list remove (data_object.homeland_events_string_list, result_2)
}
}
}
} else {
msg ("There seemingly is nothing left to explore in this area.")
}
}
}
]]></function>
<function name="travel_function">
show menu ("Where do you wish to travel?",data_object.travel_string_list,false) {
if (not game.pov.parent = GetObject (result)) {
game.pov.parent = GetObject (result)
} else {
msg ("You are already at this area.")
ask ("Try again?") {
if (result=true) {
travel_function
} else {
msg ("You realize that you need to discover a new area to travel to first, before you can travel to that place.")
}
}
}
}
</function>
</asl>
jaynabonne
27 Aug 2014, 12:42The post here was just about the effects *on the map* of jumps to rooms which are not immediately connected and haven't yet been visited. The only solution I know is to "pre-visit" all the rooms. I don't have a general solution for truly disconnected maps, short of using different z coordinates (that is, exits up or down).
There is no problem with such jumps normally. Unfortunately, the map generates map coordinates relatively as you move, so it has no ability to handle such jumps. It also doesn't work with room layout geometries that are not regular - exit lengths different in one direction than the other, exits that don't mirror each other (e.g. north to enter a room but west to exit), etc.
There is no problem with such jumps normally. Unfortunately, the map generates map coordinates relatively as you move, so it has no ability to handle such jumps. It also doesn't work with room layout geometries that are not regular - exit lengths different in one direction than the other, exits that don't mirror each other (e.g. north to enter a room but west to exit), etc.
Silver
27 Aug 2014, 14:11Oh cool. I'm not bothering with a map so not an issue.