Jump to content

Help With In-Game Menues


demonj0e

Recommended Posts

Hey all

I Decided to have a go at creating a in game menue to activate/deactivate mods in my scm,Ive got the menu working it shows up but at the min it cant do anything, so i need some help with

1. activating/deactiving mods with it

2. making text change from deactivated and activated

 

ive tried some stuff heres my code

 

 

:MODSELECT_103A4: name_thread 'MODMENU':MODSELECT_20001: wait  250 ms00D6: if  00256:   player $PLAYER_CHAR defined004D: jump_if_false ££MODSELECT_200D6: if  003EE:   player $PLAYER_CHAR controllable004D: jump_if_false ££MODSELECT_200D6: if  080DF: NOT  actor $PLAYER_ACTOR driving004D: jump_if_false ££MODSELECT_200D6: if 200E1:   key pressed  0  8; Group Control Forward00E1:   key pressed  0  4; Action004D: jump_if_false ££MODSELECT_20002: jump ££MODSELECT_30051: return:MODSELECT_3054C: use_GXT_table 'GTAME'0512: permanent text box 'CLOTHA'0581: toggle_radar  0 (off)01B4: set player $PLAYER_CHAR frozen_state  0 (frozen)08D4: create_panel $modselect_handle title 'MOD1' position  29.0  145.0 width  240.0 columns  2 interactive  1 background  2 align  108DB: set_panel $modselect_handle  column  0 header 'DUMMY' data 'STD1' 'WEP1' 'JUMP1' 'NEO1' 'MISSION' 'SAVEANY' 'HOTCOF' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY'08DB: set_panel $modselect_handle  column  1 header 'DUMMY' data 'ENAB' 'ENAB' 'ENAB' 'ENAB' 'ENAB 'ENAB' 'ENAB' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY'09DB: set_panel $modselect_handle  column  0 width  12009DB: set_panel $modselect_handle  column  1 width  100:MODSELECT_40001: wait  0 ms00D6: if  000E1:   key_pressed  0  15004D: jump_if_false ££MODSELECT_508DA: $modselect_handle03E6: remove_text_box0581: toggle_radar  1 (on)01B4: set_player $PLAYER_CHAR frozen_state  1 (unfrozen)0002: jump ££MODSELECT_END:MODSELECT_500D6: if  000E1:   key_pressed  0  16004D: jump_if_false ££MODSELECT_408D7: $modselect_handle $1100608DA: $modselect_handle03E6: remove_text_box0581: toggle_radar  1 (on)01B4: set_player $PLAYER_CHAR frozen_state  1 (unfrozen)0871: init_jump_table $11006 total_jumps  7  0 ££MODSELECT_6 jumps  0 ££MODSELECT_6  1 ££MODSELECT_7  2 ££MODSELECT_8  3 ££MODSELECT_9  4 ££MODSELECT_10  5 ££MODSELECT_11  6 ££MODSELECT_120872: jump_table_jumps  -1 ££MODSELECT_6  -1 ££MODSELECT_6  -1 ££MODSELECT_6  -1 ££MODSELECT_6  -1 ££MODSELECT_6  -1 ££MODSELECT_6  -1 ££MODSELECT_6  -1 ££MODSELECT_6  -1 ££MODSELECT_6:MODSELECT_6; selected button 'STD1' (0)00D6: if  00004:   $STEED ==  1 ;; integer values004D: jump_if_false ££MODSELECT_END0004: $STEED =  0 ;; integer values0002: jump ££MODSELECT_END:MODSELECT_7; selected button 'WEP1' (1)0002: jump ££MODSELECT_END:MODSELECT_8; selected button 'JUMP1' (2)0002: jump ££MODSELECT_END:MODSELECT_9; selected button 'NEO1' (3)0002: jump ££MODSELECT_END:MODSELECT_10; selected button 'MISSION' (4)0002: jump ££MODSELECT_END:MODSELECT_11; selected button 'SAVEANY' (5)0002: jump ££MODSELECT_END:MODSELECT_12; selected button 'HOTCOF' (6)00D6: if  00038:   $1219 ==  1 ;; integer values004D: jump_if_false ££MODSELECT_END0004: $1219 =  0 ;; integer values00D6: if  00038:   $1219 ==  0 ;; integer values004D: jump_if_false ££MODSELECT_END0004: $1219 =  1 ;; integer values0002: jump ££MODSELECT_END:MODSELECT_END0002: jump ££MODSELECT_2

 

 

0004: $STEED == 1 ;; integer values in my scm means the mod is turned off so at the start of the steed mod ive got

 

 

00D6: if 00004:   $STEED =  0 ;; integer values004D: jump_if_false ££BIKE1

 

 

and 0038: $1219 == 1 ;; integer values is what keeps the hot cofee turned off so i set it to this 0004: $1219 = 0 ;; integer values

 

it should turn on but it dosent seem to be workign correctly coudl someone help me out with this

Link to comment
Share on other sites

random_download

To enable/disable mods you could just use end_thread_named/create_thread and then put a name_thread in each mod. I've never looked into the new panel opcodes in SA, so I'm not quite sure how they work.

 

0002: jump ££MODSELECT_30051: return

 

Delete both of those in :MODSELECT_2

Link to comment
Share on other sites

Depending on the mod and the way it was written, it may be better for it to terminate itself after finding a global flag telling it to. Would allow it to run any cleanup it needed first. If saving of overall threads is a concern at all, you could just have the flag have 3 values: 0 indicating it's on, 1 indicating it's marked for self termination, and 2 indicating that it has finished terminating. Then the mod host would understand it's cleared for re-launching it if it would like.

 

For that matter, it might be better for a mod to just switch to dormant as dem0n is proposing in the event that it would benefit from retaining its locals like in mods like Nitz Kit where they are user-stored warp points.

 

I had already mentioned to dem0n via IM to kill the return. Didn't realize that made the jump before it unnecessary. Add in the if lumping I also mentioned via IM and you save 31 bytes by eliminating MODSELECT_3 and just making it

:MODSELECT_20001: wait  250 ms00D6: if  00256:   player $PLAYER_CHAR defined004D: jump_if_false ££MODSELECT_200D6: if  303EE:   player $PLAYER_CHAR controllable80DF:   NOT  actor $PLAYER_ACTOR driving00E1:   key pressed  0  8; Group Control Forward00E1:   key pressed  0  4; Action004D: jump_if_false ££MODSELECT_2054C: use_GXT_table 'GTAME'0512: permanent text box 'CLOTHA'0581: toggle_radar  0 (off)01B4: set player $PLAYER_CHAR frozen_state  0 (frozen)08D4: create_panel $modselect_handle title 'MOD1' position  29.0  145.0 width  240.0 columns  2 interactive  1 background  2 align  108DB: set_panel $modselect_handle  column  0 header 'DUMMY' data 'STD1' 'WEP1' 'JUMP1' 'NEO1' 'MISSION' 'SAVEANY' 'HOTCOF' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY'08DB: set_panel $modselect_handle  column  1 header 'DUMMY' data 'ENAB' 'ENAB' 'ENAB' 'ENAB' 'ENAB 'ENAB' 'ENAB' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY'09DB: set_panel $modselect_handle  column  0 width  12009DB: set_panel $modselect_handle  column  1 width  100

And to think you teased me because the slimmings I was proposing were crazy and here you are benefitting from them tounge.gif

Edited by Demarest
Link to comment
Share on other sites

random_download

You could also replace all references of label MODSELECT_END with MODSELECT_2

And:

 

:MODSELECT_12; selected button 'HOTCOF' (6)00D6: if  00038:   $1219 ==  1;; integer values004D: jump_if_false ££MODSELECT_END0004: $1219 =  0;; integer values00D6: if  00038:   $1219 ==  0;; integer values004D: jump_if_false ££MODSELECT_END0004: $1219 =  1;; integer values0002: jump ££MODSELECT_END

 

Basically does nothing. if $1219 is not 1 then it goes to MODSELECT_END, if it is then it is set to 0, checked to see if it is still zero (which it must be as there is no wait) then set it back to 1 again. I'm not sure what you want to do here.

Link to comment
Share on other sites

lol i was trying to make it turn on and off, i then later saw it was usless as it turns on and then straight back off
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • 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.