[Help with code] Load $var

Discuss and share scripts and script files...
Post Reply
rebr
Posts: 41
Joined: 17 Nov 2013 20:30

[Help with code] Load $var

Post by rebr »

The code:

Code: Select all

"Zona...|<xyicons>\shapes\Boia.ico"
  $ac = "<xydata>\xr\xr-conf-geral.ini"; $se = "Scripts"; $li = "Zona";
  $ax = getkey("$li", "$se", "$ac", "1");
  load "$ax", "", '"s"';
As you can see, that's supposed to read a line in the .ini-file "<xydata>\xr\xr-conf-geral.ini", named "Zona" at the "Scripts" .ini-file session.

In the config file I set the key to "<xyscripts>\Zona.xys", so I would like to run the "Zona.xys" script-file.

But, when it tries to load $ax, it results the error:
Script file '<xyscripts>\Zona.xys' not found.
load
<xyscripts>\Zona.xys

"s"
I understand that I could put just "Zona.xys" at the config file, 'cause "load" dows support full or relative path, but how could I make it to run fine this mood? I've tried eval() to the $ax, but it didn't worked.

Any idea?

Thanks in advance.

highend
Posts: 14940
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: [Help with code] Load $var

Post by highend »

That's your problem, the value of the key is a string and the variable <xyscripts> isn't resolved because of that.

Eval() is the right way but you have to quote it correctly.

Try:

Code: Select all

load eval("""$ax""");
One of my scripts helped you out? Please donate via Paypal

rebr
Posts: 41
Joined: 17 Nov 2013 20:30

Re: [Help with code] Load $var

Post by rebr »

I found this:
http://www.xyplorer.com/xyfc/viewtopic.php?f=3&t=11935
And was going to implement the solution you've posted there, but you've just answered like that... and it's pretty more simple.

It worked this way:

Code: Select all

"Zona...|<xyicons>\shapes\Boia.ico"
  $ac = "<xydata>\xr\xr-conf-geral.ini"; $se = "Scripts"; $li = "Zona";
  $ax = getkey("$li", "$se", "$ac", "1");
  $ax = eval("""$ax""");
  load "$ax", "", '"s"';
I always have problem with the ammounted ""s...

Last night I was remembering the mIRC scripts where the []s was used to evaluate the codes.
There it would be solved something like that:
[ [ [ <xyscripts> ] $+ ] \Zona.xys ]

BTW, tks a lot, highend!

Post Reply