Quantcast

Jump to content

» «
Photo

[SA] Listing in .ini-file

4 replies to this topic
aStiffSausage
  • aStiffSausage

    Formerly Oksu

  • Members
  • Joined: 30 Sep 2010
  • Finland

#1

Posted 14 April 2012 - 07:24 PM

I need, after a long time, some help with CLEO.

How could I make something like where I could add new ID's inside .ini-file, and then add parameter for each ID?

I mean something like these two:

CODE

[ID]
400
401

[400]
ASD1=***
ASD2=***
ASD3=***

[401]
ASD1=***
ASD2=***
ASD3=***


CODE

[ID]
452
602

[452]
ASD1=***
ASD2=***
ASD3=***

[602]
ASD1=***
ASD2=***
ASD3=***



And, what are default values for opcode 09EF?
Most of you are probably guessing where this is going...

fastman92
  • fastman92

    фастман92 | ف

  • Members
  • Joined: 28 Jul 2009

#2

Posted 14 April 2012 - 07:37 PM

CODE
[ID]
400
401

You can't do it EASILY. I won't explain harder way, it's too complicated.

CLEO4 provides the easiest way to do what you're gonna do.
You need to create string with section name or key, but you have number (integer here).

Create in .ini for example:
CODE

[ID]
id_1 = 400
id_2 = 401


CODE
0AF0: 0@ = get_int_from_ini_file "cleo\config.ini" section "SectionName" key "intKey"

Read Integers in loop. From section "ID", from key from created string with incremented ID.
Read until it successes (returns true), break on failure.
In next step read if you have read ID: create formatted string of "%d" with ID as argument.
It will be section name.
Create key names with pattern "ASD%d" and incremented number from 1 as argument.
Break on failure.

To create string with number:
CODE
0AD3: 0@v = format "ASD%d" 4@

Where 0@v is outputted string and 4@ is number.

However it's harder stuff and it's likely that you will understand what's described in this post.

aStiffSausage
  • aStiffSausage

    Formerly Oksu

  • Members
  • Joined: 30 Sep 2010
  • Finland

#3

Posted 14 April 2012 - 09:00 PM

Well, I've got it nearly to work through ~20 lines long code. No need to do stuff through so complex method if simple solutions work as wanted. smile.gif

But, I still got a little problem... What should I use for the [ID] part?
I get the model from current car to 1@, but how can I then use it so the script reads the part of current model?

This is one of the few I've tried, all unsuccesful so far:
CODE
0441: 1@ = car 0@ model
06D2: 5@v = '1@'
0AF2: 2@ = get_float_from_ini_file "cleo\***.ini" section 5@s key "***" //IF and SET

LINK/2012
  • LINK/2012

    LIVIN' IN CODE

  • Feroci Racing
  • Joined: 30 Jan 2011
  • Brazil

#4

Posted 14 April 2012 - 09:04 PM

CODE
0441: 1@ = car 0@ model
0AD3: 5@v = format "%d" 1@
0AF2: 2@ = get_float_from_ini_file "cleo\***.ini" section 5@s key "***" //IF and SET


aStiffSausage
  • aStiffSausage

    Formerly Oksu

  • Members
  • Joined: 30 Sep 2010
  • Finland

#5

Posted 14 April 2012 - 09:25 PM

Thank you Link2012! It works, and all I now need to do is some small configuration before release. smile.gif




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users