I have been working on a mirc rpg-character-name-generator lately and so far everything worked out fine.
If it weren't for one little part of the script:
alias limited {
var %first
var %amount
%amount = $did(namegen,3)
var %limit
%limit = $did(namegen,11)
:begin
%first = $read(namegen\pre.txt) $+ $read(namegen\suff.txt)
if ($len(%first) <= $len(%limit)) { did -a namegen 5 %first | goto next }
else goto begin
:next
dec %amount
if (%amount != 0) goto begin | else goto end
:end
last
}
When this alias is used it freezes my mIRC for some reason.
Any idea why it does this? Thanks.
Hi... maybe this $len(%first) <= $len(%limit) is never true... can't remember anything else that could be wrong...
Thanks for the reply, though i don't think thats the problem, even when %limit is really high it still does it.
AFAIK thats not necessary.
Is %limit a number of chars allowed or a representer of length such as XXXXX represents 5, becuase your not checking if the length of %first is <= to %limit but the length of the string in limit.
maybe it should be
if ($len(%first) <= %limit) { ...
If thats not right then i would say you have a problem in the data thats being used somwehere.
replace your script with this...
alias limited {
var %first
var %amount
%amount = $did(namegen,3)
var %limit
%limit = $did(namegen,11)
echo -s $time CP1 "%amount" %amount -- "%limit" %limit -- "%limit-lenth" $len(%limit)
:begin
%first = $read(namegen\pre.txt) $+ $read(namegen\suff.txt)
echo -s $time CP2 "%amount" %amount -- "%first" %first -- "%first-length" $len(%first)
if ($len(%first) <= $len(%limit)) { did -a namegen 5 %first | goto next }
else goto begin
:next
dec %amount
echo -s $time CP3 "%amount" %amount
if (%amount != 0) goto begin | else goto end
:end
last
}
I just added 3 check points, that display relevent data to that section into the status window. you should be able to see where its looping when it shouldnt.
ps ctrl-break should halt it.
Is %limit a number of chars allowed or a representer of length such as XXXXX represents 5, becuase your not checking if the length of %first is <= to %limit but the length of the string in limit.
maybe it should be
if ($len(%first) <= %limit) { ...
That actually worked!!
Thanks, I can't believe it was actually something this simple.