Jump to content

Help with script


fastbuickgn

Recommended Posts

I am using the speedometer script with these lines:

 

:MOB_GF_548

0001: wait 50 ms

00D6: if 0

00DF: actor $PLAYER_ACTOR driving

004D: jump_if_false ££MOB_GF_562

03C0: @3 = actor $PLAYER_ACTOR car

00D6: if 0

00DB: actor $PLAYER_ACTOR in_car @0

004D: jump_if_false ££MOB_GF_548

02E3: @1 = car @0 speed

0011: @1 *= 2.25 ;; floating-point values

008C: @1 = float_to_integer @1

0086: $10949 = @1 ;; floating-point values only

04F7: status_text $10949 3 line 4 'HOSP_1' <-- changed 0 line to 3 line

0002: jump ££MOB_GF_548

 

:MOB_GF_562

0001: wait 250 ms

0151: remove_status_text $10949

0002: jump ££MOB_GF_548

 

my problem is i wanted to ues it with fuel script but the MPH speed script runs over the fuel when im in the car ,so i changed the 0 line to 3 line now the MPH moved 1 line up but it does not register anymore,so my question is which other line or lines would i have to change. confused.gif

Link to comment
Share on other sites

First of all, you would change the line number, not the parameter before it. Status text calls in original code only used types 0 and 1, not 3. Also, you capture the car to @3, but every reference to a car after that uses @0. I don't know if the original code author used DMA and unoriginal label names. Either way, you shouldn't be. You should use custom variable and label names or better yet, local vars (although I think status text has to use globals). The 2nd section as it's written is never referenced. Also the if driving car X check (even if written properly) is redundant because it happens immediately after it was established he was in that car with no waits in between. Plus nothing in the code frees up the memory afterwards. Shoul look more like

:MYMOD0004: $MYTEXT =  003A4: name_thread "MPHDISP":MYMOD10001: wait 250 ms00D6: if  00256:   defined $PLAYER_CHAR004D: jump_if_false ££LabelMYMOD100D6: if 000DF: actor $PLAYER_ACTOR driving004D: jump_if_false ££MYMOD103C0: @0 = actor $PLAYER_ACTOR car04F7: status_text $MYTEXT 0 line 4 'HOSP_1':MYMOD200D6: if  00256:   defined $PLAYER_CHAR004D: jump_if_false ££LabelMYMOD300D6: if 000DB: actor $PLAYER_ACTOR in_car @0004D: jump_if_false ££MYMOD302E3: @1 = car @0 speed0011: @1 *= 2.25;; floating-point values008C: $MYTEXT = float_to_integer @10001: wait 50 ms0002: jump ££MYMOD2:MYMOD30151: remove_status_text $MYTEXT01C3: remove_references_to_car @00002: jump ££MYMOD1

 

 

Notice that @0 and the status text are established (and killed) at the same time? Notice how the wait is at the end of the following loop so that the status text reads true even from the beginning? Status text only needs to be established with a global variable. After that, as that variable changes in value, the on screen does with it. You don't need to loop it.

Link to comment
Share on other sites

How do you guys get so good at this stuff,i have been looking at all the tuts and i get so confused. Thanks alot i'll try it smile.gif

Link to comment
Share on other sites

You learn one thing at a time. Just like today you learn that status text doesn't need to be looped, but it does have to be global. You won't ever have to learn that one again, although you may accidentally forget. If you do, you'll likely remember it once it trips you up or something.

 

The whole @3 vs @0 was just by looking at it. It helped knowing that SOMETHING was wrong, otherwise I might've overlooked it.

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.