mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Mar 2003
Posts: 29
Y
Ameglian cow
OP Offline
Ameglian cow
Y
Joined: Mar 2003
Posts: 29
This script was originally meant to play with binary variables, however...

alias bintest {
var %y = 0
echo %y
while (%y < 256) {
bset &a $calc(%y + 1) $chr(%y)
inc %y
}
echo -a var: $bvar(&a,1,$bvar(&a,0))
echo -a text: $bvar(&a,1,$bvar(&a,0)).text
}

and when I run it I get...

* /echo: insufficient parameters (line 3, btest.mrc)

It's loaded under remote scripts...other aliases work just fine that use the /var command, so why doesn't this one work? I tried restarting mIRC, rebooting, even reinstalling and still it fails to work. I took out the echo (it wasn't there originally) and then the /bset command fails due to too few params too.

for example, this alias which is in the SAME .mrc file works without fail

alias ascii {
window -n @tmp
var %x = 0
while (%x < 256) {
echo @tmp %x $chr(9) text $chr(9) $chr(%x) $chr(9) text
inc %x
}
}

I tried switching variable names, values, everything, but still it doesn't work. Anyone know how to fix this bug?

Joined: Mar 2003
Posts: 29
Y
Ameglian cow
OP Offline
Ameglian cow
Y
Joined: Mar 2003
Posts: 29
it appears appears $chr(0) is equal to $null (funny they don't mention it in the $null identifer section). However I still don't understand why the echo %y wasn't working because it wasn't in the $chr() identifier.

Also, does this mean there's no way to set a &binvar to 00000000?
(actually there are a LOT of $chr()'s that don't work, so how do you set binary variables to them?)

Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
And what exactly is the bug?

/echo [color] [-cdeghiNtsaqlbfnmr] [color name] [#channel|[=]nick] <text>

Do you see that first optional parameter [color]? If you put a color code there, the echo alias will output the text in that specified color. Since you are doing /echo -a %y, with %y being 0, mIRC interprets that as the color code, but you don't specify a text to be echoed, so it fails.

alias bintest {
var %y = 0
echo -a value: %y
while (%y < 256) {
bset &a $calc(%y + 1) %y
inc %y
}
echo -a var: $bvar(&a,1-)
}

/help binary variables, look up the -t switch while you're at it

Greets

EDIT:

Quote:
Also, does this mean there's no way to set a &binvar to 00000000?
(actually there are a LOT of $chr()'s that don't work, so how do you set binary variables to them?)

I don't possibly see how you could fill a variable with multiple $nulls, since 1000*nothing = nothing. If you want to set multiple zero's ($chr(48)) then use the -t switch, or don't use it but specify 48 then.

Last edited by FiberOPtics; 16/11/04 01:13 AM.
Joined: Mar 2003
Posts: 29
Y
Ameglian cow
OP Offline
Ameglian cow
Y
Joined: Mar 2003
Posts: 29
I thought the -t switch was just for putting a whole string of characters into a &binvar rather than just one.
*checks mIRC help file*
not quite sure what it does without the -t switch then O.o

Also, I thought the [color] command requred a (ctrl+K) char before it would recognize it as a color parameter. Seems kinda silly that this isn't explained more in the help.

Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
I don't know how it can be clearer...the first example used is one with the color option.

From the help file:
---------------------

/echo [color] [-cdeghiNtsaqlbfnmr] [color name] [#channel|[=]nick] <text>

/echo 3 #mIRC Testing

would print "Testing" in the color green in channel window #mIRC, assuming it's already open.

*****************

Regarding the -t switch:

/bset [-t] <&binvar> <N> <asciivalue> [asciivalue ... asciivalue]

The -t switch indicates that /bset should treat the values as plain text and copy them directly into &binvar.

It means you don't have to specify the ascii numbers, but you can just put text, and it will be converted automatically. So instead of doing /bset &a 1 108 111 108, you can do /bset -t &a 1 lol


Gone.
Joined: Mar 2003
Posts: 29
Y
Ameglian cow
OP Offline
Ameglian cow
Y
Joined: Mar 2003
Posts: 29
ahh, the problem was when they say <asciivalue> in the /bset command it sounded like they wanted the CHARACTER and not the number. It would make more sense if it was written as /bset [-t] <%binvar> <N> <0-255> [0-255....0-255]

Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
Perhaps, but you could have found that out by experimenting a bit. That's how I did it.

Anyway, I suppose the best advice one can give you is to read the help file thoroughly, and to experiment.

If you still experience trouble with something afterwards, then feel free to post in the Scripts and Popups forum, there are plenty of scripters ready to assist you.

Greets


Gone.

Link Copied to Clipboard