Jump to content
    1. Welcome to GTAForums!

    1. GTANet.com

    1. GTA Online

      1. Los Santos Drug Wars
      2. Updates
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Red Dead Online

      1. Blood Money
      2. Frontier Pursuits
      3. Find Lobbies & Outlaws
      4. Help & Support
    3. Crews

    1. Grand Theft Auto Series

      1. Bugs*
      2. St. Andrews Cathedral
    2. GTA VI

    3. GTA V

      1. Guides & Strategies
      2. Help & Support
    4. GTA IV

      1. The Lost and Damned
      2. The Ballad of Gay Tony
      3. Guides & Strategies
      4. Help & Support
    5. GTA San Andreas

      1. Classic GTA SA
      2. Guides & Strategies
      3. Help & Support
    6. GTA Vice City

      1. Classic GTA VC
      2. Guides & Strategies
      3. Help & Support
    7. GTA III

      1. Classic GTA III
      2. Guides & Strategies
      3. Help & Support
    8. Portable Games

      1. GTA Chinatown Wars
      2. GTA Vice City Stories
      3. GTA Liberty City Stories
    9. Top-Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    1. Red Dead Redemption 2

      1. PC
      2. Help & Support
    2. Red Dead Redemption

    1. GTA Mods

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Red Dead Mods

      1. Documentation
    3. Mod Showroom

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

      1. Design Your Own Mission
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Rockstar Games

    2. Rockstar Collectors

    1. Off-Topic

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

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

    2. Forum Support

    3. Suggestions

[GTA SA] Saved value in ini file too big. CLEO.


vladvo
 Share

Recommended Posts

Hi All !

I'am making a mod to export and import all possible game stats.  Almost everything seem to work as intended.

So, I read a float value with CLEO

I read it using

0653: [email protected] = 81 //Gambling

then save it to file with

0AF3: [email protected] "CLEO\stat.dat" "stats" key "Gambling" 

In-game stat screen shows normal value but in the stat.dat file it look like this:
Gambling=3.67312e+06
How do I get a normal value ? Not this "e+06 " overflow.
And it should be compatible with 

0AF2: [email protected] = "CLEO\stat.dat" "stats" key "Gambling"

so that I would be able to import it back in the game.

Edited by vladvo
Link to comment
Share on other sites

i saw those expressions more times

can you compile it ?

does it work ?

If not, then post complete script

if yes then display output of ini on screen

while true
    wait 0
    03F0: enable_text_draw 1
    045A: draw_text_1number 50.0 200.0 GXT 'NUMBER' number 12@// display Gambling skill
    0653: 1@ = float_stat 81//Gambling
    0092: 12@ = float_to_integer 1@
end

 

Edited by ZAZ
Link to comment
Share on other sites

Yes, it works now. Thanks.

I decided to check another stat (distance on motorbike) to avoid any confusion - there are like 3 or 4 stats related to gambling. The distance one is pretty clear. At first your code failed to do the job. Just because I forgot that I have to use 0AF1 instead of 0AF3. (0AF1 - write int, 0AF3 - write float to file)

 

The only drawback of float to int conversion is that the real in-game value is 1801278.75M and during conversion .75 is lost. No biggie. At least with this stat. The value in file is 1801278. Great. 
Tested the mod a bit more and it seems that float values over 1000000 (starting with 1000001) are written with e+##. Guess it's a problem with this cleo function.

Well, turns out that at the moment it would require more work to check if the var is >1000000 and if it is - convert it. Not sure I am ready for it. The code is already 1000+ lines long. )) Actually, everything was done quite fast with excel and a stat table I found on one of the websites. 

Have a look, if you want to. https://pastebin.com/7jP4ZvZp
Read-writes are made in  blocks due to limitations (33 local vars, I think).

Edited by vladvo
Link to comment
Share on other sites

What happens if you ignore the scientific notation in the ini file and follow through with reading it as a float and updating the stat with that value? Do you loose any precision?  Floating point values are not terribly accurate anyway, and this becomes more apparent as the numbers become larger.

Link to comment
Share on other sites

have tested the script and found inside ini file

Longest 2 wheels distance=5.1522e+007

 

when i convert it to integer

0653: 12@ = float_stat 12
0092: 31@ = float_to_integer 12@

 

it returns 78

 

Spoiler
:EXPORT
wait 0
03F0: enable_text_draw 1
045A: draw_text_1number 50.0 200.0 GXT 'NUMBER' number 31@// display Longest 2 wheels distance

if 
0AB0:   key_pressed 119  //F8 - save stats
else_jump @IMPORT     // If not ignore this part and jump to the second part
 
0653: 12@ = float_stat 12
0092: 31@ = float_to_integer 12@

0AF3: write_float 12@ to_ini_file "CLEO\stat.dat" section "stats" key "Longest 2 wheels distance "

:IMPORT
if 
0AB0:   key_pressed 118 // F7
else_jump @EXPORT
0AF2: 12@ = read_float_from_ini_file "CLEO\stat.dat" section "stats" key "Longest 2 wheels distance "
jump @EXPORT

 

 

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
 Share

  • 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.