readinistring

Started by MEGAMIND, Jul 21, 2018, 06:18 PM

Previous topic - Next topic

MEGAMIND

actually im new to ini and using this first time so how do i read ini

my WriteIniString is
WriteIniString("objects.ini","autosaved",i.tostring(), "CreateObject("+o.Model+","+o.World+",Vector"+o.Pos+","+o.Alpha+").RotateToEuler(Vector"+o.RotationEuler+",1);"); }

and my output to that is

[objects]
0                           = CreateObject(636,17,Vector(-1399.7, -650.131, 15.8679),255).RotateToEuler(Vector(3.0996, 3.0871, -1.26476),1);

how would i be able t read it

so far i have tried this but it wont work
if (ReadIniString( "objects.ini", "objects", i.tostring() )==null);
{
         print("objects reloaded");
    }

NicusorN5

To create the object:
for(local i =0 ; i < 3000; i++)
{
try{
compilestring("objects.ini","autosaved",i.tostring())
}
catch(e) { }
}

MEGAMIND

#2
Quote from: Athanatos on Jul 21, 2018, 06:26 PMTo create the object:
for(local i =0 ; i < 3000; i++)
{
try{
compilestring("objects.ini","autosaved",i.tostring())
}
catch(e) { }
}
y compile autosave i just want to read objects.ini so that wahtsoever object is present in objects.ini so when i join game the object should be present at its location + that for thing didnt worked too

!

Quote from: MEGAMIND on Jul 21, 2018, 06:32 PMy compile autosave i just want to read objects.ini so that wahtsoever object is present in objects.ini so when i join game the object should be present at its location + that for thing didnt worked too
Don't know about ini but after reading data from ini file you must have to compile it in order to create those objects at their locations.

Discord: zeus#5155

Stormeus

If you're going to the effort of writing Squirrel code in an INI file, why not just get rid of the INI part and use dofile?

MEGAMIND

Quote from: Stormeus on Jul 21, 2018, 07:37 PMIf you're going to the effort of writing Squirrel code in an INI file, why not just get rid of the INI part and use dofile?
i had that idea befor but how du u right something in a dofile???

MEGAMIND


DizzasTeR

Quote from: Stormeus on Jul 21, 2018, 07:37 PMIf you're going to the effort of writing Squirrel code in an INI file, why not just get rid of the INI part and use dofile?

He means since you are saving the data in ini as pure squirrel code, you can directly use dofile to load all the CreateObject statements from the ini file instead of reading them from ini as strings and then executing them/creating objects with them.

try
dofile("objects.ini")and it should load all the objects

MEGAMIND

;) thanks doom, i didnt got Stormeus messeage in the firstplace....

EK.IceFlake

Quote from: Doom_Kill3R on Jul 22, 2018, 07:50 AM
Quote from: Stormeus on Jul 21, 2018, 07:37 PMIf you're going to the effort of writing Squirrel code in an INI file, why not just get rid of the INI part and use dofile?

He means since you are saving the data in ini as pure squirrel code, you can directly use dofile to load all the CreateObject statements from the ini file instead of reading them from ini as strings and then executing them/creating objects with them.

try
dofile("objects.ini")and it should load all the objects

You can't dofile an ini, it'll cause errors. You should save them to a .nut file.

MEGAMIND

#10
Quote from: EK.IceFlake on Jul 22, 2018, 08:23 AM
Quote from: Doom_Kill3R on Jul 22, 2018, 07:50 AM
Quote from: Stormeus on Jul 21, 2018, 07:37 PMIf you're going to the effort of writing Squirrel code in an INI file, why not just get rid of the INI part and use dofile?

He means since you are saving the data in ini as pure squirrel code, you can directly use dofile to load all the CreateObject statements from the ini file instead of reading them from ini as strings and then executing them/creating objects with them.

try
dofile("objects.ini")and it should load all the objects

You can't dofile an ini, it'll cause errors. You should save them to a .nut file.
yeeep exactly got errors




and if i do this

if ( ReadIniString("objects.ini","objects",i.tostring()) == null )
    {
       print("nothing loads up");
    }

the console startsup normally but the objects doesnt load up saying



whether it's onplayerjoin or onscriptload


NicusorN5

You need to use that loop part. That's there's isn't a variable named i.

MEGAMIND

#12
Quote from: Athanatos on Jul 22, 2018, 09:43 AMYou need to use that loop part. That's there's isn't a variable named i.
how ? u do know that im weak at ini

=RK=MarineForce

print it? u want see whats in object.ini?

print("objects.ini"); xDD

MEGAMIND

Quote from: =RK=MarineForce on Jul 22, 2018, 10:13 AMprint it? u want see whats in object.ini?

print("objects.ini"); xDD

At marine force pls stay out of this lol