mIRC Home    About    Download    Register    News    Help

Print Thread
#27571 01/06/03 11:48 PM
Joined: Mar 2003
Posts: 36
B
bugx Offline OP
Ameglian cow
OP Offline
Ameglian cow
B
Joined: Mar 2003
Posts: 36
var %contsock = 1
set [ %link. $+ [ %contsock ] $+ .total ] just_a_sample

this make a variable :

%link.1.total just_a_sample

but i can't read it

i try like 6 types of [ ] and can't return me "just_a_sample"

echo -a %link.1.total

the problem is than the number 1 is a variable and
need [ brackets ]

#27572 01/06/03 11:54 PM
Joined: May 2003
Posts: 730
S
Hoopy frood
Offline
Hoopy frood
S
Joined: May 2003
Posts: 730
echo -a %link. [ $+ [ %var ] $+ .total ]


Last edited by ScatMan; 01/06/03 11:54 PM.
#27573 02/06/03 03:14 AM
Joined: Feb 2003
Posts: 2,812
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2003
Posts: 2,812
Now that there's $+() and $eval, I find this method wholly more simple. Not quite as oldskool, but easier to remember late at night.

set $+(%,link.,%countsock,.total) just_a_sample
echo -a $eval($+(%,link.,%countsock,.total),2)


For older versions of mIRC, I'd recommend my /array alias:

/array {
if ( $prop == val ) return % [ $+ [ $remove($1-,$chr(32)) ] ]
return % $+ $remove($1-,$chr(32))
}


set $array(%,link.,%countsock,.total) just_a_sample
echo -a $array(%,link.,%countsock,.total).val


However to do it with brackets, I'm pretty sure this was the most accepted way.

set %link. [ $+ [ %countsock ] $+ ] .total just_a_sample
echo -a %link. [ $+ [ %countsock ] $+ ] .total


You would continue just adding [ $+ [ variable ] $+ ] around each variable, and [ $+ [ variable ] ] if you wanted to end it with a variable. If you had two variables next to eachother, it'd be slightly different too. </headache>

- Raccoon

PS. I find it interesting how the same number of brackets are used in both /set and /echo, yet mIRC evaluates the variable differently and correctly in each case. This is probably why $eval was created, because brackets may have given undesired/unpredictable results.


Well. At least I won lunch.
Good philosophy, see good in bad, I like!

Link Copied to Clipboard