mIRC Home    About    Download    Register    News    Help

Print Thread
#250223 05/01/15 11:23 PM
Joined: Dec 2014
Posts: 18
D
Pikka bird
OP Offline
Pikka bird
D
Joined: Dec 2014
Posts: 18
I want to type !setlobby Lobby 14 and it stay there for when a regular user says !lobby.
Example
Admin: !setlobby Lobby 14, come and play with us!
Regular User: !lobby Lobby 14 come and play with us!

Any help would be greatly appreciated!

Joined: Dec 2013
Posts: 779
N
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
Code:
on *:text:!lobby*:#: { 
if (($2 isnum) && ($nick == Admin)) set %lobby $2
else msg # Lobby %lobby $+ , come and play with us!
}


/help on text
/help if then else
/help variables


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net
Nillen #250227 06/01/15 12:02 AM
Joined: Dec 2014
Posts: 18
D
Pikka bird
OP Offline
Pikka bird
D
Joined: Dec 2014
Posts: 18
I did that, but the response I get is : , come and play with us! ?
like it completely ignored everything before the comma.

Joined: Dec 2013
Posts: 779
N
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
Step 1: Paste this into a new remote file
Step 2: Change "Admin" to your own nick
Step 3: type !lobby 14
Step 4: type !lobby

The $nick you replace Admin with will be the only one able to change the lobby number, everyone else will get the number returned to them if they type it.


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net
Joined: Jan 2015
Posts: 40
J
Ameglian cow
Offline
Ameglian cow
J
Joined: Jan 2015
Posts: 40
This is the exact setup that I use for a !setlobby

The purpose for ($nick isin %mods) is because at times I notice twitch removes mod/op status from all users, myself included and my mod only commands fail. By creating a new variable %mods and adding my mods into it, I can get around this issue.

ex:
%mods giantwaffle sevadus jimieo
They just need to have one space between them.

Code:
on *:text:!setlobby*:#jimieo:{
  if (($nick isop #) || ($nick isin %mods)) {
    if ((%floodsetlobby) || ($($+(%,floodsetlobby.,$nick),2))) { return }
    set -u5 %floodsetlobby On
    set -u5 %floodsetlobby. $+ $nick On  
    set %lobby $2-
    msg $chan /me Command !lobby has been updated!
  }
  else { }
}
on *:text:!lobby*:#jimieo:{
  if ((%floodlobby) || ($($+(%,floodlobby.,$nick),2))) { return }
  set -u5 %floodlobby On
  set -u5 %floodlobby. $+ $nick On  
  msg $chan /me %lobby
}


jimieo #250243 06/01/15 11:24 AM
Joined: Dec 2013
Posts: 779
N
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
A vulnurability of using isin as such will let other people named "jimi" match isin %mods if Jimieo is written there, letting them take control of the same access any other op would have.

For twitch, I recommend using ini files (as always) to keep check of information.
Code:
on 1:op:#: writeini ops.ini # $nick 1
alias mod return $readini(ops.ini,#,$1)

on *:text:!test:#: { 
if ($mod($nick)) msg # User is a mod 
else msg # User is not a mod
}
on *:text:!mod &:#: { 
if ($nick != $mid(#,2-)) return
if ($mod($nick)) msg # $2 is already a mod.
else { 
msg # .mod $2
msg # $2 is now a mod.
}
}
on *:text:!unmod &:#: { 
if ($nick != $mid(#,2-)) return
if ($mod($nick)) { 
remini ops.ini # $2
msg # .unmod $2
msg # $2 is no longer a mod.
}
else msg # $2 is not a mod.
}


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net
Nillen #250252 06/01/15 09:37 PM
Joined: Jan 2015
Posts: 40
J
Ameglian cow
Offline
Ameglian cow
J
Joined: Jan 2015
Posts: 40
I had not thought of that. Luckily I had not had issues with it so far. Thank you.

Nillen #250256 06/01/15 10:04 PM
Joined: Jan 2015
Posts: 40
J
Ameglian cow
Offline
Ameglian cow
J
Joined: Jan 2015
Posts: 40
I just tried out the code you provided. No ops.ini file was created. I manually put one in my scripts folder, but still failed to show that the users are mods.

Originally Posted By: Nillen
A vulnurability of using isin as such will let other people named "jimi" match isin %mods if Jimieo is written there, letting them take control of the same access any other op would have.

For twitch, I recommend using ini files (as always) to keep check of information.
Code:
on 1:op:#: writeini ops.ini # $nick 1
alias mod return $readini(ops.ini,#,$1)

on *:text:!test:#: { 
if ($mod($nick)) msg # User is a mod 
else msg # User is not a mod
}
on *:text:!mod &:#: { 
if ($nick != $mid(#,2-)) return
if ($mod($nick)) msg # $2 is already a mod.
else { 
msg # .mod $2
msg # $2 is now a mod.
}
}
on *:text:!unmod &:#: { 
if ($nick != $mid(#,2-)) return
if ($mod($nick)) { 
remini ops.ini # $2
msg # .unmod $2
msg # $2 is no longer a mod.
}
else msg # $2 is not a mod.
}

jimieo #250257 06/01/15 10:19 PM
Joined: Dec 2013
Posts: 779
N
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
Did you actually witness the $nicks becoming ops?
Originally Posted By: Help files
The on OP and on DEOP events trigger when a user on a channel is opped or deopped.

Format: on <level>:OP:<#[,#]>:<commands>
Example: on 1:OP:#mirc,#irchelp:/msg $nick Please do not abuse your Op status

When you say you manually put one in your scripts folder, that's wrong at first, it doesn't go to scripts, it goes to the default $mircdir, not $mircdir\scripts.

It should look like this after made:
$mircdir\ops.ini
[#jimieo]
jimieo=1


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net
Nillen #250259 06/01/15 11:38 PM
Joined: Jan 2015
Posts: 40
J
Ameglian cow
Offline
Ameglian cow
J
Joined: Jan 2015
Posts: 40
I am ashamed to admit my mistake here.. I was focused on the command itself instead of realizing that my bot was NOT able to grand mod status in the channel.

I have since switched the script to a new client which is opped in its own channel. I am still having the issues of it not writing to the ops.ini file. I manually added
"[#jimieo]
jimieo=1" into the file, but the read still failed. To confirm, the ops.ini file goes into: C:\Users\[user]\AppData\Roaming\mIRC, correct?


However this gave me an idea. Do you believe it is possible to have the bot do /mods then add the responding list into the ops.ini? It could be a timer based function to run every few minutes or so.


Last edited by jimieo; 07/01/15 05:17 AM.

Link Copied to Clipboard