mIRC Home    About    Download    Register    News    Help

Print Thread
#76155 22/03/04 07:48 PM
Joined: Mar 2004
Posts: 2
M
ManXP Offline OP
Bowl of petunias
OP Offline
Bowl of petunias
M
Joined: Mar 2004
Posts: 2
I have my script like this

on ^*:open:*:?: {
msg $query($nick) Text text text
}

hen user writes any PM for me, he gets this message in his query window. But i want to create new menu item for turning this script on/off. For example, you click on any menu and see menu item SCRIPT. If it's checked, script is working, if not - script is turned off. Thank you

#76156 22/03/04 08:25 PM
Joined: Dec 2002
Posts: 145
G
Vogon poet
Offline
Vogon poet
G
Joined: Dec 2002
Posts: 145
run this command:
//set %pmrpl OFF


Put the following in your script.ini file and you will be able to activate it from the channel or status menu.

menu channel,status {
PM REPLY $chr(58) %pmrpl $+ : {
if ( %pmrpl == OFF) {
set %pmrpl ON
.enable #pmrpl
}
else {
set %pmrpl OFF
.disable #pmrpl
}
}
}

#pmrpl off
on ^*:open:*:?: {
msg $query($nick) Text text text
}
#pmrpl end

#76157 22/03/04 08:51 PM
Joined: Mar 2004
Posts: 2
M
ManXP Offline OP
Bowl of petunias
OP Offline
Bowl of petunias
M
Joined: Mar 2004
Posts: 2
Hm, could i get more explanation, please? I removed all content from my script.ini and inserted your text. And... nothing frown

#76158 22/03/04 09:44 PM
Joined: Dec 2002
Posts: 208
C
Fjord artisan
Offline
Fjord artisan
C
Joined: Dec 2002
Posts: 208
Code:
on ^*:OPEN:*:?: {
  if (%setting.autoreply) { msg $nick Text text text }
}

menu menubar {
  -
  $iif(%setting.autoreply, $style(1)) Query AutoReply {
    set %setting.autoresply $iif(%setting.autoreply, 0, 1)
  }
}


all i did was use a varable as a flag to signal if that setting is on or off .. you could select any varable name for this as long as you are consistant thoughout the script. the menu menubar { tells mIRC to place that popup menu in the mIRC menubar (at the top between 'tools' and 'window' .. usualy called command but may be called something different depending on your script


you can change where the popup goes by changing the word 'menubar' to 'query' or 'channel' or 'status' or whatever ..

the alias uses mIRC's $style() feature to place a checkmark if the varable is on (set to 1) .. and do nothing if the varable is off (set to 0 or null) .. type /help $style to see more options for that.

$iif() is an identifer that alows you to use an if conditional statment as an identifer to return a value based on the condition given .. for example

$iif(1 == 1, yes, no) will return yes, because the condition is true,
$iif(1 == 2, yes, no) will return 'no', because the condition is false.

anouther way you could have gone about acomplishing this is by useing mIRC's #group feature .. where you can do

#group on/off
code
#group end

and you can /enable or /disable the group of code .. however i discourage useing #groups .. it makes very slopy code and causes alot of problems down the road if you get ingo very large scripting projects or being mixing scripting projects.

if you require more explination on my example feel free to ask, you can study how i did this and aply it to other areas in your script that you want to be able to turn on/off by a menu.


Cobra^

#76159 23/03/04 03:31 AM
Joined: Dec 2002
Posts: 145
G
Vogon poet
Offline
Vogon poet
G
Joined: Dec 2002
Posts: 145
Sorry, I didn't check your coding.

Format: on <level>:OPEN:<?|@|=|!|*>:<matchtext>:<commands>

Change
on ^*:open:*:?: {
msg $query($nick) Text text text
}

by

on *:open:?:*: msg $nick Text text text

Last edited by gemeau50; 23/03/04 03:33 AM.

Link Copied to Clipboard