IMG

 
IMG
IMG   IMG
  Welcome to GTAForums! Be sure to check out the Grand Theft Auto V Forum.

You are not registered! (If you are, click here to login) Registering is fast, free and easy and allows you to instantly reply to any topic on GTAForums.
Why wait? Click here to register your own unique username and become part of the ever-growing community!


( Log In | Register | Revalidate Validation E-mail )
Quick Log-In:
  IMG
       
>
Forum Rules GTA Modification Forums

Please post mod releases in the Mod Showroom

GTAGarage.com
free mod hosting from GTANet, simply login with your GTAForums account details

GTAModding.com
GTANet's modding wiki

GTA Modding Chatroom
provided by irc.gtanet.com (Don't have an IRC client? Click here)


Pages: (2) [1] 2   ( Go to first unread post ) Reply to this topicStart new topicStart Poll

 Custom Ingame menu

 New opcodes and their usage
 
PatrickW  
Posted: Wednesday, Jun 29 2005, 01:28
Quote Post


GTA Juggernaut
Group Icon
Group: Moderators
Joined: Jan 7, 2004

nl.gif

Member Award





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
CODE

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'  

:keywait
0001: wait  0 ms
if 0
00E1:   key pressed  0  15
jf ��test_select    
;;-------------------------
; menu aborted
;;-------------------------
08DA: $my_panel
03E6: remove text box
01B4: set player $PLAYER_CHAR frozen state  1 (unfrozen)
jump ��the_end          
:test_select
if 0
00E1: key pressed  0  16
jf ��keywait  
;;--------------------------
; item selected
;;--------------------------
08D7: $my_panel $choice
08DA: $my_panel
03E6: remove text box

; do someting useful with $choice


:the_end








This post has been edited by PatrickW on Saturday, Aug 20 2005, 05:25
Users WebsitePM
  Top
 

 
DexX  
Posted: Wednesday, Jun 29 2005, 02:29
Quote Post


Black Hat
Group Icon
Group: Retired Staff
Joined: May 16, 2002

Member Award




excellent work patrick smile.gif

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

 
Eclipse_nl  
Posted: Wednesday, Jun 29 2005, 19:15
Quote Post


Grand Tani Islands
Group Icon
Group: Members
Joined: Sep 11, 2004

nl.gif

XXXXX



Nice Patrick smile.gif ...I'm going to play with it.
Users WebsitePMMSN
  Top
 

 
Timonator  
Posted: Wednesday, Jun 29 2005, 19:36
Quote Post


Player Hater
Group Icon
Group: Members
Joined: Jun 29, 2005

XXXXX



good work patrick i can use that:)
PM
  Top
 

 
MrTi  
Posted: Wednesday, Jun 29 2005, 20:05
Quote Post


Crackhead
Group Icon
Group: Members
Joined: Jun 7, 2003

us.gif

XXXXX



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

 
teun.steenbekkers  
Posted: Sunday, Jul 10 2005, 21:46
Quote Post


Confused Clown
Group Icon
Group: Andolini Mafia Family
Joined: Feb 15, 2005

nl.gif

XXXXX



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
Users WebsitePM
  Top
 

 
PatrickW  
Posted: Sunday, Jul 10 2005, 22:31
Quote Post


GTA Juggernaut
Group Icon
Group: Moderators
Joined: Jan 7, 2004

nl.gif

Member Award




QUOTE (teun.steenbekkers @ Jul 10 2005, 23:46)
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
CODE

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:
CODE

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...
Users WebsitePM
  Top
 

 
am0n  
Posted: Wednesday, Jul 13 2005, 05:49
Quote Post


Player Hater
Group Icon
Group: Members
Joined: Jan 16, 2005

XXXXX



PM
  Top
 

 
teun.steenbekkers  
Posted: Wednesday, Jul 13 2005, 07:56
Quote Post


Confused Clown
Group Icon
Group: Andolini Mafia Family
Joined: Feb 15, 2005

nl.gif

XXXXX



Thanks, am0n, that really helps!

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

 
am0n  
Posted: Wednesday, Jul 13 2005, 08:20
Quote Post


Player Hater
Group Icon
Group: Members
Joined: Jan 16, 2005

XXXXX



QUOTE (teun.steenbekkers @ Jul 13 2005, 07:56)
Thanks, am0n, that really helps!

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

yes smile.gif
PM
  Top
 

 
teun.steenbekkers  
Posted: Wednesday, Jul 13 2005, 08:27
Quote Post


Confused Clown
Group Icon
Group: Andolini Mafia Family
Joined: Feb 15, 2005

nl.gif

XXXXX



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:

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


to this:

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


or something?
Users WebsitePM
  Top
 

 
am0n  
Posted: Wednesday, Jul 13 2005, 08:34
Quote Post


Player Hater
Group Icon
Group: Members
Joined: Jan 16, 2005

XXXXX



QUOTE (teun.steenbekkers @ Jul 13 2005, 08:27)
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:

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


to this:

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


or something?


example :
CODE
:CUSTOM_MENU_6
; selected button 'OPTION1' (0)
00A1: put_actor $PLAYER_ACTOR at  428.3045 2536.698  16.37552
0002: jump ££CUSTOM_MENU_END
PM
  Top
 

 
teun.steenbekkers  
Posted: Wednesday, Jul 13 2005, 08:37
Quote Post


Confused Clown
Group Icon
Group: Andolini Mafia Family
Joined: Feb 15, 2005

nl.gif

XXXXX



OK, thanks. Still need to sort some sh*t out...
Users WebsitePM
  Top
 

 
virlan2004  
Posted: Wednesday, Jul 13 2005, 13:10
Quote Post


Player Hater
Group Icon
Group: Members
Joined: May 9, 2005

ro.gif

XXXXX



<Sorry for my english but i'm Romanian>

-------------------------------------------------------------------------
004F: create_thread ££Labelmenu1_1
00D7: create_thread_with_wasted_busted_check ££LITCAS_42
00D7: create_thread_with_wasted_busted_check ££PROJECT_237
00D7: create_thread_with_wasted_busted_check ££BBCHAL_336
00D7: create_thread_with_wasted_busted_check ££LOWGAME_1139
00D7: create_thread_with_wasted_busted_check ££CLEANAU_16
00D7: create_thread_with_wasted_busted_check ££BDISPLY_289
00D7: create_thread_with_wasted_busted_check ££APCHECK_1
00D7: create_thread_with_wasted_busted_check ££GFINIT_1
00D7: create_thread_with_wasted_busted_check ££GFAGNT_1733
00D7: create_thread_with_wasted_busted_check ££INTMAN_533
00D7: create_thread_with_wasted_busted_check ££A_TERM_5
00D7: create_thread_with_wasted_busted_check ££CELLFON_1
016A: fade 0 () 0 ms
09BA: 0
0001: wait 0 ms
0001: wait 0 ms
03B7: process_cut_scene_only 0 (true)
0169: set_fade_color 0 0 0
0001: wait 2000 ms
03B7: process_cut_scene_only 1 (false)
01F0: set_max_wanted_level_to 4
00D6: if 0
0256: player $PLAYER_CHAR defined
004D: jump_if_false ££MAIN_391
01B6: set_weather 1
087B: set_player $PLAYER_CHAR clothes "VEST" "VEST" 0
087B: set_player $PLAYER_CHAR clothes "JEANSDENIM" "JEANS" 2
087B: set_player $PLAYER_CHAR clothes "SNEAKERBINCBLK" "SNEAKER" 3
087B: set_player $PLAYER_CHAR clothes "PLAYER_FACE" "HEAD" 1
0004: $2549 = 1 ;; integer values
070D: $PLAYER_CHAR
0793: (unknown)
0169: set_fade_color 0 0 0
016A: fade 0 () 0 ms
0004: $24 = 0 ;; integer values
0417: start_mission 2 ; Originally:
0004: $41 = 1 ;; integer values
00D6: if 0
0256: player $PLAYER_CHAR defined
004D: jump_if_false ££MAIN_389
04BB: select_interior 0 ;; select render area
01B4: set_player $PLAYER_CHAR frozen_state 1 (unfrozen)

:Labelmenu1_1
03A4: name_thread 'MYMENU1'

:Labelmenu1_2
0001: wait 250 ms
00D6: if 0
0256: player $PLAYER_CHAR defined
004D: jump_if_false ££Labelmenu1_2
00D6: if 0
03EE: player $PLAYER_CHAR controllable
004D: jump_if_false ££Labelmenu1_2
00D6: if 0
80DF: NOT actor $PLAYER_ACTOR driving
004D: jump_if_false ££Labelmenu1_2
00D6: if 2
00E1: key pressed 0 18 ; Crouch
00E1: key pressed 0 11 ; Conersation Response Yes
004D: jump_if_false ££Labelmenu1_2
0002: jump ££Labelmenu1_3
0051: return

:Labelmenu1_3
054C: use_GXT_table 'MAIN'
0512: permanent text box 'CLOTHA'
0581: toggle_radar 0 (off)
01B4: set player $PLAYER_CHAR frozen_state 0 (frozen)
08D4: 'menu1' 30.0 150.0 300.0 1 1 1 1 $labelmenu1_handle
08DB: $labelmenu1_handle 0 'Go' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY'
09DB: $labelmenu1_handle 0 200

:Labelmenu1_4
0001: wait 0 ms
00D6: if 0
00E1: key_pressed 0 15
004D: jump_if_false ££Labelmenu1_5
08DA: $labelmenu1_handle
03E6: remove_text_box
0581: toggle_radar 1 (on)
01B4: set_player $PLAYER_CHAR frozen_state 1 (unfrozen)
0002: jump ££Labelmenu1_END

:Labelmenu1_5
00D6: if 0
00E1: key_pressed 0 16
004D: jump_if_false ££Labelmenu1_4
08D7: $labelmenu1_handle $11006
08DA: $labelmenu1_handle
03E6: remove_text_box
0581: toggle_radar 1 (on)
01B4: set_player $PLAYER_CHAR frozen_state 1 (unfrozen)
0871: init_jump_table $11006 total_jumps 1 0 ££Labelmenu1_6 jumps 0 ££Labelmenu1_6 -1 ££Labelmenu1_6 -1 ££Labelmenu1_6 -1 ££Labelmenu1_6 -1 ££Labelmenu1_6 -1 ££Labelmenu1_6 -1 ££Labelmenu1_6
0872: jump_table_jumps -1 ££Labelmenu1_6 -1 ££Labelmenu1_6 -1 ££Labelmenu1_6 -1 ££Labelmenu1_6 -1 ££Labelmenu1_6 -1 ££Labelmenu1_6 -1 ££Labelmenu1_6 -1 ££Labelmenu1_6 -1 ££Labelmenu1_6

:Labelmenu1_6
; selected button 'Go Home' (0)
00A1: put_actor $PLAYER_ACTOR at 249997800 -167971600 1325556
0002: jump ££Labelmenu1_END

:Labelmenu1_END
0002: jump ££Labelmenu1_2
--------------------------------------



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
Users WebsitePMMSNYahoo
  Top
 

 
am0n  
Posted: Thursday, Jul 14 2005, 16:36
Quote Post


Player Hater
Group Icon
Group: Members
Joined: Jan 16, 2005

XXXXX



QUOTE (virlan2004 @ Jul 13 2005, 13:10)
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.
PM
  Top
 

 
virlan2004  
Posted: Thursday, Jul 14 2005, 18:42
Quote Post


Player Hater
Group Icon
Group: Members
Joined: May 9, 2005

ro.gif

XXXXX



Ok sorry i knew that .. but still it won't work which exactly is the label i have to paste my code after ? After the whole MAIN thing ? after INIT ? where exactly?
Users WebsitePMMSNYahoo
  Top
 

 
virlan2004  
Posted: Thursday, Jul 14 2005, 18:49
Quote Post


Player Hater
Group Icon
Group: Members
Joined: May 9, 2005

ro.gif

XXXXX



Ok sorry i knew that .. but still it won't work which exactly is the label i have to paste my code after ? After the whole MAIN thing ? after INIT ? where exactly?

EDIT : I put it before Mission 0 but still crashes ... sad.gif( can you try it and tell me if it actually works?

This post has been edited by virlan2004 on Friday, Jul 15 2005, 11:49
Users WebsitePMMSNYahoo
  Top
 

 
AmonRa  
Posted: Monday, Jul 18 2005, 15:32
Quote Post


Player Hater
Group Icon
Group: Members
Joined: Jun 26, 2005

XXXXX



is it possible to create a menu with the options to type in values?
like number of ammo or even coords
PM
  Top
 

 
PatrickW  
Posted: Monday, Jul 18 2005, 18:51
Quote Post


GTA Juggernaut
Group Icon
Group: Moderators
Joined: Jan 7, 2004

nl.gif

Member Award




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.
Users WebsitePM
  Top
 

 
AmonRa  
Posted: Monday, Jul 18 2005, 22:15
Quote Post


Player Hater
Group Icon
Group: Members
Joined: Jun 26, 2005

XXXXX



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

 

0 User(s) are reading this topic (0 Guests and 0 Anonymous Users)

0 Members:

Pages: (2) [1] 2 

Topic Options Reply to this topicStart new topicStart Poll
Search topic for posted by (exact match)



 
IMG IMG