Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Scripts can't read INI files? (https://forums.graalonline.com/forums/showthread.php?t=72750)

godofwarares 03-11-2007 06:14 PM

Scripts can't read INI files?
 
For some reason, when I try to use loadlines to read an INI file, It doesn't seem to work!

PHP Code:

test.loadlines("newplayer.ini");
echo(
test); 

That only returns 0, Even with test.size();...

And yes it is downloadable:
Quote:

Originally Posted by RC
newplayer.ini: downloadable, 466 byte, 2007-03-11 18:49:37

And the NPC Server has the rights:
Quote:

Originally Posted by (npcserver) rights
rw */*
rw */*/*
rw */*/*/*
rw */*/*/*/*

But for some reason the script won't work.
When I change the format, it does, but I want .ini support :(

Admins 03-11-2007 06:22 PM

Scripts are restricted to certain file extensions to avoid someone writing exes or similar

godofwarares 03-11-2007 06:27 PM

Aw man, I wanted to use .ini files for my MUD library :(

Ah well. Restricted to .arc x-x

Skyld 03-11-2007 06:42 PM

Quote:

Originally Posted by godofwarares (Post 1287490)
Aw man, I wanted to use .ini files for my MUD library :(

Ah well. Restricted to .arc x-x

The file extension doesn't make any difference about what the file contains. Why not just put an .ini file's structure inside a .txt file or so?

godofwarares 03-11-2007 06:55 PM

INI looks good, Lol.
Oh well no more use for this thread.
Off to ASCII art thread ^^;

JkWhoSaysNi 03-11-2007 07:22 PM

hmm, are .xml files usable?

Angel_Light 03-11-2007 07:25 PM

Quote:

Originally Posted by JkWhoSaysNi (Post 1287528)
hmm, are .xml files usable?

I believe so theres a XML parser out there somewhere.

Rapidwolve 03-11-2007 07:49 PM

Quote:

Originally Posted by Angel_Light (Post 1287531)
I believe so theres a XML parser out there somewhere.

They are just talking about the extensions, they wont actually use XML format -_-

btw I use a DAT file ^^

JkWhoSaysNi 03-11-2007 08:00 PM

Actually i intended to use XML to store objects, XML would easily allow storing of complex objects.

Riot 03-11-2007 08:26 PM

I would assume XML files are allowed considering:

TGraalVar.loadxml(str)
TGraalVar.loadxmlfromstring(str)
TGraalVar.savexml(str, int)
TGraalVar.savexmltostring() - returns string

Tolnaftate2004 03-11-2007 10:57 PM

Quote:

Originally Posted by Riot (Post 1287558)
I would assume XML files are allowed considering:

TGraalVar.loadxml(str)
TGraalVar.loadxmlfromstring(str)
TGraalVar.savexml(str, int)
TGraalVar.savexmltostring() - returns string

That doesn't necessarily mean that the files are '-.xml'.

Admins 03-12-2007 04:30 PM

Ok added .ini to the allowed file extensions, it will not work before the next update of npcserver or client though.

XML files are supported, you can ready and write them and also use the built-in functions (also use obj.addnamedstring(name,value)). It requires some more functions to be more usuable though, also on clientside it is very simple right now.

godofwarares 03-12-2007 08:10 PM

Alright, Thanks :)

Inverness 03-13-2007 07:49 AM

Ini does sound cool, and I like that as an extension.
...
I have had a revelation!
Ini files would be nice way of storing multiple archetypes.
PHP Code:

[Archetype1]
Variable1=value1
Variable2
=value2
[Archetype2]
Variable1=Value1
Variable2
=Value2 

And so on, ahh.

Twinny 03-13-2007 07:57 AM

Quote:

Originally Posted by Inverness (Post 1288076)
Ini files would be nice way of storing multiple archetypes.

Like the Command and Conquer ini files I work with ^^. Check rules.ini, they do
PHP Code:

[NBUGGY]
vars
[/NBUGGY]
[
GDISTANK]
vars
[/GDISTANK]
[
9MM]
vars
[/9MM

Not sure what will be the go in Command and Conquer 3 but like...omg...Command and Conquer 3!! omg...like....omg...^^. I guess you'd read all lines starting with a [ and see if it matches what you need ^^.

The downside to such a thing is that the .ini file can become massive and confusing. It could also become faster to load indivudual files in the end.

p.s. omg...like...C&C3!!...like...omg

Inverness 03-13-2007 08:22 AM

Ini files don't use the slashes at the end of each block, it just switches to the new one, the normal kind anyways.


All times are GMT +2. The time now is 12:36 AM.

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