mIRC Home    About    Download    Register    News    Help

Print Thread
load unload script #191597 12/12/07 04:41 PM
Joined: Feb 2007
Posts: 91
S
spermis Offline OP
Babel fish
OP Offline
Babel fish
S
Joined: Feb 2007
Posts: 91
I need a very simple script.
So if user with 100 level writes !load script1.mrc it will load the script1.mrc on the bot client., and if it will write !unload script1.mrc it will unload the script1.mrc on the bot client, and also will show notice to user - Loaded/Unloaded script1.mrc

Re: load unload script [Re: spermis] #191599 12/12/07 04:49 PM
Joined: May 2007
Posts: 89
T
TropNul Offline
Babel fish
Offline
Babel fish
T
Joined: May 2007
Posts: 89
For this task, you only need to know the < on text > event, the commands < /load , /unload , /notice > and you're done. Using the help file on these will definitely help you write the code yourself. smile

Here's a piece of code that should do it though.
Code:
; with floodcheck
On $100:Text:/^!((?:un)?load\s[^\s]+\.mrc)$/Si:#channelnamehere:{ 
  If !%busyload {
    NoOp $regml(1)
    Notice $nick - $regml(1) - Ok!
    Set -z5 %busyload processing...
  }
  Else { .Timer 1 1 notice $nick please wait... }
}

; without floodcheck
On $100:Text:/^!((?:un)?load\s[^\s]+\.mrc)$/Si:#channelnamehere:{ 
  NoOp $regml(1)
  Notice $nick - $regml(1) - Ok!
}


Cordialement smile

Ps: untested code
Ps: rather than using the above code, I really ask you to to code it with the help of what I've told you to look for smile. Use < if, elseif, else > to make conditions on whether < !load > or < !unload > was sent to the server. Upto here, you are at 75% to finish the script.

Edit1: I couldn't help myself from not adding a floodcheck :s. Sorry if that is not what you wanted. For that reason, I've also included the version without the floodcheck.
Edit2: replaces < [^\.]+ > by < [^\s]+ > in the regular expression.

Last edited by TropNul; 12/12/07 06:09 PM.

tropnul
Re: load unload script [Re: TropNul] #191610 12/12/07 06:23 PM
Joined: Jan 2007
Posts: 1,156
D
DJ_Sol Offline
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2007
Posts: 1,156
Id be carefull as the code listed would allow them to unload any file they wanted to as long as they had the user level and knew the file name.

Consider using Groups to turn on or off features as well. Or a switch like a variable or hash table entry.

Code:
#group on
on *:join:#:{ special code }
#group end

on *:join:#:{
if (!%switch) { return }
}

on *:join:#:{
if (!$hget(table,item)) { return }
}


Here are some examples. Or, of course you could hardcode the file name to be loaded or unloaded.

Re: load unload script [Re: DJ_Sol] #191614 12/12/07 09:17 PM
Joined: Feb 2007
Posts: 91
S
spermis Offline OP
Babel fish
OP Offline
Babel fish
S
Joined: Feb 2007
Posts: 91
the level 100 in my bot is only for owner - me ^^