|
|
Joined: Feb 2004
Posts: 7
Nutrimatic drinks dispenser
|
OP
Nutrimatic drinks dispenser
Joined: Feb 2004
Posts: 7 |
$ini() and $readini() will fail when using a temporary variable (set by /var) that stores a number. For example: var %users.total $ini(users.ini, 0) var %users.current 0 while (%users.total > %users.current) { inc %users.current var %nick $ini(users.ini, %users.current) ... } The script here will halt on line 5 "var %nick $ini(users.ini, %users.current)" with the error "* Invalid format: $ini (line 5, script.ini)"
The script will not halt if using a global variable (defined with /set) or if the %users.current variable returns anything other than a number. In this scenario, I simply changed the /vars to /sets and everything worked fine. -- [email]darkfire@dalnet[/email]
|
|
|
|
Joined: Dec 2002
Posts: 191
Vogon poet
|
Vogon poet
Joined: Dec 2002
Posts: 191 |
Try using the correct format for the var command.
/var %x = hello , not /var %x hello
/help /var
|
|
|
|
Joined: Feb 2004
Posts: 7
Nutrimatic drinks dispenser
|
OP
Nutrimatic drinks dispenser
Joined: Feb 2004
Posts: 7 |
Perhaps it is you that should look up /help /var. It is not necessary to use an = sign when defining a local variable, nor a global one. Thanks anyway.
|
|
|
|
Joined: Dec 2002
Posts: 191
Vogon poet
|
Vogon poet
Joined: Dec 2002
Posts: 191 |
Straight from the help file. Local Variables Local variables are variables that exist only for the duration of the script in which they are created and can only be accessed from within that script. They can be created with the /var command:
/var %x
This creates the local variable %x in the current routine and can only be referenced from inside this routine.
/var %x = hello
This creates a local variable %x and assigns it the value hello.
You can create multiple local variables by separating them with commas:
/var %x = hello, %y, %z = $me
loop { var %x = 1 :next echo item %x inc %x if (%x < 10) goto next }
Note: You can use /var -s to make a variable show the result when a value is set.
|
|
|
|
Joined: Feb 2004
Posts: 7
Nutrimatic drinks dispenser
|
OP
Nutrimatic drinks dispenser
Joined: Feb 2004
Posts: 7 |
That's nice. Now go try it yourself.
alias testing { var %x blah echo -a %x }
You'll be amazed.
|
|
|
|
Joined: Dec 2002
Posts: 191
Vogon poet
|
Vogon poet
Joined: Dec 2002
Posts: 191 |
I know that works sometimes but tends to break when using identifiers.
|
|
|
|
Joined: Feb 2004
Posts: 7
Nutrimatic drinks dispenser
|
OP
Nutrimatic drinks dispenser
Joined: Feb 2004
Posts: 7 |
It's never broken before. Regardless, I modified my /var statements to use the /var <variable> = <value> method and I resulted in the same error. It only happens when using $ini() and $readini() and when using a local variable that stores a numeric value; this is a bug in mIRC.
|
|
|
|
Joined: Nov 2003
Posts: 2,327
Hoopy frood
|
Hoopy frood
Joined: Nov 2003
Posts: 2,327 |
it does not break, the only time you have to specify an = sign is when you use: %x = hello without a /var or /set command
New username: hixxy
|
|
|
|
Joined: Dec 2002
Posts: 2,962
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 2,962 |
No. Nobodi is correct. The /var command should have an = sign. Although it will work sometimes without it, it has some unpredictable behaviour and causes seemingly random bugs, such as the one darkfire is experiencing.
Having just tested the code it shows it is a bug caused by the missing = signs.
Spelling mistakes, grammatical errors, and stupid comments are intentional.
|
|
|
|
Joined: Nov 2003
Posts: 2,327
Hoopy frood
|
Hoopy frood
Joined: Nov 2003
Posts: 2,327 |
never caused me any problems, not once.
New username: hixxy
|
|
|
|
Joined: Dec 2002
Posts: 2,962
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 2,962 |
Spelling mistakes, grammatical errors, and stupid comments are intentional.
|
|
|
|
Joined: Jan 2003
Posts: 428
Fjord artisan
|
Fjord artisan
Joined: Jan 2003
Posts: 428 |
never caused me any problems, not once. Heh... that's what I used to say about the = in the /var as well... and then, one day... things went wrong... PM
IRCnet & DALnet @#travelersinn :-: IRC for fun and relaxation :-:
|
|
|
|
Joined: Jan 2003
Posts: 2,523
Hoopy frood
|
Hoopy frood
Joined: Jan 2003
Posts: 2,523 |
As much as you don't want to admit it, it's /var without = that causes the problem. I'll give you an example of using $ini with mirc.ini to see what I mean.
//var %one = 1 | var %two = $ini($mircini,%one) | echo -a %two echoes "files" , which is the 1st section in mirc.ini
//var %one = 1 | var %two $ini($mircini,%one) | echo -a %two echoes * Invalid format: $ini
It spits out the same error as in your script.
The help file says /var should be used with a =. The fact that it works without = in some cases doesn't make it right.
/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
|
|
|
|
|
|