mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Jan 2003
Posts: 87
T
Tat Offline OP
Babel fish
OP Offline
Babel fish
T
Joined: Jan 2003
Posts: 87
.$submenu($mysubmenu($1))

Code:
alias mysubmenu {
if ($1 == begin) return -
if ($1 == end) return -
return $read(insults.txt,$1) : /say $read (insults.txt,$1)
}
 


Now, this code may look right. But typically this hits a huge hitch where it takes a lot longer than it should. This is the common usage in a lot of scripts and it's actually wrong.

When the read fails, it still returns something. Though without a title it won't show up. But, it seems to keep running the $submenu until it runs out it hits the limit at 250. This causes a slowdown in a number of bots that are coded under the idea that if the $submenu item doesn't get a title it stops running. Rather than churning away and wasting two seconds.

Joined: Apr 2003
Posts: 701
K
Hoopy frood
Offline
Hoopy frood
K
Joined: Apr 2003
Posts: 701
Using the $read twice already slows it down enough
Code:
alias mysubmenu {
  if ($1 == begin) return -
  if ($1 == end) return -
  if ($read(insults.txt,$1)) return $v1 $+ :say $v1
}


If it's a long list, this is probably even faster:
Code:
alias mysubmenu {
  if ($1 == begin) {
    .fopen fhi insults.txt
    return -
  }
  if ($1 == end) {
    .fclose fhi
    return -
  }
  if ($fread(fhi)) return $v1 $+ :say $v1
}

And back to the forum topic: no this isn't a mIRC bug, it's bad scripting. If you see scripts like that, it's a good indication that you want another script or should do it yourself...

Joined: Apr 2004
Posts: 871
Sat Offline
Hoopy frood
Offline
Hoopy frood
Joined: Apr 2004
Posts: 871
In other news, mIRC allows scripters to forget "/inc %i" in their while loops


Saturn, QuakeNet staff
Joined: Sep 2004
Posts: 200
I
Fjord artisan
Offline
Fjord artisan
I
Joined: Sep 2004
Posts: 200
thats why im going to make a script debugger smile
it happends to me way to much, and sometimes i loose the changes i made frown

Joined: Apr 2004
Posts: 871
Sat Offline
Hoopy frood
Offline
Hoopy frood
Joined: Apr 2004
Posts: 871
This is totally off-topic, but you do know that you can just press ctrl+break to stop a script in such situations, right?


Saturn, QuakeNet staff

Link Copied to Clipboard