this is quite a bit more advanced, using ~working with~ lists, but here we go!, hehe
for your request, you want to use: Object Lists, NOT String Lists !!!
http://docs.textadventures.co.uk/quest/ ... tions.htmlhttp://docs.textadventures.co.uk/quest/ ... lists.htmlhttp://docs.textadventures.co.uk/quest/ ... tlist.htmlhttp://docs.textadventures.co.uk/quest/ ... tlist.htmlhttp://docs.textadventures.co.uk/quest/ ... t_add.htmlhttp://docs.textadventures.co.uk/quest/ ... emove.htmlhttp://docs.textadventures.co.uk/quest/ ... count.htmlhttp://docs.textadventures.co.uk/quest/ ... tains.htmlhttp://docs.textadventures.co.uk/quest/ ... mbine.htmlhttp://docs.textadventures.co.uk/quest/ ... clude.htmlhttp://docs.textadventures.co.uk/quest/ ... titem.htmlhttp://docs.textadventures.co.uk/quest/ ... tsort.htmlhttp://docs.textadventures.co.uk/quest/ ... nding.htmlhttp://docs.textadventures.co.uk/quest/ ... reach.htmlhttp://docs.textadventures.co.uk/quest/scripts/for.htmlhttp://docs.textadventures.co.uk/quest/scopes.htmland the 'Gets' and "Alls' in the 'Functions' section~link of~for the wiki
http://docs.textadventures.co.uk/quest/ ... omint.htmlthe idea here is to add (and~or if you also want greater complexity to make them re-unaccessible: remove) the specific rooms that you want to now be 'accessible' to (or from) an ObjectList (as you make them accessible~unaccessible via within other 'event' scripting locations ~ means ~ methods), and ...
once you got this 'accessible room' ObjectList, then you can do the randomization iteration through it to choose one of the rooms that you'll go to.
so, for brief example:
game.accessible_rooms_objectlist = NewObjectList ()
list add (game.accessible_rooms_objectlist, room_1)
list add (game.accessible_rooms_objectlist, room_2)
etc etc etc
player.parent = ObjectListItem (game.access_rooms_objectlist, GetRandomInt (0, ListCount (game.access_rooms_objectlist) - 1))
about list index ordering:
Object_name.List_Attribute_name = split ("item1;item2;item3", ";")
example:
game.example_stringlist = split ("red;blue;yellow", ";")
0. red (item1)
1. blue (item2)
2. yellow (item3)
while 'yellow' is your 3rd item in the list, it's index catelog (think of like a library, such as organizing books alphabetically) ordering is actually '2', so if I want to get the 'yellow book' (yellow) from the 'library' (our list), I need to get 'book' (our item~Object~String of~witin the list) index of '2', NOT '3'
StringListItem (game.example_stringlist, 0) ====> red
StringListItem (game.example_stringlist, 1) ====> blue
StringListItem (game.example_stringlist, 2) ====> yellow
StringListItem (game.example_stringlist, 3) ====> ERROR, there is no 4th item!
ya, it's a bit confusing... starting at 0 instead of 1
and to add to the confusion...
ListCount (which we need to use for our randomization of dynamic lists to work), gets the quantity of items in the list: 3
however, for-with getting the specific item, we need it's index number:
[ListCount (game.example_stringlist) - 1] = 2 (index number)
[(3 items) - 1] = 2 (index number)
so... conceptually:
player.parent = ObjectListItem (game.accessible_rooms_objectlist, GetRandomInt (0, ListCount (game.accessible_rooms_objectlist) - 1) )
player.parent = ObjectListItem (game.accessible_rooms_object, GetRandomInt (0, your_counted_current_quantity_of_rooms_in_the_objectlist - 1) )
player.parent = ObjectListItem (game.accessible_rooms_object, GetRandomInt (0:index min, X:index max) )
player.parent = ObjectListItem (game.accessible_rooms_object, your_randomly_selected_item's_index_number_between_0_and_X)
player.parent = (your choosen~gotten Object ~ from using its randomly gotten index number in the above step)
player.parent = your_room_object_that_you're_moved_to
do you now understand this, or is it still confusing to you?
----------
here's many similiar things taking place:
---------
not sure if its compatible with the current version of quest, if you want to try to test~play~study it:
if you need help with any of this, let me know, and I'll help you do it
create a new game, go into the entire game code view, delete all of the code, copy and paste my code into it, and then just change the top-most codeline from this:
<asl version="540">
to this:
<asl version="550">
~ OR (not sure what version you're using, lol) ~
<asl version="560">
then, save your game file, and let me know if it works or not. If it doesn't, I'll get it converted so it'll work for you.
------------------
HK's 'explore' and 'travel' code (moving without using Exits):
(beware: along with lists, this also does use Dictionaries too, which are even more complex~confusing~difficult than are lists)
you 'explore' to discover a new location, and then once that location is discovered, you can then select to 'travel' to that location.
(the code is a bit poor~a bit extra complexity than it needed, I could make it better ~ just too lazy to do so lol, but it's functional)
<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>