Quantcast
Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
    1. Welcome to GTAForums!

    1. Red Dead Redemption 2

      1. PC
      2. Gameplay
      3. Missions
      4. Help & Support
    2. Red Dead Online

      1. Gameplay
      2. Find Lobbies & Outlaws
      3. Help & Support
      4. Frontier Pursuits
    1. Crews & Posses

      1. Recruitment
    2. Events

    1. GTA Online

      1. Diamond Casino & Resort
      2. DLC
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Grand Theft Auto Series

    3. GTA 6

    4. GTA V

      1. PC
      2. Guides & Strategies
      3. Help & Support
    5. GTA IV

      1. Episodes from Liberty City
      2. Multiplayer
      3. Guides & Strategies
      4. Help & Support
      5. GTA IV Mods
    6. GTA Chinatown Wars

    7. GTA Vice City Stories

    8. GTA Liberty City Stories

    9. GTA San Andreas

      1. Guides & Strategies
      2. Help & Support
      3. GTA SA Mods
    10. GTA Vice City

      1. Guides & Strategies
      2. Help & Support
      3. GTA VC Mods
    11. GTA III

      1. Guides & Strategies
      2. Help & Support
      3. GTA III Mods
    12. Top Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    13. Wiki

      1. Merchandising
    1. GTA Modding

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Mod Showroom

      1. Scripts & Plugins
      2. Maps
      3. Total Conversions
      4. Vehicles
      5. Textures
      6. Characters
      7. Tools
      8. Other
      9. Workshop
    3. Featured Mods

      1. DYOM
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Red Dead Redemption

    2. Rockstar Games

    1. Off-Topic

      1. General Chat
      2. Gaming
      3. Technology
      4. Programming
      5. Movies & TV
      6. Music
      7. Sports
      8. Vehicles
    2. Expression

      1. Graphics / Visual Arts
      2. GFX Requests & Tutorials
      3. Writers' Discussion
      4. Debates & Discussion
    1. News

    2. Forum Support

    3. Site Suggestions

PatrickW

Custom Ingame menu

Recommended Posts

PatrickW

This posting will present all the new opcodes to create ingame menu's

 

I've coined the name "panel" for these things, as they are not only used to display ingame menu's (like in ammunations, mod-chops ) but also to display static/dynamic information ( e.g. during missions).

 

A panel consists of one or more columns of information, and can contain upto 12 rows of data.

 

Here's a screen from a custom menu ( still needs some good texts) that I'm working on for my new mod:

user posted image

 

Here's a listing of all the opcodes involved in panels:

 

08d4=9, Create_panel

param 1: title, displayed in the SA font at the top of the panel

param 2: left panel position ( for some reason a float)

param 3: top panel position ( for some reason a float)

param 4: width ( for some reason a float)

param 5: number of columns

param 6: interactive-flag, if set the panel acts as a menu, with a row selected

param 7: background-flag, panel has a dark background

param 8: default alignment of text ( 0=centre, 1=left, 2=right)

param 9: handle, the created panel

 

08da=1,Remove_panel

param 1: handle of the panel to be removed

 

08db=15,Set_panel_column_data

param 1: handle of the panel

param 2: column number [0,1,2.......]

param 3: column header

param 4..5: column_data

 

08ee=5,Set_panel_data_text1

param 1: handle of the panel

param 2: column number [0,1,2.......]

param 3: row number [0..11]

param 4: column data text

param 5: column data int argument

 

08ef=6,Set_panel_data_text2

param 1: handle of the panel

param 2: column number [0,1,2.......]

param 3: row number [0..11]

param 4: column data text

param 5: column data int argument 1

param 6: column data int argument 2

 

09db=3,Set_panel_column_width

param 1: handle of the panel

param 2: column number [0,1,2.......]

param 3: column width ( this time it's an int )

 

08d6=3,Set_panel_column_alignment

param 1: handle of the panel

param 2: column number [0,1,2.......]

param 3: alignment of text ( 0=centre, 1=left, 2=right)

 

08d9=3,Set_panel_row_enable

param 1: handle of the panel

param 2: row number [0..11]

param 3: 0->disabled, 1->enabled

 

090e=2,Set_panel_active_row

param 1: handle of the panel

param 2: row number [0..11]

 

08d7=2,Get_panel_active_row

param 1: handle of the panel

param 2: variable to receive the row number [0..11]

 

08d8=2,Get_panel_selected_row

param 1: handle of the panel

param 2: variable to receive the row number [0..11]

 

 

The difference between the last two opcodes, is not completely clear. the first one is used, while the "select"-key (spacebar) is still pressed, and the latter is used after it has been released again. This is how R* code uses them.

 

A simple example of a menu with three items

 

0512: permanent text box 'CLOTHA' 01B4: set player $PLAYER_CHAR frozen state  0 (frozen)08D4: 'DNC_019' 29.0 145.0 200.0 2 1 1 1 $my_panel  08DB: $my_panel  0 'MTOR02C' 'IE1' 'IE2' 'IE3' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY'   :keywait0001: wait  0 ms if 000E1:   key pressed  0  15jf ��test_select    ;;-------------------------; menu aborted;;-------------------------08DA: $my_panel 03E6: remove text box01B4: set player $PLAYER_CHAR frozen state  1 (unfrozen)jump ��the_end          :test_selectif 000E1: key pressed  0  16jf ��keywait  ;;--------------------------; item selected;;--------------------------08D7: $my_panel $choice 08DA: $my_panel 03E6: remove text box; do someting useful with $choice:the_end

 

 

 

 

 

 

 

Edited by PatrickW

Share this post


Link to post
Share on other sites
DexX

excellent work patrick smile.gif

 

now, time to change the font of that "The master!" text... biggrin.gif

Share this post


Link to post
Share on other sites
Eclipse_nl
Nice Patrick smile.gif ...I'm going to play with it.

Share this post


Link to post
Share on other sites
Timonator

good work patrick i can use that:)

Share this post


Link to post
Share on other sites
MrTi

awesome find, patrick. gonna implement this in some of my mods.

Share this post


Link to post
Share on other sites
Quadropheniac90

Just one question: What do you do with choice? Do I have to make an if-check like:

 

:Choice1

00D6: if 0

CODE: $choice == 0 (The first row)

CODE: jump_if_false Choice2

0001: wait 0 ms

CODE: create_car #BANSHEE

CODE: end_thread

 

:Choice2

00D6: if 0

CODE: $choice == 1 (The second row)

CODE: jump_if_false Choice3

0001: wait 0 ms

CODE: create_car #BULLET

CODE: end_thread

 

Etcetera...

 

Or something else? confused.gif

Share this post


Link to post
Share on other sites
PatrickW
Just one question: What do you do with choice? Do I have to make an if-check like:

 

:Choice1

00D6: if 0

CODE: $choice == 0 (The first row)

CODE: jump_if_false Choice2

0001: wait 0 ms

CODE: create_car #BANSHEE

CODE: end_thread

 

:Choice2

00D6: if 0

CODE: $choice == 1 (The second row)

CODE: jump_if_false Choice3

0001: wait 0 ms

CODE: create_car #BULLET

CODE: end_thread

 

Etcetera...

 

Or something else? confused.gif

That completely depends on your mod, if you only have two or three choices, your method will do, but when you get to a situation where you have more choices there are two prefered alternatives:

* Use the jumptable opcodes (0871&0872), which basicly implements a switch-statement ( as availabl in most proper programming languages:

something like this

switch($choice) {case 0:   jump ££label_for0   break;case 1:   jump ££label_for1   break;case 2:   jump ££label_for2   break;default:   jump ££label_for_default   break;}

 

 

would lead to the following opcode:

 

0871: init_jump_table $choice total_jumps  3  1 ££label_for_default jumps  0 ££label_for0 1 ££label_for1  2 ££label_for2  0 -1 0 -1  0 -1  0 -1 

 

params:

1 : switch variable

2 : number of regular cases

3 : default availalble flag (if default case is not needed, this is 0 )

4 : jump label for the default case

5 : case-value for the first case

6 : jump_label for the first case

7-18 : case-value/jump_labe; pairs for the other cases.

 

If there are more than 7 cases, the rest of the cases should be given in subsequent 0872: opcodes, which can hold opto 9 case-value/jump_label pairs.

 

 

* a second method of using the $choice, would be to use it as an index for an array.

 

 

 

Hope this helps you further...

Share this post


Link to post
Share on other sites
Quadropheniac90

Thanks, am0n, that really helps!

 

Does the Menu Title have to be in the .gxt file?

Share this post


Link to post
Share on other sites
am0n
Thanks, am0n, that really helps!

 

Does the Menu Title have to be in the .gxt file?

yes smile.gif

Share this post


Link to post
Share on other sites
Quadropheniac90

Yay, the menu works, now I just have to get a piece of code which lets the game do something when an option is selected... Dunno how to continue the thread, do I have to change this:

 

 

:CUSTOM_MENU_6; selected button 'OPTION1' (0)0002: jump ££CUSTOM_MENU_END

 

 

to this:

 

 

:CUSTOM_MENU_6; selected button 'OPTION1' (0)0002: jump ££CUSTOM_MENU_END0002: jump ££CUSTOM_MENU_CHOICE1

 

 

or something?

Share this post


Link to post
Share on other sites
am0n
Yay, the menu works, now I just have to get a piece of code which lets the game do something when an option is selected... Dunno how to continue the thread, do I have to change this:

 

 

:CUSTOM_MENU_6; selected button 'OPTION1' (0)0002: jump ££CUSTOM_MENU_END

 

 

to this:

 

 

:CUSTOM_MENU_6; selected button 'OPTION1' (0)0002: jump ££CUSTOM_MENU_END0002: jump ££CUSTOM_MENU_CHOICE1

 

 

or something?

 

example :

 

:CUSTOM_MENU_6; selected button 'OPTION1' (0)00A1: put_actor $PLAYER_ACTOR at  428.3045 2536.698  16.375520002: jump ££CUSTOM_MENU_END

 

Share this post


Link to post
Share on other sites
Quadropheniac90
OK, thanks. Still need to sort some sh*t out...

Share this post


Link to post
Share on other sites
am0n
Ok so what's wrong with my code? I'm a newbye at coding but i tried to do my best and still can't find whats wrong ... the game just crashes ... oh and about all those threads well i wanted to show where i put my create_thread is it there were it should be ? (MAIN) ... or is that what's wrong ... ?

Please help me

Thanks

It seems that you pasted the _whole_ code at the MAIN part of script; only 'create_thread' part belongs there, move everything else outside, ie. at the end of script.

Share this post


Link to post
Share on other sites
AmonRa

is it possible to create a menu with the options to type in values?

like number of ammo or even coords

Share this post


Link to post
Share on other sites
PatrickW

Nope, there is no easy data entry method for the menu, of course you could use the method used to determine the bet-amount in casino's. And there's also some data-entry code in the high-score handling of the ingame video-games, but these are very complicated to code.

 

Share this post


Link to post
Share on other sites
AmonRa

well as my father (and half of mankind) used to (and still) say little is better then nothing

thanks

Share this post


Link to post
Share on other sites
spaceeinstein
09d6=3,Set_panel_column_alignment

param 1: handle of the panel

param 2: column number [0,1,2.......]

param 3: alignment of text ( 0=centre, 1=left, 2=right)

 

09d6=3,Set_panel_row_enable

param 1: handle of the panel

param 2: row number [0..11]

param 3: 0->disabled, 1->enabled

Uhhh... Wtf?

Share this post


Link to post
Share on other sites
spaceeinstein
Maybe I wasn't clear but those two opcodes above me are wrong.

Share this post


Link to post
Share on other sites
Craig Kostelecky

Well, what's wrong with them? Are they incorrectly named? Or are the parameters wrong? You didn't really elaborate at all (even in your second post) about why it's wrong. dontgetit.gif

Share this post


Link to post
Share on other sites
spaceeinstein

blink.gif How can you not see it?

09d6=3,Set_panel_column_alignment

09d6=3,Set_panel_row_enable

They are the same, and 09d6 has 5 params.

Share this post


Link to post
Share on other sites
Un3462

in my ini i have

08d6=3,set_panel_col_alignment

08d9=3,set_panel_row_enabled

but that might be an incorrect guess.

Share this post


Link to post
Share on other sites
PatrickW

Thanks for spotting those space-einstein. cookie.gif

The ones that CyQ ( cookie.gif ) listed are indeed the correct ones..

 

So much for ctrl-C/ctrl-V being a handy tool suicidal.gif

 

I've corrected the first post..

 

Share this post


Link to post
Share on other sites
Quadropheniac90
How many 'options' can the menu have? Edited by teun.steenbekkers

Share this post


Link to post
Share on other sites
GTASan Andreas CJ Rules

can sum1 like explain this is in n00b format. (i can spawn cars tho)

Share this post


Link to post
Share on other sites
GTASan Andreas CJ Rules

any1

Share this post


Link to post
Share on other sites
Demarest

No. It's already as simple as it can get. If that's above your coding level, then either develop your skills, get somebody to do it for you, or abandon the idea.

 

Of course, if you just explained which part you feel is over your head, maybe somebody would be better able to explain it. Just saying you'd like it in newbie terms doesn't get you anywhere.

Share this post


Link to post
Share on other sites
Eclipse_nl
How many 'options' can the menu have?

11 options

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • 1 User Currently Viewing
    0 members, 0 Anonymous, 1 Guest

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.