|
Joined: Apr 2007
Posts: 228
Fjord artisan
|
OP
Fjord artisan
Joined: Apr 2007
Posts: 228 |
I've been thinking about this for a while, but I'm not sure how I'd pull it off. Something with $read, I'm sure, but I don't /what/ to do with $read. Basically, let's say if $nick join #, and if $nick matched a line in a .txt file, it would run a command on them.
Something like
if ($nick isin $read(friends.txt)) { msg $chan Hi there buddy! }
But that'd pick a random line. And I'm sure that's not a valid format. Just a demonstration of sorts.
Ideas?
|
|
|
|
Joined: Oct 2004
Posts: 8,330
Hoopy frood
|
Hoopy frood
Joined: Oct 2004
Posts: 8,330 |
Actually, your format is valid. And, yes, that picks a random line. If you wanted a specific line, you could include that. If the lines were specific to the nicks, you could also use $readini and then get the line for that specific nick. Of course, nicer method is using hash tables to store the information. Here's a quick example:
on *:start: {
NickRespTable
}
alias NickRespTable {
hmake NickResp 100
if ($exists($scriptdir\NickResp.txt)) { hload NickResp $scriptdir\NickResp.hsh }
}
on *:join:#: {
if (!$hget(NickResp)) { NickRespTable }
if ($hget(NickResp,$nick)) { msg $chan $v1 }
}
alias AddNewNickResp {
if (!$hget(NickResp)) { NickRespTable }
hadd NickResp $$?="Enter a nickname" $$?="Enter the message"
hsave NickResp $scriptdir\NickResp.hsh
}
alias RemNickResp {
if (!$hget(NickResp)) { NickRespTable }
var %nick = $iif($1,$1,$$?="Enter Nick")
if ($hget(NickResp,%nick)) { hdel NickResp %nick }
hsave NickResp $scriptdir\NickResp.hsh
}
menu channel,status {
Nick Responder
.Add Nick:AddNewNickResp
.Remove Nick:RemNickResp
}
menu nicklist,query {
Nick Responder
.Add $1:AddNewNickResp $1
.Remove $1:RemNickResp $1
}
You can add and remove nicks/messages by right clicking in the channel, status, or query window, or in the nick list.
Invision Support #Invision on irc.irchighway.net
|
|
|
|
Joined: Apr 2007
Posts: 228
Fjord artisan
|
OP
Fjord artisan
Joined: Apr 2007
Posts: 228 |
Er... the $nick was just an example, really. ANYWAY. A. What's a hash table? B. How do you create one of those nice clicky menus? I read the help file on popups, it went straight through one ear and out the other. That could be REALLY nice for sending certain information to my bot. EDIT: Okay, so I played with it, and I made this up: MsgMyself
.Food
..Cake:/msg $me You bake yourself a cake
..Ice Cream:/msg $me You serve yourself a bowl of ice cream
.Drink
..Coke:/msg $me You hand yourself a Coke
..Sprite:/msg $me You hand yourself a Sprite
I put that in the "popups" tab, which I've never touched before. The name of the file in the popups tab was "status" So I try it in the status window, worked pretty well, except for the fact that it /msg's itself twice instead of once. Oops, nevermind, that was me sending it to myself, and me receiving. -facepalm-And it only works in the status window. Questions: 1.How do you make it work in any window? 2.How do you put a popup in the script? 3.How do you ask for data to be inputed in a popup? 4.How do you ask a series of questions and then perform one command with that data*** ***: Example: I rightclick on the nickname "IcyBot" on the nicklist, and one of the options, below kick and ban and kickban and stuff, separated with a line (- on a line by itself, says helpfile) and the option is "Add a bar". So then, when I click that, a window comes up asking for the call up code and I input the data and press ok, then another comes up asking for the nickname and I input the data and press ok, and then another comes up asking for the bar, and when I press OK it sends a command to the bot with "!addbar $$1 $$2 $$3" or something like that. I know, wall of text, but I kinda got excited.
Last edited by Mpot; 10/10/07 10:06 PM.
|
|
|
|
Joined: Apr 2007
Posts: 228
Fjord artisan
|
OP
Fjord artisan
Joined: Apr 2007
Posts: 228 |
Alright. Let's say I rightclick on my bot's nickname on the nicklist, and below all the options, it has "send bar"
So I click on it and I get three popup boxes, one after the other
Input data, press OK, script sets %data1 with $?, next box comes up Input data, press OK, script sets %data2 with $?, next box comes up Input data, press OK, script sets %data 3, messages bot with %data1 %data2 %data3
I think I know how to make the menu come up, but I'm not sure how to make it open three boxes like that...
|
|
|
|
Joined: Apr 2003
Posts: 342
Fjord artisan
|
Fjord artisan
Joined: Apr 2003
Posts: 342 |
Can't this be done using the -s switch on the $read fuction. It finds the first line that begins w/ that string and returns it.
Beware of MeStinkBAD! He knows more than he actually does!
|
|
|
|
Joined: Apr 2007
Posts: 228
Fjord artisan
|
OP
Fjord artisan
Joined: Apr 2007
Posts: 228 |
Er, please read the whole thread next time. We've moved on to popups.
Speaking of popups, does anyone have ideas?
|
|
|
|
Joined: Oct 2004
Posts: 8,330
Hoopy frood
|
Hoopy frood
Joined: Oct 2004
Posts: 8,330 |
Just use $input or $?=""...
alias GetInfo {
var %data1 = $?="Enter 1"
var %data2 = $?="Enter 2"
var %data3 = $?="Enter 3"
echo -a %data1 ~ %data2 ~ %data3
}
You can do the same thing with $input. Just remember that you can't put $input or $?="" in certain events unless you use a timer.
Invision Support #Invision on irc.irchighway.net
|
|
|
|
Joined: Apr 2007
Posts: 228
Fjord artisan
|
OP
Fjord artisan
Joined: Apr 2007
Posts: 228 |
Ah! I never even considered aliases. Alright, how good is this: (appended to the end of the Nick List popup file) -
Send Bar:/icybotbar
alias icybotbar {
set %bardata1 $?="Callup Code?"
set %bardata2 $?="Nickname for greet?"
set %bardata3 $?="Color banner?"
msg IcyBot !addbar %bardata1 %bardata2 %bardata3
unset %bardata1
unset %bardata2
unset %bardata3
} Will that come up with an input box, and the two buttons being either "OK" or "Cancel"? And it brings up the three boxes in succession? ANd then sends? Perhaps, put the alias in it's own script?
Last edited by Mpot; 12/10/07 10:43 PM.
|
|
|
|
Joined: Oct 2004
Posts: 8,330
Hoopy frood
|
Hoopy frood
Joined: Oct 2004
Posts: 8,330 |
Why not just test it?
And the alias doesn't need to be in a separate file.
Invision Support #Invision on irc.irchighway.net
|
|
|
|
Joined: Apr 2007
Posts: 228
Fjord artisan
|
OP
Fjord artisan
Joined: Apr 2007
Posts: 228 |
I'm not a fan of testing things like that, because I usually feel like I'll royally bugger something up. Could you tell me if that's valid?
|
|
|
|
Joined: Feb 2007
Posts: 75
Babel fish
|
Babel fish
Joined: Feb 2007
Posts: 75 |
From the quick glance I took, it should work fine as it is.
Royal Bugger ups happen, but it's very unlikely with a simple popup mod you are doing. If your popup isn't working because of it, just remove the bits of code you added. On the other hand you could install another copy of mIRC and use it to test code if you are afraid of breaking the one you use.
GigIRC Network Admin irc.gigirc.com
|
|
|
|
Joined: Apr 2007
Posts: 228
Fjord artisan
|
OP
Fjord artisan
Joined: Apr 2007
Posts: 228 |
Is there a way I can set this to ONLY pop-up if the nickname right-clicked on in the nickname listbox is IcyBot? Perhaps an if $nick == IcyBot ? If so, where?
|
|
|
|
Joined: Oct 2004
Posts: 8,330
Hoopy frood
|
Hoopy frood
Joined: Oct 2004
Posts: 8,330 |
Change $nick to $1 and put it into an $iif().
As for testing, run it on a test client and change things and make sure it works there. You'll have your answer more quickly than asking here and it saves us time trying to look through your code when you could have gotten your answer in 5 seconds yourself.
Invision Support #Invision on irc.irchighway.net
|
|
|
|
Joined: Apr 2007
Posts: 228
Fjord artisan
|
OP
Fjord artisan
Joined: Apr 2007
Posts: 228 |
|
|
|
|
Joined: Oct 2004
Posts: 8,330
Hoopy frood
|
Hoopy frood
Joined: Oct 2004
Posts: 8,330 |
/help $iif If you're going to put it into a menu, you'll want to use $iif.
menu nicklist {
$iif($1 == whatever,Show this menu option):Do this
}
Note that you can leave off the "false" part like I did if you don't need it to do something when it's not true.
Invision Support #Invision on irc.irchighway.net
|
|
|
|
Joined: Apr 2007
Posts: 228
Fjord artisan
|
OP
Fjord artisan
Joined: Apr 2007
Posts: 228 |
I don't really understand how to integrate this into the script I scraped up.
|
|
|
|
Joined: Apr 2007
Posts: 228
Fjord artisan
|
OP
Fjord artisan
Joined: Apr 2007
Posts: 228 |
Anyone?
Last edited by Mpot; 14/10/07 11:46 PM.
|
|
|
|
Joined: Apr 2007
Posts: 228
Fjord artisan
|
OP
Fjord artisan
Joined: Apr 2007
Posts: 228 |
Furthermore: Is there an identifier that can check the mode on a channel? Ex: if ($mode == +c) { msg $chan Sorry, colors are disabled on $chan $+ . You'll need to find somewhere else to play Uno. } (Not saying that $mode exists, just sort of an idea of what I'm looking for) FURTHERMORE: You know the users list? Well, is there an identifier for that? Perhaps something like: if ($user($nick) == syscon) { msg $nick You can not ban a bot operator! } EDIT: Could it be (if $level($address($2,2)) == syscon) { msg $nick You can not ban a bot operator! }
Last edited by Mpot; 14/10/07 11:58 PM.
|
|
|
|
Joined: Dec 2002
Posts: 2,033
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 2,033 |
Is there an identifier that can check the mode on a channel?
if (c isincs $chan(#chan).mode) { msg $chan Sorry, colors are disabled on $chan $+ . You'll need to find somewhere else to play Uno. }
~ Edit ~
Corrected typo from isncs to isincs
|
|
|
|
Joined: Nov 2006
Posts: 1,559
Hoopy frood
|
Hoopy frood
Joined: Nov 2006
Posts: 1,559 |
if ($user($nick) == syscon) { msg $nick You can not ban a bot operator! } EDIT: Could it be (if $level($address($2,2)) == syscon) { msg $nick You can not ban a bot operator! } Try a if ($istok($remove($level(NICK/MASK),=),YOURLEVEL,44)) { stuff } NICK/MASK depends on how you added users to your user list change YOURLEVEL to the level you assigned to bot operators I used "istok" as you can assign more than one level per entry of the users list; and I used "$remove(bla,=)" to get arround forced levels. It's not airtight (named levels could contain a = char)... Anyway, I just want to point in that direction.
Last edited by Horstl; 15/10/07 03:32 AM.
|
|
|
|
|