Map Menu

Brandon 10
09 Oct 2016, 04:59Ello everyone.
So far, I'm up to the part of my game where the player is in a sort of hub area where they can explore around. It's a spaceship so I wanted the player to be able to take control of the ship in order to travel between destinations to get to another stage. I know I can set the pilot seat to move the player to the next destination but I wanted to make a menu or a map that shows all the locations you can travel to and by typing one in or clicking on it, the ship will travel there.
For example: The current map would say Earth and possible destinations could be Sample City and Space. If you enter Sample City, you would travel to Sample City and leave the menu. If you enter Space, you would travel to outer space and a new menu would open showing more locations (like planets and such). And entering one of those locations would be the same as the Sample City example.
Would it be possible to add this type of concept into my game? Any help would be appreciated, thank you.

onimike
09 Oct 2016, 05:12You could do both! One make you map and label them with name in there locations and save as jpg. Then you setup your menu like this.
mapmenu= NewStringList()
list add (mapmenu, "Starsystem1")
list add (mapmenu, "Starsystem2")
list add (mapmenu, "Starsystem3")
ShowMenu ("Choose your class...", mapmenu, true) {
msg ("You choose " +result+".")
if (result<>null) {
if (result = "Starsystem1") {
Ask ("Are you sure you want to be a " +result+"?") {
if (result = True) {
MoveObject (player, Starsystem1)
}
else if (result = False) {
mapmenu
}
}
}
else if (result = "Starsystem2") {
Ask ("Are you sure you want to be a " +result+"?") {
if (result = True) {
Ask ("Are you sure you want to be a " +result+"?") {
if (result = True) {
MoveObject (player, Starsystem2)
}
else if (result = False) {
mapmenu
}
}
}
else if (result = "Starsystem3") {
Ask ("Are you sure you want to be a " +result+"?") {
if (result = True) {
Ask ("Are you sure you want to be a " +result+"?") {
if (result = True) {
MoveObject (player, Starsystem3)
}
else if (result = False) {
mapmenu
}
}
}
}
else {
msg ("You choose to cancel..")
}
}
First call your map so 'ShowPicture' Then call menu! This way you can see the map and choose a location you want to goto.
Let me know if you need help or if it not working. I Also do GUI Editor Tutorials here https://www.youtube.com/channel/UCGSCL0CED0oIG8J1mKyDoMw where I show you how to make menus, weapons and more.
Mike
hegemonkhan
09 Oct 2016, 05:39this is a bit more advanced, as it uses Lists+Dictionaries, but here it is if you want to take a look at it (the code is old, so it's a bit poor/inefficient due to this being done way back when, when I was learning it for my first time):
http://textadventures.co.uk/forum/samples/topic/5138/explore-and-travel-code-sample-by-hk
http://textadventures.co.uk/forum/samples/topic/5137/list-and-dictionary-extensive-guide-by-hk
feel free to ask about anything, if you need help
The Pixie
09 Oct 2016, 07:41What you could do is use SVG to create the star map in game. That way the map could change as the player progresses, for example, new destinations appear. Also, the player could click a destination on the map to select it.
I had a play around doing something similar, but for a strategy game (go to the Stars and Planets section):
http://textadventures.co.uk/games/view/ohqyc_lfuuiqjsuwmvbkbw/star-empire-v0-1
It is not trivial, but the basic principles are here:
https://github.com/ThePix/quest/wiki/UI-Part-10:-Creating-images-on-the-fly

Brandon 10
15 Oct 2016, 03:50Thanks everyone for the help so far. I tried entering your code, Mike, but it didn't seem to work for me. So far, my code input feature has been acting up when I add large amounts of code.
I'm also having a bit of hard time understanding the rest (explore and travel code, creating images, etc) but I probably just need more time to understand it.
hegemonkhan
15 Oct 2016, 07:30hopefully, here's a pseudo-working example (I tried to keep it as simple I could) for you, which hopefully you can understand and adjust/apply/implement it for your own game:
(you probably want to change my use of 'enter' and 'exit' for the script/verb names as these are probably used for/with the built-in stuff, which you don't want to be over-writing!)
for my 'spaceship_type' (Object Type's / Type's) 'warp' Script Attribute (attr)/Verb:
'show menu (xxx)' produces the popup window menu (clickable choices/options in the popup window) // I used this in my code below
'ShowMenu (xxx)' produces the in-line menu (choices/options as clickable hyperlinks in the big text box) // so, if you want this instead, then just change the 's' and 'm' to uppercase and delete the space between the 'w' and 'm', in my code below
<asl version="550">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="example">
<gameid>xxx</gameid>
<version>1.0</version>
<firstpublished>2016</firstpublished>
<attr name="pov" type="object">player</attr>
</game>
<object name="room_0_object">
<attr name="alias" type="string">Hyperspace</attr>
<attr name="explorable_boolean_attribute" type="boolean">false</attr>
<attr name="travel_objectdictionary_attribute" type="objectdictionary">Sun = room_1_object; DarkSun = room_4_object</attr>
</object>
<object name="room_1_object">
<attr name="alias" type="string">Sun</attr>
<attr name="explorable_boolean_attribute" type="boolean">false</attr>
<attr name="travel_objectdictionary_attribute" type="objectdictionary">Hyperspace = room_0_object; Earth = room_2_object; Mars = room_3_object</attr>
</object>
<object name="room_2_object">
<attr name="alias" type="string">Earth</attr>
<attr name="explorable_boolean_attribute" type="boolean">true</attr>
<attr name="travel_objectdictionary_attribute" type="objectdictionary">Sun = room_1_object; Mars = room_3_object</attr>
</object>
<object name="room_3_object">
<attr name="alias" type="string">Mars</attr>
<attr name="explorable_boolean_attribute" type="boolean">true</attr>
<attr name="travel_objectdictionary_attribute" type="objectdictionary">Sun = room_1_object; Earth = room_2_object</attr>
</object>
<object name="room_4_object">
<attr name="alias" type="string">DarkSun</attr>
<attr name="explorable_boolean_attribute" type="boolean">false</attr>
<attr name="travel_objectdictionary_attribute" type="objectdictionary">Hyperspace = room_0_object; DarkEarth = room_5_object; DarkMars = room_6_object</attr>
</object>
<object name="room_5_object">
<attr name="alias" type="string">DarkEarth</attr>
<attr name="explorable_boolean_attribute" type="boolean">true</attr>
<attr name="travel_objectdictionary_attribute" type="objectdictionary">DarkSun = room_4_object; DarkMars = room_6_object</attr>
</object>
<object name="room_6_object">
<attr name="alias" type="string">DarkMars</attr>
<attr name="explorable_boolean_attribute" type="boolean">true</attr>
<attr name="travel_objectdictionary_attribute" type="objectdictionary">DarkSun = room_4_object; DarkEarth = room_5_object</attr>
</object>
<object name="player">
<attr name="parent" type="object">room_2_object</attr>
</object>
<object name="spaceship_1_object">
<inherit name="spaceship_type" />
<attr name="parent" type="object">room_2_object</attr>
</object>
<type name="spaceship_type">
<attr name="alias" type="string">spaceship</attr>
<attr name="warp" type="script">
show menu ("Destination?", this.parent.travel_objectdictionary_attribute, false) {
this.parent = ObjectDictionaryItem (this.parent.travel_objectdictionary_attribute, result)
}
</attr>
<attr name="enter" type="script">
if (game.pov.parent = this.parent) {
game.pov.parent = this
} else {
msg ("You can't enter the spaceship at this location or you're already inside the spaceship")
}
</attr>
<attr name="exit" type="script">
if (game.pov.parent = this and this.parent.explorable_boolean_attribute) {
game.pov.parent = this.parent
} else {
msg ("You can't exit the spaceship at this location or you're already outside of the spaceship")
}
</attr>
</type>
<verb>
<property>warp</property>
<pattern>warp</pattern>
<defaultexpression>You can't warp to that location!</defaultexpression>
</verb>
<verb>
<property>enter</property>
<pattern>enter</pattern>
<defaultexpression>You can't enter that!</defaultexpression>
</verb>
<verb>
<property>exit</property>
<pattern>exit</pattern>
<defaultexpression>You can't exit that!</defaultexpression>
</verb>
</asl>
P.S.
you can take a look at this stuff too, to hopefully at least get an idea on some custom/manual-creation of menu stuff even if you don't understand it well/fully --- as it too is advanced stuff:
http://textadventures.co.uk/forum/samples/topic/4988/character-creation-crude-code-and-sample-game
this is a good guide for learning the basics of using menus and getting user input:
http://docs.textadventures.co.uk/quest/guides/character_creation.html
ask, if you have any questions.