Quantcast
Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
    1. Welcome to GTAForums!   (84,677 visits to this link)

    2. News

    1. GTA Online

      1. Find Lobbies & Players
      2. Guides & Strategies
      3. Vehicles
      4. Content Creator
      5. Help & Support
    2. Crews

      1. Events
      2. Recruitment
    1. Grand Theft Auto Series

    2. GTA Next

    3. GTA V

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

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

    6. GTA Vice City Stories

    7. GTA Liberty City Stories

    8. GTA San Andreas

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

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

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

      1. GTA Advance
      2. GTA 2
      3. GTA
    12. 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

    2. Red Dead Redemption

    3. 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. Forum Support

    2. Site Suggestions

Sign in to follow this  
fastman92

How to convert integer variable to string?

Recommended Posts

fastman92

 

0AF0: [email protected] = get_int_from_ini_file "CarSpawnerRanges.ini" section "1" key "start"

 

It works, when parameter for section is string.

 

 

0AF0: [email protected] = get_int_from_ini_file "CarSpawnerRanges.ini" section [email protected] key "start"

 

My [email protected] is integer.

Executing this code causes crash, so how can I convert integer variable [email protected] to any other string e.g [email protected]

Edited by fastman92

Share this post


Link to post
Share on other sites
Wesser

You have to make a lot of calculations to retrieve every integer unit and convert each one to string type. I've already done it since a while and it is a part of my CLEO3's SDK (still unreleased tounge2.gif):

 

{ FUNCTIONS INCLUDED:-   getPowVal     Type: GET       Description: Get the pow of an integer value.-   getIntUnits     Type: GET       Description: Get all units of an integer value.-   getIntUnit     Type: GET       Description: Get a specific unit of an integer value (from right).-   convIntToStr     Type: SET       Description: Convert an integer value into a string.}{$CLEO}0000: NOPwhile true 0AB1: call_scm_func @convIntToStr 1 num 65535 store_to [email protected] [email protected]  // [email protected] will contain your value converted to stringend:getPowVal{ Parameters:   Passed:     [email protected] - base     [email protected] - exponent   Result:     [email protected] - integer/float Example:   0AB1: call_scm_func @getPowVal 2 num 2 exp 3 store_to [email protected] }0085: [email protected] = [email protected] if  [email protected] > 0 then for [email protected] = 1 to [email protected]    if      [email protected] > 1    then     006A: [email protected] *= [email protected]    end endelse if    [email protected] < 0  then   0093: [email protected] = integer [email protected] to_float   0093: [email protected] = integer [email protected] to_float   for [email protected] = -1 to [email protected]      if        [email protected] < -1      then       006B: [email protected] *= [email protected]      end   end   [email protected] = 1.0    0073: [email protected] /= [email protected]    0087: [email protected] = [email protected]  else   [email protected] = 1  endend0AB2: ret 1 [email protected] :getIntUnits{ Parameters:   Passed:     [email protected] - number   Result:     [email protected] - units -> 0 to 10 Example:   0AB1: call_scm_func @getIntUnits 1 num 125 store_to [email protected] }[email protected] = 0 0095: make [email protected] absolute_integerif  [email protected] <> 0 then while [email protected] > 0    [email protected] /= 10    [email protected] += 1  endelse [email protected] = 1 end0AB2: ret 1 [email protected] :getIntUnit{ Parameters:   Passed:     [email protected] - number     [email protected] - unit position -> 0 to 10   Result:     [email protected] - unit Example:   0AB1: call_scm_func @getIntUnit 2 num 125 unit 2 store_to [email protected] }0095: make [email protected] absolute_integer0AB1: call_scm_func @getIntUnits 1 num [email protected] store_to [email protected] if 002D:  [email protected] >= [email protected] then 0085: [email protected] = [email protected]  0AB1: call_scm_func @getPowVal 2 num 10 exp [email protected] store_to [email protected]  0072: [email protected] /= [email protected]  006A: [email protected] *= [email protected]  0062: [email protected] -= [email protected]  [email protected] -= 1  0AB1: call_scm_func @getPowVal 2 num 10 exp [email protected] store_to [email protected]  0072: [email protected] /= [email protected] else [email protected] = 0 end0AB2: ret 1 [email protected] :convIntToStr{ Parameters:   Passed:     [email protected] - number -> -9999999 to 9999999   Result:     [email protected]/[email protected] - string value Example:   0AB1: call_scm_func @convIntToStr 1 num 125 store_to [email protected] [email protected] }if and [email protected] <=  9999999  [email protected] >= -9999999 then 0AB1: call_scm_func @getIntUnits 1 num [email protected] store_to [email protected]  if    [email protected] > 7  then   [email protected] = 7  end [email protected] = ''  if    [email protected] < 0  then   [email protected] = '-'  end for [email protected] = [email protected] downto 1    0AB1: call_scm_func @getIntUnit 2 num [email protected] unit [email protected] store_to [email protected]    [email protected] += 0x30    098B: [email protected] = [email protected] + [email protected]  endend0AB2: ret 2 [email protected] [email protected] 

 

Share this post


Link to post
Share on other sites
fastman92

Thanks Wesser!

Your function(s) works perfectly.

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

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