Mission Coding for Dummies - Menus

A Tutorial for Grand Theft Auto: San Andreas

Attention Gamer! We are one of the oldest mod sites on the Interwebs. Sign up and maximize your browsing experience.

  • Subscribe: Get notified of new submissions like this.
  • Say Thanks: Show your appreciation by sending Arman Ossi Loko points.
  • Post: Give Arman Ossi Loko your thoughts on this Tutorial.
  • Vote: Help Arman Ossi Loko win the Monthly Awards.
  • Rate: Give this Tutorial a rating out of 10.
  • Flag: Alert moderators and warn members of a problem with this Tutorial.
  • Watch: Get notified when this Tutorial is updated.
Mascot

Stop Lurking!

Sign up

Already a Bananite? Login

Menus In this tutorial we will use a screen, to illustrate the text. It is the "Main Panel" of the Design Your Own Mission mod. ![](http://img21.imageshack.us/img21/9830/menunup.th.jpg "") CODE 0512: show_permanent_text_box 'CLOTHA' This is de text at the top on the left, for example "press space to continue". It is the red outlined part of the screen. CODE 08D4: $MENU = create_panel_with_title 'DUMMY' position 29.0 145.0 width 220.0 columns 1 interactive 1 background 1 alignment 1 With this code you create the menu. You have to give the menu a name (variable/handle), so you can do things with it later on. Further, you have to give it a title. DUMMY means that you don't want text on that place ingame. If you want that the menu has a title, you have to place a text-id instead of 'DUMMY'. This is the blue outlined part of the screen. CODE 08DB: set_panel $MENU column 0 header 'DUMMY' data 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' First you have to give it a header, the yellow outlined part. Then, you can add things that the player can choose. One of those things is the pink outlined part of the screen. There are two ways to go on from here, but I will explain the easiest. I have to admit that I use this way most of the time. CODE repeat wait 0 ms if 00E1: player 0 pressed_key 15 then 08DA: remove_panel $MENU 03E6: remove text box jump @END end until 00E1: player 0 pressed_key 16 This is a repeat-wait-until structure, so the game repeats everything between repeat and until until the the condition is true. In this case, the code will repeat it until the player pressed key 16 (SPACE). When the player presses 15 (ENTER/F) before the player presses SPACE, you want to remove th menu, so you have to remove the panel and the text box. After that, you have to jump to the end (or the beginning, just wat you want). CODE 08D7: $choice = panel $MENU active_row 08DA: remove_panel $MENU 03E6: remove text box After the player pressed SPACE, the panel and text box has to be removed. Apart from that, you have to look what the player has chosen. You can do that with the 08D7 opcode, where you check which was the latest active row before you remove the panel. Finally you have to say what happens when a player chooses. Be aware: it starts with 0, not 1! CODE > if $choice == 0 then ... end if $choice == 1 then ... end You have to do the if-then-end structure as many times as you have choices. For example, if you have 5 choices, the code has to be from 0 to 4. So the total code for a menu: CODE > 08D4: $MENU = create_panel_with_title 'DUMMY' position 29.0 145.0 width 220.0 columns 1 interactive 1 background 1 alignment 1 08DB: set_panel $MENU column 0 header 'DUMMY' data 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' repeat wait 0 ms if 00E1: player 0 pressed_key 15 then 08DA: remove_panel $MENU 03E6: remove text box jump @END end until 00E1: player 0 pressed_key 16 08D7: $choice = panel $MENU active_row 08DA: remove_panel $MENU 03E6: remove text box if $choice == 0 then ... end if $choice == 1 then ... end :END wait 1000 jump @END

Posts

None found

Share

Shareable Image:
Share banner
HTML embed code:
BB embed code:
Markdown embed code:

More embeddable images

Bookmark and Share

Credits

Original Authors
Dutchy3010

Submitter

Arman Ossi Loko avatar
Arman Ossi Loko avatar Lurkin'
Admin Joined 10y
71,925 points Ranked 56th
63 medals 9 legendary 16 rare
  • GTAV First Adopter Medal icon
  • Submitted 15 Tools Medal icon
  • Submitted 30 Tutorials Medal icon
  • 1st place - 2015 Uberstyles Contest Medal icon
  • Achieved Admin clearance Medal icon
  • 15+ Entries! GameBanana’s Christmas Giveaway 2015 Medal icon

Arman Ossi Loko avatar
Arman Ossi Loko
KOPASSUS Incorporated Flag
KOPASSUS Incorporated

Redistributor
Are you the owner? Request Ownership
Sign up to access this!
Sign up to access this!
Sign up to access this!
Sign up to access this!

Category

Details

Difficulty Level
Beginner Difficulty

Attributes

Stats

Posts
0
Views
2,057
Date Added
5y
Date Modified
4y
bcp.crwdcntrl.net tracking pixel