You'll probably need my help with this (and in changing it to your "car" design), but I'm busy until Feb. 14 and can't help you, so you can look over this and see if you can make sense of it (it uses lists and dictionaries which can be daunting for new people), and~or ask someone to help you with my code, or they can just help you themselves with their code or help you via the GUI~Editor.
anyways, here's my own amature "travel" code:
<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>
feel free to try~test~play this code~"game" out (look at it in the GUI~Editor, if the code is still too hard for you to understand)
basicallly, you 'explore' (my 'explore' command-function), which randomly chooses an 'event' (a script), which adds that Room Object to your 'travel' list, which you can now move to, using my 'travel' command-function. Now, I got to remove those 'discovery events' (scripts), so they don't occur again, by removing them from the 'explore' list (which is the most complex part of my code, due to using random'ness method of seleting the events), and the 'travel' command-function is, I hope, self-explanatory.
I wrote this code a ways back, and I'm sure I could make it better (shorter code and a more clear~clean code), using script dictionaries, which I didn't realize at the time I did this code.
---------------
http://quest5.net/wiki/Using_Listshttp://quest5.net/wiki/Using_Dictionaries--------------
http://quest5.net/wiki/Foreachwhen you use the "foreach" function, it creates a variable that is set to the contents of the "foreach" string list or object list.
so the "o" (likely stands for "object", other common labels: obj, or my own structure of: adding a "_x" suffix, ie: object_x, item_x, result_x, value_x, and etc), is just that variable.
also, most people don't use "object" as their foreach iteration variable, as it may have conflict with the built-in "object" stuff, or it's just too confusing too, or they're just lazy, as writing "o" or "obj" or "i" (for "item") or "x", is faster, lol.
(object or string) list: soccer ball; football ball; baseball ball; basketball ball
foreach (object_x, global_data_object.sports_ball_object_list) {
-> object_x.play_with
}
conceptually:
for "soccer ball (object_x)", "play with (Verb)" the "soccer ball (object_x)"
for "football ball (object_x)", "play with (Verb)" the "football ball (object_x)"
for "baseball ball (object_x)", "play with (Verb)" the "baseball ball (object_x)"
for "basketball ball (object_x)", "play with (Verb)" the "basketball ball (object_x)"
here's a good example of concept of understanding the "foreach" list iteration function:
foreach (team_member_x, global_data_object.team_members_string_list) {
-> team_member_x.run_four_laps
}
// 'all=every=each' (for*EACH*) team member (team_member_x) of the 'team' (team_members_string_list), has to run 4 laps
---------
http://quest5.net/wiki/For(lists start from 0, not 1)
(ordering is from left to right)
(soccerball;football;baseball;basketball)
list content 0 = soccerball
list content 1 = football
list content 2 = baseball
list content 3 = basketball
for (object_x, 1,1,1) {
-> object_x.play_with
}
// soccerball
for (object_x, 0,1,1) {
-> object_x.play_with
}
// soccerball and football
for (object_x, 0,2,1) {
-> object_x.play_with
}
// soccerball, football, and baseball
for (object_x, 0,2,2) {
-> object_x.play_with
}
// soccerball and baseball
for (object_x, 1,3,1) {
-> object_x.play_with
}
// football, baseball, and basketball
for (object_x, 1,3,2) {
-> object_x.play_with
}
// football and basketball
for (object_x, 0,3,4) {
-> object_x.play_with
}
// soccer and basketball
----------
by setting ("attaching") an Attribute to an Object, it enables the Attribute to be "permanent~global" ("save'able and load'able").
And, also, if you set the Attribute specifically to the "game" Game Object or to the "player" Player Object or "whatever" Player Object, then you can display those Attributes during game play, via the "status attributes" Attribute (which only works for the "game" Game Object, the "player" Player Object, and "whatever" Player Object).