This site has been archived and made available for preservation purposes. No edits can be made.

Results 1 to 1 of 1

Thread: Ini

  1. #1

    Ini

    just built a small include which manages files (unpacked strings only) including INI standarts. functions:
    Code c:
    native INI::Create(const path[],bool:overwrite=false);
    native INI::Remove(const path[]);
    native INI::Copy(const oldpath[], const newpath[],bool:delete_oldpath=true,bool:overwrite=false);
    native INI::GetValue(const path[],const key[],const section[]='''');
    native INI::GetValueAsInt(const path[],const key[],const section[]='''');
    native Float:INI::GetValueAsFloat(const path[],const key[],const section[]='''');
    native bool:INI::GetValueAsBool(const path[],const key[],const section[]='''');
    native INI::SetValue(const path[],const key[],value[],const section[]);
    native INI::SetInt(const path[],const key[],value,const section[]);
    native INI::SetFloat(const path[],const key[],Float:value,const section[]);
    native INI::SetBool(const path[],const key[],bool:value,const section[]);
    structure of a file
    Code ini:
    ; Comment
    [Section]
    key=value
    comments can be set at the beginning of a line only (';' has to be the first character, can be changed with COMMENTVAULTCHARACTER). every section can be used only one time and every key in a section has a unique name - but two or more key can have the same name if theyre in different sections. by default the system works case insensitivity but you can toggle it with "IGNOREVAULTCASE".
    usage example:
    Code ini:
    ; Userfile.ini
    [General]
    name=Asdf
    age=18
    logins=1
    [InGame]
    class=Human
    age=38
    dead=false
    [Position]
    x=1363.00
    y=5479.00
    z=7844.13
    Code c:
    #include <INI>
    new logins = INI::GetValueAsInt(''Userfile.ini'',''logins'',''General'');
    INI::SetInt(''Userfile.ini'',''logins'',++logins,''General'');
    new Float:x = INI::GetValueAsFloat(''Userfile.ini'',''x'',''Position'');
    new Float:y = INI::GetValueAsFloat(''Userfile.ini'',''y'',''Position'');
    new Float:z = INI::GetValueAsFloat(''Userfile.ini'',''z'',''Position'');
    SetPos(ID,x,y,z);
    download: https://dl.dropbox.com/u/93111829/Va...nloads/INI.inc

    not all functions are tested so please give feedback if it works
    Last edited by NeoPhoenix; 09-03-2012 at 08:31 PM. Reason: improving example code

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •