Page 1 of 1

${ini} Bug?

Posted: Sat Apr 24, 2004 10:03 am
by LordGiddion
not getting what I expected, trying to figure out if I'm getting what's intended.

Code: Select all

/varset Shortcutlist "${Ini[@IniFile,@SectionLabel,-1,NONE]}"
/echo @Shortcutlist
Returns "Null"
I expected it to return NONE, NULL is ok just wanted to know if it was "working as intended"

Posted: Sat Apr 24, 2004 10:29 am
by ml2517
You'd have to post what you have stored in @IniFile and @SectionLabel at the time.

Posted: Sat Apr 24, 2004 10:55 am
by LordGiddion
There is nonthing in the match section that is why I expect NONE to be the return.

Posted: Sat Apr 24, 2004 12:13 pm
by ml2517
I didn't mean what is stored in your INI file, I meant what is stored in those variables.

Posted: Sat Apr 24, 2004 2:11 pm
by Lax
NULL is the standard response when something couldnt be parsed or the result is impossible to retrieve. Ini has two possible ways you could get NULL. One is if there is no comma in the []. The other is if GetPrivateProfileString returns 0.

I would assume that the Ini file you're trying to access doesnt exist. As he said, what is the valueof @Inifile?

Posted: Sat Apr 24, 2004 6:56 pm
by LordGiddion
The ini file exists and the section name exists it just has no keys in it.
The ini file is genbot_blah.ini and in other areas I read about 30 values out of it, in the same loop

Code: Select all

/varset Shortcutlist "${Ini[@IniFile,shortcut spells,-1,None]}"
returns the list of keys
and

Code: Select all

/varset Shortcutlist "${Ini[@IniFile,shortcut items,-1,None]}"
returns Null
the INI looks like this

Code: Select all

[shortcut spells] 
Nuke=draught of jiva 
Sow=Spirt of wolf 
PLBuff=Resolution|Shield of words 
[shortcut Items] 
[shortcut notarget Spells] 
ITU=Invisibility to undead 
[shortcut notarget items] 
Levi=Pegasus cloak
[shortcut AA]
[shortcut noTarget AA]
[Shortcut Disc]
[shortcut noTarget Disc] 

Posted: Sat Apr 24, 2004 9:22 pm
by Lax
probably because shortcut items section is empty. I guess default has nothing to do with when you're getting a list of keys.

case closed

Posted: Mon Apr 26, 2004 1:05 am
by Lax
alright.. the default will work for you in this case next zip.

If the ini file does not exist, you will get NULL
If the file exists, but nothing was retrieved (as above), you will get NULL unless a default was given. If the default was given, it will be used instead.

Posted: Mon Apr 26, 2004 4:03 am
by LordGiddion
Thanks Lax, function as intended would have been a fine answer, I had posted because the results hadn't matched what I had expected from TLO doc.