mIRC Home    About    Download    Register    News    Help

Print Thread
One or several files ?? #123189 20/06/05 11:14 PM
Joined: Aug 2003
Posts: 144
M
Miguel_A Offline OP
Vogon poet
OP Offline
Vogon poet
M
Joined: Aug 2003
Posts: 144
Hi people.
What is the best way to have a big performance and a quicker reply from the event and/or bot ??

is having one file with all the script in it
is having several files
is having one event per file
etc ... etc ... etc

what is the best way ??

Re: One or several files ?? #123190 21/06/05 05:53 AM
Joined: Sep 2003
Posts: 4,230
D
DaveC Offline
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
I would keep all your bots scripts to one file.
Reason : simply to keep it all together.

If you have alot of events ie: !bot !help !blah !wobble !etc !etc !etc, i would place them all on the same event using *:TEXT:*:#channel etc.
Reason : matchtexts are checked before channel matching is done, so each line in each channel is matched against all ON TEXT events and then the channel is checked for matching.
This means if you had 20 ON TEXT events for your channel then , every line in lets say the other 12 smile channels your on is checked 20 times, then rejected because of the channel.
... Per line 20 matchtexts & a possable (only if matchtext was true) channel match check which fails
vs 1 ON TEXT:*: every line is matched to * then rejected due to channel
... Per line 1 match (which always sucseeds) & one channel match check which fails

* I well say however this is a method I percieved to be less cpu intensive, I have not attempted to prove it.

Re: One or several files ?? #123191 21/06/05 07:20 AM
Joined: Apr 2005
Posts: 18
B
BarGarth Offline
Pikka bird
Offline
Pikka bird
B
Joined: Apr 2005
Posts: 18
Quote:

If you have alot of events ie: !bot !help !blah !wobble !etc !etc !etc, i would place them all on the same event using *:TEXT:*:#channel etc


if all these events start with a ! it's probably better to use:

Code:
 
on *:TEXT:!*:#channel :..
 


which only reacts at matches with a !.
Suppose the body of the event looks something like this:

if ($1 == !bot) { .. }
elseif ($1 == !hep) { .. }

it prevents the bot from checking all those if statements in case the match-text doesn't start with a !.

Re: One or several files ?? #123192 21/06/05 12:40 PM
Joined: Sep 2003
Posts: 4,230
D
DaveC Offline
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
All the !words were examples, the * was used as i this was not about specific triggers but a general discussion, i didnt want to infer the use of ON *:TEXT:!*:#channel was going to catch everything you might be comparing for.

Quote:
if ($1 == !bot) { .. }
elseif ($1 == !hep) { .. }

yes if its a small script, if its something with alot of triggers ill use this
*** Dare i say it im using GOTO ***
Code:
on *:text:*?:channel {
  if (!$istok(!blah !wobble @ops !etc ^powerup etc etc etc,$1,32)) { halt }
  goto goto $+ $1
  :goto@ops { ...... | goto end }
  :goto!etc { ...... | goto end }
  :goto^powerup { ...... | goto end }
  :gotoetc { ...... | goto end }
  :gotoetc { ...... | goto end }
  :gotoetc { ...... | goto end }
  :end
}

Re: One or several files ?? #123193 21/06/05 05:57 PM
Joined: Aug 2003
Posts: 144
M
Miguel_A Offline OP
Vogon poet
OP Offline
Vogon poet
M
Joined: Aug 2003
Posts: 144
Hi again.
Thanks for the help.