Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > Code Gallery
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 04-14-2008, 09:52 PM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
loadIni2() - loadIni() replica

Since I couldn't get loadIni() to work, and I don't want to halt my script until I find out why, I decided to script my own version of it. Should work the exact same way loadIni() is intended too.

PHP Code:
function loadini2(file)
{
  
temp.data.loadlines(file);
  
temp.var = new TStaticVar();
  
  for (
temp.linetemp.data) {
    if (
temp.line.starts("[")) {
      
this.preffix temp.line.substring(1temp.line.length() - 2);
      continue;
    } else if (
temp.line.tokenize("=").size() < 2) continue;
    
    
temp.str temp.line.tokenize("=")[0];
    
temp.var.(@this.preffix).(@temp.str) = temp.line.substring(temp.str.length() + 1temp.line.length());
  }
  
  return 
temp.var;

Use it with:
PHP Code:
this.var = loadIni2(path/to/file/filename.ext); 
Example of .ini file:
PHP Code:
[slotA]
charname=Rawr
level
=17

[slotB]
charname=Roar
level
=
this.var.slotA.charname would echo "Rawr".
__________________
Follow my work on social media post-Graal:Updated august 2025.

Last edited by xXziroXx; 04-14-2008 at 10:11 PM..
Reply With Quote
  #2  
Old 04-14-2008, 10:10 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
Inverness made one though, back in August 07.
His supports loading and saving of ini files, http://forums.graalonline.com/forums...ad.php?t=76374
__________________
Reply With Quote
  #3  
Old 04-14-2008, 10:13 PM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Oh, I wasn't aware of it, just figured I'd post what I made - no pun intended Inverness.
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #4  
Old 04-14-2008, 10:39 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Quote:
Originally Posted by Chompy View Post
Inverness made one though, back in August 07.
His supports loading and saving of ini files, http://forums.graalonline.com/forums...ad.php?t=76374
I thought someone made one when I read his other thread.

TiNI file or something ...
__________________
Reply With Quote
  #5  
Old 04-14-2008, 11:05 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
Quote:
Originally Posted by cbkbud View Post
I thought someone made one when I read his other thread.

TiNI file or something ...
TIniFile? Inverness made that..
__________________
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 08:15 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.