|
Joined: Apr 2007
Posts: 228
Fjord artisan
|
OP
Fjord artisan
Joined: Apr 2007
Posts: 228 |
I've decided on a project, writing my own bot. I've ran into a few snags. One of them being bot self protections, and another being userlists. The bot is using a userlist with access level syscon for bot operators. However, some of the bot's bot-ops change IPs frequently. I don't know how to write a remote-login for bot-ops, or maybe I should do syscon:$address(botopnick,2}Anyway, this is what I got for the unban: on 1:BAN:#:{
if ($banmask == $address($me,2)) { /mode $chan -b $banmask | halt }
}
EDIT: on * instead of on 1 fixed the unban. Is it possible to do $address($me,*), so that if the ban matches me at all it unbans?
|
|
|
|
Joined: Dec 2002
Posts: 3,547
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 3,547 |
For the unban script, you could try:
if ($banmask iswm $ial($me)) { do stuff }
As for the login script, this is a little something i did a little while ago. It can be improved alot, but I have to go to work soon so I can't edit it further, sorry.
menu channel,status {
$iif($dialog(ulst),$style(3)) User List: {
ulst open
}
}
On *:Disconnect: {
ulst save
if ($hget(loggedin_nicks)) hfree $v1
}
On *:Exit: {
ulst save
if ($isfile(loggedin_nicks.hsh)) remove loggedin_nicks.hsh
}
on *:start:{
if (!$hget(ulst)) { .hmake ulst 10 }
if ($exists(ulst.hsh)) { .hload -i ulst ulst.hsh }
}
dialog ulst {
title "User List"
size -1 -1 80 117
option dbu notheme
list 1, 2 2 77 87, size
box "", 2, 1 -2 79 92
button "&Add", 3, 9 92 31 11, flat
button "&Rem", 4, 40 92 31 11, flat
button "&Close", 5, 9 104 62 11, flat ok
}
On *:Dialog:ulst:*:*: {
if ($devent == init) {
var %x = 1
while (%x <= $hget(ulst,0).item) {
did -a $dname 1 $hget(ulst,%x).item
inc %x
}
}
if ($devent == sclick) {
if ($did == 3) {
var %ulst.add = $$input($cr,e,User List - Please add a nickname), %ulst.pw $$input($cr,e,User List - Please add a password)
ulst %ulst.add %ulst.pw
did -a $dname 1 %ulst.add
dialog -v ulst ulst
}
if ($did == 4) {
if (!$did($dname,1).sel) return
ulst -r $did($dname,1).seltext
did -d $dname 1 $didwm($dname,1,$did($dname,1).seltext,1)
}
}
}
alias ulst {
if (!$hget(ulst)) hmake ulst 10
if ($1 == -r) {
if (!$2) echo 2 -a * /ulst: insufficient parameters
elseif (!$hget(ulst,$2)) echo 3 -a * /ulst: $2 not in user list
else { hdel ulst $2 | echo 3 -a * Removed $+($chr(2),$2,$chr(2)) from user list }
}
elseif ($1 == -l) {
if ($hget(ulst,0).item < 1) echo 2 -a * user list empty
else {
echo 2 -a * ulst list:
var %x = 1
while (%x <= $hget(ulst,0).item) {
echo 3 -a $hget(ulst,%x).item
inc %x
}
}
}
elseif ($1 == save) hsave -i ulst ulst.hsh
elseif ($1 == open) dialog $iif($dialog(ulst),-v,-dm) ulst ulst
else {
if (!$2) echo 2 -a * /ulst: insufficient parameters
elseif (!$hget(ulst,$1)) && ($2 isalnum) { hadd ulst $1 $2 | echo 3 -a * Added $+($chr(2),$1,$chr(2)) to user list with password $+($chr(2),$2) }
else { echo 3 -a * /ulst: $1 is already in user list }
}
hsave -i ulst ulst.hsh
}
on 1:Text:login*:?: {
if (!$hfind(ulst, $2)) {
.notice $nick Sorry, your nickname is not in my user user list.
halt
}
if ($hfind(users, $2)) && (!$3) {
.notice $nick You didn't specify a password.
halt
}
if ($hfind(loggedin_nicks, $2)) {
.notice $nick You are already logged in.
halt
}
if ($hfind(ulst, $2)) && ($hget(ulst,$2) == $3) {
.notice $nick Authorisation to user $+($chr(2),$2,$chr(2)) has been accepted, you are now logged in.
hadd -m loggedin_nicks $2 Yes
hsave -i loggedin_nicks loggedin_nicks.hsh
halt
}
if ($hfind(ulst, $2)) && ($hget(users,$2) != $3) {
.notice $nick Password for account $+($chr(2),$2,$chr(2)) is incorrect.
halt
}
if ($hfind(ulst, $2)) && (!$3) {
.notice $nick You didn't specify a password.
halt
}
}
on 1:text:logout*:?: {
if ($2) {
if ($hfind(loggedin_nicks, $2)) {
hdel loggedin_nicks $2
hsave -i loggedin_nicks loggedin_nicks.hsh
.notice $nick You have successfully logged out.
halt
}
if (!$hfind(loggedin_nicks, $2)) && ($hfind(ulst,$2)) {
.notice $nick You are already logged out.
halt
}
}
}
on *:TEXT:*:?: {
;Commands if they're logged in
if ($hfind(loggedin_nicks, $nick)) {
;A simple op me script, commands are sent to query. Change if the ? to # if you want it in channels.
if (opme == $1) && ($me isop $2) mode $2 +o $nick
}
}
|
|
|
|
Joined: Apr 2007
Posts: 228
Fjord artisan
|
OP
Fjord artisan
Joined: Apr 2007
Posts: 228 |
I can't say I understand how the login script works.
|
|
|
|
Joined: Dec 2002
Posts: 3,547
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 3,547 |
It's pretty simple. Open up the dialog, click add. Then enter a username and password when prompted.
Then they type login <User> <Pass>, in a PM with you.
I should have added comments initially, but it is fairly straight forward.
|
|
|
|
Joined: Apr 2007
Posts: 228
Fjord artisan
|
OP
Fjord artisan
Joined: Apr 2007
Posts: 228 |
if ($chan == #uranme && %uranmeuno == off) { msg $chan Sorry, uno has been disabled on #uranme. | halt }
Will that work? I'm trying to combine two things here. It's part of my bot-op control. Basically, I want it to where if %uranmeuno is off, and the command is triggered on #uranme, then it halts. Can I combine operators like that?
|
|
|
|
Joined: Oct 2004
Posts: 8,330
Hoopy frood
|
Hoopy frood
Joined: Oct 2004
Posts: 8,330 |
Yes, you can combine like that.
Regarding "halt", keep in mind two things...
1) If you don't need to halt the script, don't. Halting when it's going to halt on its own is not necessary.
2) If you're just trying to end a script early based on something that happened (an error or not matching something, for example), use RETURN instead of HALT.
Invision Support #Invision on irc.irchighway.net
|
|
|
|
Joined: Apr 2007
Posts: 228
Fjord artisan
|
OP
Fjord artisan
Joined: Apr 2007
Posts: 228 |
I have a systems control script I've written for my bot. Is there anyway for the bot to write to a op_log.txt file when someone uses one of the commands, logging when the action was done in HH:mm:ss,and noting who ran the command and what channel it was ran on, or if it was done via query? Edit: /write C:/IcyBot2/Scripts/op_log.txt $nick used $$1 on $chan at I just randomly came up with that. I think it should work, but I don't know the timestamp $identifier. ;IcyBot systems control
;IcyBot
on syscon:TEXT:!disable_bot:#:set %icybot off | msg $chan IcyBot's functionality has been disabled. | halt
on syscon:TEXT:!disable_bot:?:set %icybot off | notice $nick IcyBot's functionality has been disabled. | halt
on syscon:TEXT:!enable_bot:#:set %icybot on | msg $chan IcyBot's functionality has been enabled. | halt
on syscon:TEXT:!enable_bot:?:set %icybot on | notice $nick IcyBot's functionality has been enabled. | halt
;Banners
on syscon:TEXT:!disable_banners:#:set %banners off | msg $chan Banners have been disabled. | halt
on syscon:TEXT:!disable_banners:?:set %banners off | notice $nick Banners have been disabled. | halt
on syscon:TEXT:!enable_banners:#:set %banners on | msg $chan Banners have been enabled. | halt
on syscon:TEXT:!enable_banners:?:set %banners on | notice $nick Banners have been enabled. | halt
;8ball
on syscon:TEXT:!disable_8ball:#:set %8ball off | msg $chan 8ball has been disabled. | halt
on syscon:TEXT:!disable_8ball:?:set %8ball off | notice $nick 8ball has been disabled. | halt
on syscon:TEXT:!enable_8ball:#:set %8ball on | msg $chan 8ball has been enabled. | halt
on syscon:TEXT:!enable_8ball:?:set %8ball on | notice $nick 8ball has been enabled. | halt
;Uno
on syscon:TEXT:!disable_uno:#:set %uno off | msg $chan Uno has been disabled. | halt
on syscon:TEXT:!disable_uno:?:set %uno off | notice $nick Uno has been disabled. | halt
on syscon:TEXT:!enable_uno:#:set %uno on | msg $chan Uno has been enabled. | halt
on syscon:TEXT:!enable_uno:?:set %uno on | notice $nick Uno has been enabled. | halt
;Trivia
on syscon:TEXT:!disable_trivia:#:set %trivia off | msg $chan Trivia has been disabled. | halt
on syscon:TEXT:!disable_trivia:?:set %trivia off | notice $nick Trivia has been disabled. | halt
on syscon:TEXT:!enable_trivia:#:set %trivia on | msg $chan Trivia been enabled. | halt
on syscon:TEXT:!enable_trivia:?:set %trivia on | notice $nick Trivia has been enabled. | halt
;Invite
on syscon:TEXT:!disable_invite:#:set %invite off | msg $chan Inviting has been disabled. | halt
on syscon:TEXT:!disable_invite:?:set %invite off | notice $nick Inviting has been disabled. | halt
on syscon:TEXT:!enable_invite:#:set %invite on | msg $chan Inviting been enabled. | halt
on syscon:TEXT:!enable_invite:?:set %invite on | notice $nick Inviting has been enabled. | halt
;Huggle
on syscon:TEXT:!disable_huggle:#:set %huggle off | msg $chan Huggling has been disabled. | halt
on syscon:TEXT:!disable_huggle:?:set %huggle off | notice $nick Huggling has been disabled. | halt
on syscon:TEXT:!enable_huggle:#:set %huggle on | msg $chan Huggling been enabled. | halt
on syscon:TEXT:!enable_huggle:?:set %huggle on | notice $nick Huggling has been enabled. | halt
;Misc
on syscon:TEXT:!disable_misc:#:set %misc off | msg $chan Miscellaneous features have been disabled. | halt
on syscon:TEXT:!disable_misc:?:set %misc off | notice $nick Miscellaneous features have been disabled. | halt
on syscon:TEXT:!enable_misc:#:set %misc on | msg $chan Miscellaneous features have been enabled. | halt
on syscon:TEXT:!enable_misc:?:set %misc on | notice $nick Miscellaneous features have been enabled. | halt
;Timebomb
on syscon:TEXT:!disable_timebomb:#:set %timebomb off | msg $chan Timebomb has been disabled. | halt
on syscon:TEXT:!disable_timebomb:?:set %timebomb off | notice $nick Timebomb has been disabled. | halt
on syscon:TEXT:!enable_timebomb:#:set %timebomb on | msg $chan Timebomb has been enabled. | halt
on syscon:TEXT:!enable_timebomb:?:set %timebomb on | notice $nick Timebomb has been enabled. | halt
;Greet
on syscon:TEXT:!disable_greet:#:set %greet off | msg $chan Greet notices have been disabled. | halt
on syscon:TEXT:!disable_greet:?:set %greet off | notice $nick Greet notices have been disabled. | halt
on syscon:TEXT:!enable_greet:#:set %greet on | msg $chan Greet notices have been enabled. | halt
on syscon:TEXT:!enable_greet:?:set %greet on | notice $nick Greet notices have been enabled. | halt
;Rules
on syscon:TEXT:!disable_rules:#:set %rules off | msg $chan Greet notices have been disabled. | halt
on syscon:TEXT:!disable_rules:?:set %rules off | notice $nick Greet notices have been disabled. | halt
on syscon:TEXT:!enable_rules:#:set %rules on | msg $chan Greet notices have been enabled. | halt
on syscon:TEXT:!enable_rules:?:set %rules on | notice $nick Greet notices have been enabled. | halt
;Bannermaker
on syscon:TEXT:!disable_bannermaker:#:set %bannermaker off | msg $chan Banner making has been disabled. | halt
on syscon:TEXT:!disable_bannermaker:?:set %bannermaker off | notice $nick Banner making has been disabled. | halt
on syscon:TEXT:!enable_bannermaker:#:set %bannermaker on | msg $chan Banner making has been enabled. | halt
on syscon:TEXT:!enable_bannermaker:?:set %bannermaker on | notice $nick Banner making has been enabled. | halt
;HelpSys
on syscon:TEXT:!disable_helpsys:#:set %helpsys off | msg $chan Help system has been disabled. | halt
on syscon:TEXT:!disable_helpsys:?:set %helpsys off | notice $nick Help system has been disabled. | halt
on syscon:TEXT:!enable_helpsys:#:set %helpsys on | msg $chan Help system has been enabled. | halt
on syscon:TEXT:!enable_helpsys:?:set %helpsys on | notice $nick Help system has been enabled. | halt
;OpGreet
on syscon:TEXT:!disable_opgreet:#:set %opgreet off | msg $chan Bot-Op greeting has been disabled. | halt
on syscon:TEXT:!disable_opgreet:?:set %opgreet off | notice $nick Bot-Op greeting has been disabled. | halt
on syscon:TEXT:!enable_opgreet:#:set %opgreet on | msg $chan Banner Bot-Op greeting been enabled. | halt
on syscon:TEXT:!enable_opgreet:?:set %opgreet on | notice $nick Bot-Op greeting has been enabled. | halt
;Bot controls
;Part
on syscon:text:!part*:*:{
if ($2 == $null) { /part $chan | /notice $nick Parted channel. | halt }
if ($2 !ischan ) { /notice $nick I'm already off that channel. | halt }
if ($2 != $null) { /part $2 | /notice $nick Parted channel. | halt }
}
;Join
on syscon:text:!join*:*:{
if ($2 ischan) { /notice $nick I'm already on $2 | halt }
if ($2 !ischan) { /join $2 | /notice $nick Join attempt complete. | halt }
}
; #uranme part
on uranmepart:text:!leave_uranme:*:{
if ($me ischan #uranme) { /part #uranme | /notice $nick Parted #uranme | halt }
if (me !ischan #uranme) { /notice $nick I'm not on #uranme. | halt }
}
Last edited by Mpot; 23/09/07 06:10 PM.
|
|
|
|
Joined: Dec 2002
Posts: 3,547
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 3,547 |
;IcyBot systems control
On syscon:Text:!*_*:*: {
var %c = $gettok($1,1,95), %d = $gettok($1,2,95), %t = $target
if (%c == enable) {
if (%d == bot) { set %icybot on | msg $iif(%t ischan,$chan,$nick) IcyBot's functionality has been enabled. }
if (%d == banners) { set %banners on | msg $iif(%t ischan,$chan,$nick) Banners have been enabled. }
if (%d == 8ball) { set %8ball on | msg $iif(%t ischan,$chan,$nick) 8ball has been enabled. }
if (%d == uno) { set %uno on | msg $iif(%t ischan,$chan,$nick) 8ball has been enabled. }
if (%d == trivia) { set %trivia on | msg $iif(%t ischan,$chan,$nick) Trivia has been enabled. }
if (%d == invite) { set %invite on | msg $iif(%t ischan,$chan,$nick) Inviting has been enabled. }
if (%d == huggle) { set %huggle on | msg $iif(%t ischan,$chan,$nick) Huggling has been enabled. }
if (%d == misc) { set %misc on | msg $iif(%t ischan,$chan,$nick) Miscellaneous features have been enabled. }
if (%d == timebomb) { set %timebomb on | msg $iif(%t ischan,$chan,$nick) Timebomb has been enabled. }
if (%d == greet) { set %greet on | msg $iif(%t ischan,$chan,$nick) Greet notices has been enabled. }
if (%d == rules) { set %rules on | msg $iif(%t ischan,$chan,$nick) Rules have been enabled. }
if (%d == bannermaker) { set %bannermaker on | msg $iif(%t ischan,$chan,$nick) Banner making has been enabled. }
if (%d == helpsys) { set %helpsys on | msg $iif(%t ischan,$chan,$nick) Help System has been enabled. }
write op_log.txt At $time(HH:nn:ss) $nick used enable command for %d in $iif(%t ischan,$chan,in private message)
}
if (%c == disable) {
if (%d == bot) { set %icybot off | msg $iif(%t ischan,$chan,$nick) IcyBot's functionality has been disabled. }
if (%d == banners) { set %banners off | msg $iif(%t ischan,$chan,$nick) Banners have been disabled. }
if (%d == 8ball) { set %8ball off | msg $iif(%t ischan,$chan,$nick) 8ball has been disabled. }
if (%d == uno) { set %uno off | msg $iif(%t ischan,$chan,$nick) 8ball has been disabled. }
if (%d == trivia) { set %trivia off | msg $iif(%t ischan,$chan,$nick) Trivia has been disabled. }
if (%d == invite) { set %invite off | msg $iif(%t ischan,$chan,$nick) Inviting has been disabled. }
if (%d == huggle) { set %huggle off | msg $iif(%t ischan,$chan,$nick) Huggling has been disabled. }
if (%d == misc) { set %misc off | msg $iif(%t ischan,$chan,$nick) Miscellaneous features have been disabled. }
if (%d == timebomb) { set %timebomb off | msg $iif(%t ischan,$chan,$nick) Timebomb has been disabled. }
if (%d == greet) { set %greet off | msg $iif(%t ischan,$chan,$nick) Greet notices has been disabled. }
if (%d == rules) { set %rules off | msg $iif(%t ischan,$chan,$nick) Rules have been disabled. }
if (%d == bannermaker) { set %bannermaker off | msg $iif(%t ischan,$chan,$nick) Banner making has been disabled. }
if (%d == helpsys) { set %helpsys off | msg $iif(%t ischan,$chan,$nick) Help System has been disabled. }
write op_log.txt At $time(HH:nn:ss) $nick used disable command for %d in $iif(%t ischan,$chan,in private message)
}
}
I tried to clean the code up a little, it can be improved more but I was just rushing. It's untested, but I think it should work.
|
|
|
|
Joined: Apr 2007
Posts: 228
Fjord artisan
|
OP
Fjord artisan
Joined: Apr 2007
Posts: 228 |
It would be a bit easier for me to just insert a line into some of the on texts. Would I be able to use for the channel on texts
/write C:\IcyBot2\Scripts\op_log.txt $nick used $$1 on $chan at $time(HH:nn:ss)
and
/write C:\IcyBot2\Scripts\op_log.txt $nick used $$1 on via private msg at $time(HH:nn:ss)
?
EDIT: How can I put in the date, too?
Last edited by Mpot; 23/09/07 06:37 PM.
|
|
|
|
Joined: Dec 2002
Posts: 3,547
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 3,547 |
/help $date
Sorry for the vague reply, but it's fairly simple.
|
|
|
|
Joined: Apr 2007
Posts: 228
Fjord artisan
|
OP
Fjord artisan
Joined: Apr 2007
Posts: 228 |
/write C:\IcyBot2\Scripts\op_log.txt $date(mmm,d,yy) $+ at $time(h,n,s,TT) $+ : $nick used $$1 on $chan | halt
" * Invalid parameters: $date "
What in God's name? -_________-;
|
|
|
|
Joined: Sep 2005
Posts: 2,881
Hoopy frood
|
Hoopy frood
Joined: Sep 2005
Posts: 2,881 |
commas are used to separate $identifier arguments, so the script parser thinks you're passing 3 arguments to $date: "mmm", "d" and "yy", rather than just one: "mmm,d,yy", to fix this set the format to a variable first: var %dateformat = mmm,d,yy, %timeformat = h,n,s,TT
echo -a $date(%dateformat) $time(%timeformat)
|
|
|
|
Joined: Apr 2007
Posts: 228
Fjord artisan
|
OP
Fjord artisan
Joined: Apr 2007
Posts: 228 |
That shouldn't be so, according to the help file on Time and Date Identifiers.
Last edited by Mpot; 23/09/07 07:15 PM.
|
|
|
|
Joined: Sep 2005
Posts: 2,881
Hoopy frood
|
Hoopy frood
Joined: Sep 2005
Posts: 2,881 |
That shouldn't be so? How not?
$date(dd/mm/yy) is perfectly fine, but $date(dd,mm,yy) is not because , is used to separate arguments in identifiers, so you're passing it 3 different arguments when it only takes one! - a date format.
|
|
|
|
Joined: Apr 2007
Posts: 228
Fjord artisan
|
OP
Fjord artisan
Joined: Apr 2007
Posts: 228 |
I don't want arguments, I want a date format, and according to that help file, using commas is appropriate. See edit to earlier post, screenshot of file included.
Last edited by Mpot; 23/09/07 07:16 PM.
|
|
|
|
Joined: Sep 2005
Posts: 2,881
Hoopy frood
|
Hoopy frood
Joined: Sep 2005
Posts: 2,881 |
It doesn't say that commas are appropriate anywhere on that page, unless you're talking about the comma in $asctime() which does take two arguments.
|
|
|
|
Joined: Dec 2002
Posts: 2,033
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 2,033 |
Just use $date($+(mmm,$chr(44),d,$chr(44),yy)) ?
|
|
|
|
Joined: Apr 2007
Posts: 228
Fjord artisan
|
OP
Fjord artisan
Joined: Apr 2007
Posts: 228 |
Alright, then why is it working fine with $time but not with $date?
|
|
|
|
Joined: Apr 2007
Posts: 228
Fjord artisan
|
OP
Fjord artisan
Joined: Apr 2007
Posts: 228 |
Blargh, what can I put in this line
/write C:\IcyBot2\Scripts\op_log.txt $time(h,n,s,TT) on $date(mmm,d,yy) $+ : $nick used $$1 on $chan
To make the date and time work properly? I tried changing it to $time first instead of $date first, no good. Just got $time errors. The format I'd like for the time and date can be seen in that line.
|
|
|
|
Joined: Sep 2005
Posts: 2,881
Hoopy frood
|
Hoopy frood
Joined: Sep 2005
Posts: 2,881 |
I told you that earlier. var %dateformat = mmm,d,yy, %timeformat = h,n,s,TT
echo -a $date(%dateformat) $time(%timeformat)
|
|
|
|
Joined: Apr 2007
Posts: 228
Fjord artisan
|
OP
Fjord artisan
Joined: Apr 2007
Posts: 228 |
Issues. My bot-op help script if flooding the bot off the server. Is there a line I can add? Like /wait ten seconds or something, so that the bot pauses the script long enough not to get flooded off, and then continues?
|
|
|
|
Joined: Dec 2002
Posts: 3,547
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 3,547 |
|
|
|
|
Joined: Apr 2007
Posts: 228
Fjord artisan
|
OP
Fjord artisan
Joined: Apr 2007
Posts: 228 |
|
|
|
|
Joined: Jan 2006
Posts: 111
Vogon poet
|
Vogon poet
Joined: Jan 2006
Posts: 111 |
Put the helptext in a file and play the file to the server
/help /play
Last edited by noMen; 23/09/07 09:33 PM.
|
|
|
|
Joined: Apr 2007
Posts: 228
Fjord artisan
|
OP
Fjord artisan
Joined: Apr 2007
Posts: 228 |
So it'll read a line, wait, read a line, wait?
|
|
|
|
Joined: Dec 2002
Posts: 3,547
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 3,547 |
Should have read the post thoroughly, I didn't realise it was a file that needed to be delayed.
Then that is correct, use /play.
/play plays the file to a target with a delay, if you read the help file it will tell you.
|
|
|
|
Joined: Apr 2007
Posts: 228
Fjord artisan
|
OP
Fjord artisan
Joined: Apr 2007
Posts: 228 |
Actually no, it wasn't a file, but now getting the advice on /play, I'm going to put it into a file. What should I set the delay at?
|
|
|
|
Joined: Dec 2002
Posts: 3,547
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 3,547 |
It depends on you really. And the server of course, you want a decent delay so the messages don't go snail slow but also you don't want to get flooded off.
Try a delay of 1750.
To test it: /play target file 1750
Change the target to whatever, same with the file.
|
|
|
|
Joined: Apr 2007
Posts: 228
Fjord artisan
|
OP
Fjord artisan
Joined: Apr 2007
Posts: 228 |
So
/play C:\IcyBot2\Scripts\bot-op_help.txt 1750
Would be the command?
|
|
|
|
Joined: Dec 2002
Posts: 3,547
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 3,547 |
Sort of, you need a target if you are calling it from a script.
|
|
|
|
Joined: Apr 2007
Posts: 228
Fjord artisan
|
OP
Fjord artisan
Joined: Apr 2007
Posts: 228 |
on syscon:TEXT:!botop_help:{ } Needs to msg the file C:\IcyBot2\Scripts\botop_help.txt to the $nick with the delay. Why isn't this working: on syscon:TEXT:!botop_help:*:{
play C:\IcyBot2\Scripts\op_help.text 1750
halt
}
Last edited by Mpot; 23/09/07 11:47 PM.
|
|
|
|
Joined: Apr 2007
Posts: 228
Fjord artisan
|
OP
Fjord artisan
Joined: Apr 2007
Posts: 228 |
This is not working. Why? (Yes, the access level syscon is taken care of) on syscon:text:!join*:#:{
if ($2 ischan) { /notice $nick I'm already on $2 | halt }
if ($3 == $null) { /join $2 | /notice $nick Join attempt on $$2 complete. | /write C:\IcyBot2\Scripts\op_log.txt On $date(dddd $+ $chr(44) mmmm d $+ $chr(44) yyyy) at $time(h:nn:ss TT) $nick used $$1 $$2 on $chan | halt }
if ($3 != $null) { /join $2 $3 | /notice $nick Join attempt on $$2 with password $$3 complete. | /write C:\IcyBot2\Scripts\op_log.txt On $date(dddd $+ $chr(44) mmmm d $+ $chr(44) yyyy) at $time(h:nn:ss TT) $nick used $$1 $$2 on $chan | halt }
}
|
|
|
|
Joined: Dec 2002
Posts: 3,547
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 3,547 |
on syscon:TEXT:!botop_help:*:{
play $nick C:\IcyBot2\Scripts\op_help.text 1750
halt
}
|
|
|
|
Joined: Apr 2007
Posts: 228
Fjord artisan
|
OP
Fjord artisan
Joined: Apr 2007
Posts: 228 |
Any idea what's wrong with the !join?
|
|
|
|
Joined: Oct 2004
Posts: 8,330
Hoopy frood
|
Hoopy frood
Joined: Oct 2004
Posts: 8,330 |
Many networks won't get you flooded if you do a delay of 1000 or 1250. However, if you might also be saying other things at the same time, then is where you may get flooded at the lower delays. So 1750 or 2000 is safer, but also takes longer. If you have a lot of lines to display, 2 seconds per line makes a 30 line file take a minute to display, which becomes problematic.
As for your !join script, I see you still aren't listening to advice given to you multiple times. You don't need /'s and you should use ELSEIF when two or more IF statements will not ever both be true (such as $3 == $null and $3 != $null). Of course, in that case, it's only 2 possibilities so you can just use ELSE instead of ELSEIF for that one. Also, you shouldn't use HALT when it isn't needed. You'll only need to halt the script on the first IF and you should use RETURN instead of HALT there. The other two do not need to be halted and should use ELSE as mentioned for the last IF.
As to why it won't work, what are you testing and what isn't working?
Invision Support #Invision on irc.irchighway.net
|
|
|
|
Joined: Apr 2007
Posts: 228
Fjord artisan
|
OP
Fjord artisan
Joined: Apr 2007
Posts: 228 |
I can't say I'm sure of when a script needs to be halted, or when it's going to halt itself, it seems safer to just add the line than to not. I can't see it hurting anything. Furthermore, when several if statements works just as well as ifelse and else, why use them and create something more confusing? The idea of my scripts most of the time isn't absolute speed, functionality, or properness. They're about me being able to understand them, how I wrote them, know exactly what they do, and they do what I want.
|
|
|
|
Joined: Dec 2002
Posts: 3,547
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 3,547 |
You just said your Join Text event doesn't work.
|
|
|
|
Joined: Jan 2006
Posts: 111
Vogon poet
|
Vogon poet
Joined: Jan 2006
Posts: 111 |
You just said your Join Text event doesn't work. Thats why he asks questions But Mpot has a point: They're about me being able to understand them, how I wrote them, know exactly what they do, and they do what I want. Some discussions on this forum are about speed. Benchmarking shows that executing a certain command 20.000 times takes 1024 milisecs and executing a similar command only 800 msec. But did anybody ever make a script that does the same thing 20.000 times? On modern PC's the speed of a script is not an issue. Understanding your script is more important, although I never would use a script that was written in the way Mpot proposes ....
|
|
|
|
Joined: Apr 2007
Posts: 228
Fjord artisan
|
OP
Fjord artisan
Joined: Apr 2007
Posts: 228 |
I was able to get my on !join working perfectly, but I'd like more in it. For instance, instead of just msging Join attempted, it would tell you wether or not the attempt working. I don't know the commands for interpreting data from Services. Current script: ;Bot controls
;Part
on syscon:text:!part*:?:{
if ($2 == $null) { /notice $nick Specify channel. | halt }
if ($2 !ischan ) { /notice $nick I'm already off $$2 $+ . | halt }
if ($2 != $null) { /part $2 | /notice $nick Parted $$2 $+ . | /write C:\IcyBot2\Scripts\op_log.txt On $date(dddd $+ $chr(44) mmmm d $+ $chr(44) yyyy) at $time(h:nn:ss TT) $nick used $$1 $$2 via msg | halt }
}
on syscon:text:!part*:#:{
if ($2 == $null) { /part $chan | msg $chan Parted $chan $+ . | /write C:\IcyBot2\Scripts\op_log.txt On $date(dddd $+ $chr(44) mmmm d $+ $chr(44) yyyy) at $time(h:nn:ss TT) $nick used $$1 on $chan| halt }
if ($2 !ischan ) { msg $chan I'm already off $$2 $+ . | halt }
if ($2 != $null) { /part $2 | msg $chan Parted $$2 $+ . | /write C:\IcyBot2\Scripts\op_log.txt On $date(dddd $+ $chr(44) mmmm d $+ $chr(44) yyyy) at $time(h:nn:ss TT) $nick used $$1 $$2 on $chan | halt }
}
;Join
on syscon:text:!join*:?:{
if ($2 == $null) { /notice $nick Specify channel. | halt }
if ($3 == $null) { goto ?$3null }
:?$3null
if ($2 ischan) { /notice $nick I'm already on $$2 $+ . | halt }
if ($3 != $null) { /join $$2 $$3 | /notice $nick Join attempt on $$2 with key $$3 complete. | /write C:\IcyBot2\Scripts\op_log.txt On $date(dddd $+ $chr(44) mmmm d $+ $chr(44) yyyy) at $time(h:nn:ss TT) $nick used $$1 $$2 with key $$3 via msg | halt }
if ($2 != $null) { /join $$2 | /notice $nick Join attempt on $$2 complete. | /write C:\IcyBot2\Scripts\op_log.txt On $date(dddd $+ $chr(44) mmmm d $+ $chr(44) yyyy) at $time(h:nn:ss TT) $nick used $$1 $$2 via msg | halt }
}
on syscon:text:!join*:#:{
if ($2 == $null) { msg $chan Specify channel. | halt }
if ($3 == $null) { goto ?$3null }
:?$3null
if ($2 ischan) { /notice $nick I'm already on $$2 $+ . | halt }
if ($3 != $null) { /join $$2 $$3 | msg $chan Join attempt on $$2 with key $$3 complete. | /write C:\IcyBot2\Scripts\op_log.txt On $date(dddd $+ $chr(44) mmmm d $+ $chr(44) yyyy) at $time(h:nn:ss TT) $nick used $$1 $$2 with key $$3 via msg | halt }
if ($2 != $null) { /join $$2 | msg $chan Join attempt on $$2 complete. | /write C:\IcyBot2\Scripts\op_log.txt On $date(dddd $+ $chr(44) mmmm d $+ $chr(44) yyyy) at $time(h:nn:ss TT) $nick used $$1 $$2 via msg | halt }
}
; #uranme part
on uranmepart:text:!leave_uranme:*:{
if ($me ischan #uranme) { /part #uranme | /notice $nick Parted #uranme | halt }
if (me !ischan #uranme) { /notice $nick I'm not on #uranme. | halt }
}
Last edited by Mpot; 24/09/07 08:37 PM.
|
|
|
|
Joined: Oct 2004
Posts: 8,330
Hoopy frood
|
Hoopy frood
Joined: Oct 2004
Posts: 8,330 |
I can't say I'm sure of when a script needs to be halted, or when it's going to halt itself, it seems safer to just add the line than to not. I can't see it hurting anything. Furthermore, when several if statements works just as well as ifelse and else, why use them and create something more confusing? The idea of my scripts most of the time isn't absolute speed, functionality, or properness. They're about me being able to understand them, how I wrote them, know exactly what they do, and they do what I want. A script halts automatically when nothing else is in it or when nothing else will run (ie. You just did an IF that matched, so an ELSE that follows it won't run). So there's no reason to halt a script in these situations. And, as mentioned, don't use HALT anyhow. Use RETURN. Others can get into the reasons why using HALT for this form of halting can cause problems, but you should avoid using HALT for this type of halting. As far as IF/ELSEIF/ELSE, yes it does affect speed, but that's not why I said that you should use it. If you look at my posts in topics that discuss speed, you'll find that I often point out that minor speed improvements aren't really that important. The main reason, imo, that you should use IF/ELSEIF/ELSE is just what you said... ease of understanding. If all you see are a lot of IFs, then you will have to go through and read every single one to figure out what needs done or not done. If you have IF followed by 6 ELSEIFs and then an ELSE at the end, you know automatically that you can ignore the rest if the first IF matches, or ignore everything after the first ELSEIF if that matches, and so on. ELSEIF isn't any more difficult to understand and it prevents you from having to TRY to understand it in the first place if you know that you already matched the IF or ELSEIF before it. Trust me, you should always try to learn and use good and efficient programming/scripting methods at all times even if they are confusing to you when you're learning. Otherwise you get into bad habits that can make your scripts harder to understand and more prone to bugs and problems than you would otherwise have. That isn't to say that you need to do the most efficient method every time (ie. you don't have to use regex if you don't know how to if you can use another method instead). It does mean that if you know how to do something mroe efficiently and you're choosing not to just because you don't feel like it, *that* is when it's a bad idea.
Invision Support #Invision on irc.irchighway.net
|
|
|
|
Joined: Apr 2007
Posts: 228
Fjord artisan
|
OP
Fjord artisan
Joined: Apr 2007
Posts: 228 |
Elseif and Else are just beyond my comprehension right now. I just recently got the hang of using identifiers($1,$2,etc) and even more recently got a handle on if statements. I'll get there eventually, like I always do, it'll just take a while. It took me months to get this far. =P
|
|
|
|
Joined: Oct 2004
Posts: 8,330
Hoopy frood
|
Hoopy frood
Joined: Oct 2004
Posts: 8,330 |
They really aren't hard. This should help... I'll use text examples rather than script ones so it's easier to picture.
Premise: I'm having a party and depending on the number of visitors who plan to attend, I'll have to decide how much food to buy.
Comparison (this is the IF/ELSEIF/ELSE part): If 20 or more people come, I need to buy $100 worth of food. "Else" if 10-19 people come, I only need to buy $60 worth of food. "Else" if less than 10 come, I only need to buy $30 worth of food.
As you can see, only one of those will be true no matter what. I checked IF on the first one, then ELSEIF on the second, then ELSE (or ELSEIF works as well) on the third.
The way it works is:
; Check this line first. If it matches, skip all ELSEIF/ELSE that directly follow. IF () ; If the IF failed, check this. If it matches, skip any other ELSEIF's that follow as well as any ELSE at the end. ELSEIF () ; If the ELSEIF failed, check this. Only 1 ELSE can be used in a group of IF/ELSEIF/ELSE or IF/ELSE and can only be at the end of a group of IF/ELSEIF/ELSE or IF/ELSE. So if the ELSE matches or doesn't match, you just continue on from there as there isn't anything else to skip. ELSE ()
A group of IF/ELSEIF/ELSE or IF/ELSE can have only 1 IF and only 0 or 1 ELSE, but can have an unlimited number (0+) of ELSEIF between them. If you have anything else in the middle, it will break/split the group. --- This is a single group. After the first match, all following items will be ignored.
IF () ELSEIF () ELSEIF () ELSEIF () ELSE ()
--- This is 2 groups. Notice that the first doesn't use an ELSE and the second doesn't use an ELSEIF. That's up to you and what you're doing. If something matches in the first group, everything following that is IN that group will be skipped. Then, if anything matches in the second group, anything following that is IN that group will be skipped.
IF () ELSEIF () ELSEIF () MSG $CHAN .... IF () ELSE () ---
Basically, ELSEIF is just like IF, but follows the IF and does the same thing as IF except that it will be skipped if the IF or an ELSEIF that is before it matches. This prevents any need to halt the script and speeds things up as well rather than checking a lot of IFs that don't need to be checked if you already know they'll fail because of a match on an earlier IF.
An ELSE is always at the end (if used) and basically says that if nothing else matched in the group, this is done no matter what. It's only done if the IF and any ELSEIF's in the group don't match. You'd use ELSE anytime that you are covering all possibilities in a comparison, such as checking 3 things (0-9, 10-19, 20+). If those are the only possible matches, and you checked 0-9 and 10-19, then you already know that if they failed, then it has to be 20+. So rather than checking it, you can just use ELSE and avoid the check.
I hope that helps to explain it. If you have questions, just ask. ELSEIF and ELSE are really not any different from IF except that they can be skipped if something before them matches.
Invision Support #Invision on irc.irchighway.net
|
|
|
|
Joined: Apr 2007
Posts: 228
Fjord artisan
|
OP
Fjord artisan
Joined: Apr 2007
Posts: 228 |
I sorta put the | halt in to prevent continuesd checking of IF's when one matches. Then again, you said not to use | halt, so I'll have to see what I can do.
And yes, after re-reading it to get it in my brain, you have explained this quite admirably. On my join script, for instance, would I want to use
if elseif elseif elseif else error msg?
Because, I want to try and get error checking into it. I've already got in the errors for missing paramaters, but what about responses from services, IE wrong pass? Or banned? Or AKICK? etc? How could I restructure the !join script I posted, using if, elseif, and else, and modifying nothing else except the use of statements, no variables or stuff I don't get?
Last edited by Mpot; 25/09/07 12:30 AM.
|
|
|
|
Joined: Oct 2004
Posts: 8,330
Hoopy frood
|
Hoopy frood
Joined: Oct 2004
Posts: 8,330 |
Here's an example using your script of how it could look. PART SECTION: Note that since both PART sections have the same basic format, I'll only show one and you can just make the other look the same. Note that I usually do halt errors using RETURN instead of sticking them into the IF/ELSEIF/ELSE format simply to show that they are errors and the actual script shouldn't be run if there are errors. That's more of a judgement call. Note that I completely removed the last IF in the Part section because you aren't doing anything else after it and the stuff before it is just error messages that are halting.
;Part
on syscon:text:!part*:?:{
if ($2 == $null) { notice $nick Specify channel. | return }
if ($2 !ischan ) { notice $nick I'm already off $2 $+ . | return }
part $2
notice $nick Parted $2 $+ .
write C:\IcyBot2\Scripts\op_log.txt On $date(dddd $+ $chr(44) mmmm d $+ $chr(44) yyyy) at $time(h:nn:ss TT) $nick used $1 $2 via msg
}
If you did IF/ELSEIF/ELSE, it would look like this (just for an example if you prefer this method to using RETURN on errors). Note that I separated the last IF into multiple lines just so it was easier to see what was going on. If you really feel the need to use pipes (|), you can do so. But you did mention making scripts that are easier to understand and less complicated and using pipes too often has the opposite effect. I personally only use them for error messages (before RETURN). But that's just my personal preference. It's up to you how you use them.
;Part
on syscon:text:!part*:?:{
if ($2 == $null) { notice $nick Specify channel. }
elseif ($2 !ischan ) { notice $nick I'm already off $2 $+ . }
else {
part $2
notice $nick Parted $2 $+ .
write C:\IcyBot2\Scripts\op_log.txt On $date(dddd $+ $chr(44) mmmm d $+ $chr(44) yyyy) at $time(h:nn:ss TT) $nick used $1 $2 via msg
}
}
JOIN SECTION: As with the Part section, your 2 Join scripts are basically the same, so I'm showing just the first one and you can use the same method in the second one. If you do have trouble with the second Part/Join, just ask. Note that your GOTO doesn't do anything the way you have it, so I removed it. Also, you should avoid using GOTO as much as possible. In almost all cases, using GOTO isn't the best solution. There are some situations where it is the right solution, but they are few. Again, I'd personally use RETURN for the errors, but since I'm showing the IF/ELSEIF/ELSE to you, I won't show the RETURN anymore. You can see how I use it in the Part section above and it would be the same idea here. Like I mentioned, RETURN is similar to HALT, but is the better choice if you have to halt a script for things like errors. The last IF is an ELSE instead of an ELSEIF because you don't need to check anything. You already know from earlier that there IS a $2, so there's no need to check again. Also, note that in both this and the other examples, I changed the $$2 (etc) to $2 (etc). You don't need to use $$ unless you want something to not work if the value is $null. Because you're already checking if there is a value there, having $$ is redundant. Also, you'll see that I removed all forms of halting from the end of the scripts. This is because the script will halt when it's at the end anyhow. So this is also redundant.
;Join
on syscon:text:!join*:?:{
if ($2 == $null) { notice $nick Specify channel. }
elseif ($2 ischan) { notice $nick I'm already on $2 $+ . }
elseif ($3 != $null) {
join $2 $3
notice $nick Join attempt on $2 with key $3 complete.
write C:\IcyBot2\Scripts\op_log.txt On $date(dddd $+ $chr(44) mmmm d $+ $chr(44) yyyy) at $time(h:nn:ss TT) $nick used $1 $2 with key $3 via msg
}
else {
join $2
notice $nick Join attempt on $2 complete.
write C:\IcyBot2\Scripts\op_log.txt On $date(dddd $+ $chr(44) mmmm d $+ $chr(44) yyyy) at $time(h:nn:ss TT) $nick used $1 $2 via msg
}
}
URANME SECTION: First of all, you wanted "ison" not "ischan" and you missed the $ in $me in the second IF. Now, because this is a simple THIS or THAT without anything else, you can just do IF/ELSE as shown.
; #uranme part
on uranmepart:text:!leave_uranme:*:{
if ($me ison #uranme) {
part #uranme
notice $nick Parted #uranme
}
else { notice $nick I'm not on #uranme. }
}
The last thing I'll note again is that you don't need to use /'s in a script. You may want to use .'s before your notices, though. That will "silence" them so that you don't see them in your bot. That's up to you, though. You may want to see them to have an idea of how often commands were used. To use .'s, just put it in front of the command, such as: .notice $nick I'm not in $chan Another thing that you can do, but I would probably recommend not doing it until you really feel comfortable scripting, is to connect $N's with other non-numerical text. $N is $1, $2, $3, etc. With $N's, you don't need to use $+ if you want to connect it to something that does not include a number, such as a period. You can do: .notice $nick I'm not in $1. ... and it will work fine. I said I recommend not using this until you are more comfortable because I believe that $N is the only identifier that *can* be connected in this way and you may run into problems by connecting other identifiers without thinking about it if you get in the habit of doing this with $N's. It's up to you, though.
Invision Support #Invision on irc.irchighway.net
|
|
|
|
Joined: Apr 2007
Posts: 228
Fjord artisan
|
OP
Fjord artisan
Joined: Apr 2007
Posts: 228 |
I think I really understand the IF and IFELSE stuff a lot better now. Thanks a bunch, Riamus! The only thing I can think of now: ;Join
on syscon:text:!join*:?:{
if ($2 == $null) { notice $nick Specify channel. }
elseif ($2 ischan) { notice $nick I'm already on $2 $+ . }
elseif ($3 != $null) {
join $2 $3
notice $nick Join attempt on $2 with key $3 complete.
write C:\IcyBot2\Scripts\op_log.txt On $date(dddd $+ $chr(44) mmmm d $+ $chr(44) yyyy) at $time(h:nn:ss TT) $nick used $1 $2 with key $3 via msg
}
elseif ($2 != $null) {
join $2
notice $nick Join attempt on $2 complete.
write C:\IcyBot2\Scripts\op_log.txt On $date(dddd $+ $chr(44) mmmm d $+ $chr(44) yyyy) at $time(h:nn:ss TT) $nick used $1 $2 via msg
}
else { notice $nick Error. }
}
|
|
|
|
Joined: Dec 2002
Posts: 3,547
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 3,547 |
Just a little tip, you don't have to use it though...
if ($3 != $null) is the same as if ($3)
Because you're checking if $3 is not equal to $null/$false. Which is the same because it only triggers if it's $true.
The same goes for checking to see if it is $null/$false only this time prefix it with an exclamation mark.
if ($2 == $null) is the same as if ([color:red]!$2)[/color]
|
|
|
|
Joined: Dec 2002
Posts: 2,033
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 2,033 |
...unless the value of $3 could be 0 or if the value of $2 could be 1 .. then you would need if ($3 != $null) and if ($2 == $null)
|
|
|
|
Joined: Dec 2002
Posts: 3,547
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 3,547 |
For that case yes, for his case either.
|
|
|
|
Joined: Oct 2004
Posts: 8,330
Hoopy frood
|
Hoopy frood
Joined: Oct 2004
Posts: 8,330 |
If there is any possibility of it incorrectly working when not including == $null or != $null, then you should include them.
if (!$2) {} will trigger on 0, $false, $null. if ($2) {} will trigger on everything except 0, $false, $null. It's important to let someone learning to script know that before suggesting that they use it. And, in his case, this could be a problem. It's quite possible to tell the bot to join channel "0". It may be unlikely, but it is possible, so it's a good idea to stick to using $null because there is a possibility.
When you're 100% certain that you will not trigger it incorrectly (or not trigger it when you should) by dropping the $null part, then you can drop it. If you aren't sure, then always use == $null or != $null.
EDIT: It will also fail to work properly for him if the channel is "1".
Last edited by Riamus2; 25/09/07 08:27 PM.
Invision Support #Invision on irc.irchighway.net
|
|
|
|
Joined: Apr 2007
Posts: 228
Fjord artisan
|
OP
Fjord artisan
Joined: Apr 2007
Posts: 228 |
Ah, see, if it sometimes works, and sometimes doesn't, then I think I'm safer with just using == $null. =P
|
|
|
|
Joined: Apr 2007
Posts: 228
Fjord artisan
|
OP
Fjord artisan
Joined: Apr 2007
Posts: 228 |
I was just asked an interesting question. How to make a random "guess the numnber" script? IE: on *:TEXT:!guessnumber:#:{ } I think it should be fairly simple, but I don't know anything about identifiers for randomness and such. I trolled through the help and looked for random stuff. This is what I have come up with: on *:TEXT:!guessnumber*:#:{
set %guessnumbernum $rand(0,100)
echo -a The number is %guessnumbernum
if ($2 == $null) { msg $chan Pick a number. Syntax is !guessnumber number }
elseif ($2 != %guessnumber) {
msg $chan Sorry, that's not the number. Try again?
unset %guessnumbernum
}
elseif ($2 == %guessnumber) {
msg $chan YOU WIN!
unset %guesssnumbernum
}
else { halt }
}
Last edited by Mpot; 25/09/07 10:19 PM.
|
|
|
|
Joined: Sep 2005
Posts: 2,881
Hoopy frood
|
Hoopy frood
Joined: Sep 2005
Posts: 2,881 |
That should work fine, but else { halt } is pointless seeing as mIRC does that anyway. You could use an else { } statement instead of that second elseif too: on *:TEXT:!guessnumber*:#:{
var %guessnumbernum = $rand(0,100)
echo -a The number is %guessnumbernum
if ($2 == $null) { msg $chan Pick a number. Syntax is !guessnumber number }
elseif ($2 != %guessnumber) { msg $chan Sorry, that's not the number. Try again? }
else { msg $chan YOU WIN! }
} Also, rather than using /set and then /unset, if you declare a variable with /var it will be unset automatically when the current script ends.
|
|
|
|
Joined: Apr 2007
Posts: 228
Fjord artisan
|
OP
Fjord artisan
Joined: Apr 2007
Posts: 228 |
Else is anything else. Don't want that. Just if it's the number. Also, thanks for the tip about /var, I didn't know that command. ^_^ I just tried my script with /var, useless. Guess the number: The number is 4%guessnumbernum Was given to me in my echo.
Last edited by Mpot; 25/09/07 10:56 PM.
|
|
|
|
Joined: Oct 2004
Posts: 8,330
Hoopy frood
|
Hoopy frood
Joined: Oct 2004
Posts: 8,330 |
What you had didn't check for numbers, which is why the ELSE was mentioned. Yours checked if it was == to the number and if it wasn't == to the number. A check where there are only 2 possibilities can use ELSE for the second possibility. If you want it to check for numbers...
on *:TEXT:!guessnumber*:#:{
var %guessnumbernum = $rand(0,100)
echo -a The number is %guessnumbernum
if ($2 !isnum) { msg $chan Pick a number. Syntax is !guessnumber number }
elseif ($2 != %guessnumber) { msg $chan Sorry, that's not the number. Try again? }
else { msg $chan YOU WIN! }
}
Note that it's changed to use !isnum and then you don't have to worry about whether or not it's a number when you get to the last two lines. ELSEIF and ELSE work just fine in this case. As far as your echo, you are using control codes (colors), which is why you have an error. It has nothing to do with /var. You have to put spaces around the variable... Guess the number: The number is4 %guessnumbernum instead of: Guess the number: The number is 4%guessnumbernum Another piece of advice... Avoid using single digit color codes (like 4). Make it double digit (04) instead. Otherwise, if a number follows it ( 4 $+ %num where %num == 1), that will try to use color 41, which isn't the same as 4. If you make it 04, then even if a number follows (041), it won't mess up your colors.
Invision Support #Invision on irc.irchighway.net
|
|
|
|
Joined: Sep 2005
Posts: 2,881
Hoopy frood
|
Hoopy frood
Joined: Sep 2005
Posts: 2,881 |
You appear to misunderstand how else statements work, so here's few comments to explain it: if ($2 == $null) { ; if $2 doesn't exist do this. }
elseif ($2 != %guessnumbernum) { ; if $2 isn't the correct number }
else { ; the only possibility is that it IS the correct number, otherwise the previous elseif statement would work, and this part of the script would never be reached. }
|
|
|
|
Joined: Apr 2007
Posts: 228
Fjord artisan
|
OP
Fjord artisan
Joined: Apr 2007
Posts: 228 |
Another interesting idea of mine. Absolutely useless, but it's something to learn more about scripting.
A "code" script. IE, if I type /secret o hai thar the alias would convert the text to a code. Simple code, like wrapping the keys around the keyboard. IE, a becomes s, s becomes d, d becomes f, etc.
I know, useless, but interesting.
|
|
|
|
Joined: Oct 2004
Posts: 8,330
Hoopy frood
|
Hoopy frood
Joined: Oct 2004
Posts: 8,330 |
Perhaps not the best way, you could just loop through the text, one letter at a time and convert it to $chr($calc($chr(real letter) + 5)) or some such thing. Note that it would convert everything including spaces and symbols and would not stick to just letters. Of course, that could make it interesting. Alternatively, you can force it to stay withing a range of $chr() with a simple check...
var %newletter = $calc($chr(%oldletter) + 5)
if ((%newletter > 90 && %newletter < 97) || %newletter > 122) { var %newletter = %newletter - 26 }
var %newchr = $chr(%newletter)
Basically, that will increase the $chr of whatever letter you're on when looping through the text with a $chr 5 letters higher. If it goes beyond "z" or "Z", it will loop back to the beginning so that you don't get weird characters. Note that if you put in weird characters, you will still probably get weird characters back as I didn't make it prevent that from happening. You can loop using $mid and a while loop. Anyhow there may be a better solution, but that's one that won't be hard to figure out (basically just stick what I gave you into a loop using $mid to find %oldletter (%oldletter will be the $asc() of the actual character.)) Note that you should skip past spaces, commas, and parentheses because $asc() won't accept those.
Invision Support #Invision on irc.irchighway.net
|
|
|
|
Joined: Apr 2007
Posts: 228
Fjord artisan
|
OP
Fjord artisan
Joined: Apr 2007
Posts: 228 |
I'll take a look at working on this tomorrow. Thanks for the hints!
|
|
|
|
Joined: Apr 2007
Posts: 228
Fjord artisan
|
OP
Fjord artisan
Joined: Apr 2007
Posts: 228 |
I attempted to optimize this script using elseif, as Riamus has suggested, but it didn't work with elseif after one if. I changed everything back to ifs, worked fine. Ideas? ;Callup Banners
on *:TEXT:-*:#: {
if (%icybot == off) { msg $chan Sorry, IcyBot is disabled. }
if (%banners == off) { msg $chan Sorry, banners are disabled. } if ($1 == -mpot) { msg $chan 11,0"¼0,11¼»12,11"¼11,12¼»2,12"¼12,2¼»2,2"¼2,2¼»10,2"¼2,10¼»10,10%%%%%%0 Master Mpot 10,10%%%%%%2,10"¼10,2¼»2,2"¼2,2¼»12,2"¼2,12¼»11,12"¼12,11¼»0,11"¼11,0¼» }
if ($1 == -colors) { msg $chan 0,1 1 0,2 2 0,3 3 0,4 4 0,5 5 0,6 6 0,7 7 0,8 8 0,9 9 0,10 10 0,11 11 0,12 12 0,13 13 0,14 14 0,15 15 }
if ($1 == -duncan) { msg $chan 9,0"¼0,9¼»10,9"¼9,10¼»2,10"¼10,2¼»2,2"¼2,2¼»3,2"¼2,3¼»3,3%%%%%%8 Duncan007 3,3%%%%%%2,3"¼3,2¼»2,2"¼2,2¼»10,2"¼2,10¼»9,10"¼10,9¼»0,9"¼9,0¼» }
if ($1 == -ichban) { msg $chan 4,0"¼0,4¼»10,4"¼4,10¼»2,10"¼10,2¼»2,2"¼2,2¼»1,2"¼2,1¼»1,1%%%%%%0 IchbanRyushi 1,1%%%%%%2,1"¼1,2¼»2,2"¼2,2¼»10,2"¼2,10¼»4,10"¼10,4¼»0,4"¼4,0¼» }
if ($1 == -kuros) { msg $chan 4,0"¼0,4¼»6,4"¼4,6¼»13,6"¼6,13¼»13,13"¼13,13¼»11,13"¼13,11¼»11,11%%%%%%0 Kuros 11,11%%%%%%13,11"¼11,13¼»13,13"¼13,13¼»6,13"¼13,6¼»4,6"¼6,4¼»0,4"¼4,0¼» }
if ($1 == -ekal) { msg $chan 11,0"¼0,11¼»12,11"¼11,12¼»2,12"¼12,2¼»2,2"¼2,2¼»10,2"¼2,10¼»10,10%%%%%%0 Ekal 10,10%%%%%%2,10"¼10,2¼»2,2"¼2,2¼»12,2"¼2,12¼»11,12"¼12,11¼»0,11"¼11,0¼» }
if ($1 == -lunaki) { msg $chan 13,0"¼0,13¼»1,13"¼13,1¼»2,1"¼1,2¼»2,2"¼2,2¼»6,2"¼2,6¼»6,6%%%%%%0 Lunaki 6,6%%%%%%2,6"¼6,2¼»2,2"¼2,2¼»1,2"¼2,1¼»13,1"¼1,13¼»0,13"¼13,0¼» }
if ($1 == -marajah) { msg $chan 3,0"¼0,3¼»1,3"¼3,1¼»5,1"¼1,5¼»5,5"¼5,5¼»2,5"¼5,2¼»2,2%%%%%%15 Marajah 2,2%%%%%%5,2"¼2,5¼»5,5"¼5,5¼»1,5"¼5,1¼»3,1"¼1,3¼»0,3"¼3,0¼» }
if ($1 == -kuro) { msg $chan 6,0"¼0,6¼»2,6"¼6,2¼»12,2"¼2,12¼»12,12"¼12,12¼»1,12"¼12,1¼»1,1------13Kuro-Sakura1,1-----12,1"¼1,12¼»12,12"¼12,12¼»2,12"¼12,2¼»6,2"¼2,6¼»0,6"¼6,0¼» }
if ($1 == -peth) { msg $chan 14,0"¼0,14¼»15,14"¼14,15¼»1,15"¼15,1¼»1,1"¼1,1¼»7,1"¼1,7¼»7,7------0Penguin7,7-----1,7"¼7,1¼»1,1"¼1,1¼»15,1"¼1,15¼»14,15"¼15,14¼»0,14"¼14,0¼» }
if ($1 == -vrixis) { msg $chan 4,0"¼0,4¼»5,4"¼4,5¼»4,5"¼5,4¼»4,4"¼4,4¼»5,4"¼4,5¼»5,5------4Vrixis5,5-----4,5"¼5,4¼»4,4"¼4,4¼»5,4"¼4,5¼»4,5"¼5,4¼»0,4"¼4,0¼» }
if ($1 == -austin) { msg $chan 1,0"¼0,1¼»6,1"¼1,6¼»15,6"¼6,15¼»15,15"¼15,15¼»14,15"¼15,14¼»14,14------8Austindel The Horrendous14,14-----15,14"¼14,15¼»15,15"¼15,15¼»6,15"¼15,6¼»1,6"¼6,1¼»0,1"¼1,0¼» }
if ($1 == -iron) { msg $chan 1,0"¼0,1¼»2,1"¼1,2¼»14,2"¼2,14¼»14,14"¼14,14¼»4,14"¼14,4¼»4,4------8Ironguard The Fierce4,4-----14,4"¼4,14¼»14,14"¼14,14¼»2,14"¼14,2¼»1,2"¼2,1¼»0,1"¼1,0¼» }
}
|
|
|
|
Joined: Oct 2004
Posts: 8,330
Hoopy frood
|
Hoopy frood
Joined: Oct 2004
Posts: 8,330 |
It would be much better if you give us your code attempt that uses ELSEIF and we'll help you figure out why it didn't work. It's easier to find problems than to do all of the work for you.
Invision Support #Invision on irc.irchighway.net
|
|
|
|
Joined: Jun 2006
Posts: 508
Fjord artisan
|
Fjord artisan
Joined: Jun 2006
Posts: 508 |
Like this perhaps...
on *:TEXT:-*:#: {
if (%icybot == off) { msg $chan Sorry, IcyBot is disabled. }
elseif (%banners == off) { msg $chan Sorry, banners are disabled. }
else {
if ($1 == -mpot) { msg $chan 11,0"¼0,11¼»12,11"¼11,12¼»2,12"¼12,2¼»2,2"¼2,2¼»10,2"¼2,10¼»10,10%%%%%%0 Master Mpot 10,10%%%%%%2,10"¼10,2¼»2,2"¼2,2¼»12,2"¼2,12¼»11,12"¼12,11¼»0,11"¼11,0¼» }
elseif ($1 == -colors) { msg $chan 0,1 1 0,2 2 0,3 3 0,4 4 0,5 5 0,6 6 0,7 7 0,8 8 0,9 9 0,10 10 0,11 11 0,12 12 0,13 13 0,14 14 0,15 15 }
elseif ($1 == -duncan) { msg $chan 9,0"¼0,9¼»10,9"¼9,10¼»2,10"¼10,2¼»2,2"¼2,2¼»3,2"¼2,3¼»3,3%%%%%%8 Duncan007 3,3%%%%%%2,3"¼3,2¼»2,2"¼2,2¼»10,2"¼2,10¼»9,10"¼10,9¼»0,9"¼9,0¼» }
elseif ($1 == -ichban) { msg $chan 4,0"¼0,4¼»10,4"¼4,10¼»2,10"¼10,2¼»2,2"¼2,2¼»1,2"¼2,1¼»1,1%%%%%%0 IchbanRyushi 1,1%%%%%%2,1"¼1,2¼»2,2"¼2,2¼»10,2"¼2,10¼»4,10"¼10,4¼»0,4"¼4,0¼» }
elseif ($1 == -kuros) { msg $chan 4,0"¼0,4¼»6,4"¼4,6¼»13,6"¼6,13¼»13,13"¼13,13¼»11,13"¼13,11¼»11,11%%%%%%0 Kuros 11,11%%%%%%13,11"¼11,13¼»13,13"¼13,13¼»6,13"¼13,6¼»4,6"¼6,4¼»0,4"¼4,0¼» }
elseif ($1 == -ekal) { msg $chan 11,0"¼0,11¼»12,11"¼11,12¼»2,12"¼12,2¼»2,2"¼2,2¼»10,2"¼2,10¼»10,10%%%%%%0 Ekal 10,10%%%%%%2,10"¼10,2¼»2,2"¼2,2¼»12,2"¼2,12¼»11,12"¼12,11¼»0,11"¼11,0¼» }
elseif ($1 == -lunaki) { msg $chan 13,0"¼0,13¼»1,13"¼13,1¼»2,1"¼1,2¼»2,2"¼2,2¼»6,2"¼2,6¼»6,6%%%%%%0 Lunaki 6,6%%%%%%2,6"¼6,2¼»2,2"¼2,2¼»1,2"¼2,1¼»13,1"¼1,13¼»0,13"¼13,0¼» }
elseif ($1 == -marajah) { msg $chan 3,0"¼0,3¼»1,3"¼3,1¼»5,1"¼1,5¼»5,5"¼5,5¼»2,5"¼5,2¼»2,2%%%%%%15 Marajah 2,2%%%%%%5,2"¼2,5¼»5,5"¼5,5¼»1,5"¼5,1¼»3,1"¼1,3¼»0,3"¼3,0¼» }
elseif ($1 == -kuro) { msg $chan 6,0"¼0,6¼»2,6"¼6,2¼»12,2"¼2,12¼»12,12"¼12,12¼»1,12"¼12,1¼»1,1------13Kuro-Sakura1,1-----12,1"¼1,12¼»12,12"¼12,12¼»2,12"¼12,2¼»6,2"¼2,6¼»0,6"¼6,0¼» }
elseif ($1 == -peth) { msg $chan 14,0"¼0,14¼»15,14"¼14,15¼»1,15"¼15,1¼»1,1"¼1,1¼»7,1"¼1,7¼»7,7------0Penguin7,7-----1,7"¼7,1¼»1,1"¼1,1¼»15,1"¼1,15¼»14,15"¼15,14¼»0,14"¼14,0¼» }
elseif ($1 == -vrixis) { msg $chan 4,0"¼0,4¼»5,4"¼4,5¼»4,5"¼5,4¼»4,4"¼4,4¼»5,4"¼4,5¼»5,5------4Vrixis5,5-----4,5"¼5,4¼»4,4"¼4,4¼»5,4"¼4,5¼»4,5"¼5,4¼»0,4"¼4,0¼» }
elseif ($1 == -austin) { msg $chan 1,0"¼0,1¼»6,1"¼1,6¼»15,6"¼6,15¼»15,15"¼15,15¼»14,15"¼15,14¼»14,14------8Austindel The Horrendous14,14-----15,14"¼14,15¼»15,15"¼15,15¼»6,15"¼15,6¼»1,6"¼6,1¼»0,1"¼1,0¼» }
elseif ($1 == -iron) { msg $chan 1,0"¼0,1¼»2,1"¼1,2¼»14,2"¼2,14¼»14,14"¼14,14¼»4,14"¼14,4¼»4,4------8Ironguard The Fierce4,4-----14,4"¼4,14¼»14,14"¼14,14¼»2,14"¼14,2¼»1,2"¼2,1¼»0,1"¼1,0¼» }
}
}
|
|
|
|
Joined: Apr 2007
Posts: 228
Fjord artisan
|
OP
Fjord artisan
Joined: Apr 2007
Posts: 228 |
on *:TEXT:-*:#: {
if (%icybot == off) { msg $chan Sorry, IcyBot is disabled. }
elseif (%banners == off) { msg $chan Sorry, banners are disabled. } elseif ($1 == -mpot) { msg $chan 11,0"¼0,11¼»12,11"¼11,12¼»2,12"¼12,2¼»2,2"¼2,2¼»10,2"¼2,10¼»10,10%%%%%%0 Master Mpot 10,10%%%%%%2,10"¼10,2¼»2,2"¼2,2¼»12,2"¼2,12¼»11,12"¼12,11¼»0,11"¼11,0¼» }
elseif ($1 == -colors) { msg $chan 0,1 1 0,2 2 0,3 3 0,4 4 0,5 5 0,6 6 0,7 7 0,8 8 0,9 9 0,10 10 0,11 11 0,12 12 0,13 13 0,14 14 0,15 15 }
elseif ($1 == -duncan) { msg $chan 9,0"¼0,9¼»10,9"¼9,10¼»2,10"¼10,2¼»2,2"¼2,2¼»3,2"¼2,3¼»3,3%%%%%%8 Duncan007 3,3%%%%%%2,3"¼3,2¼»2,2"¼2,2¼»10,2"¼2,10¼»9,10"¼10,9¼»0,9"¼9,0¼» }
elseif ($1 == -ichban) { msg $chan 4,0"¼0,4¼»10,4"¼4,10¼»2,10"¼10,2¼»2,2"¼2,2¼»1,2"¼2,1¼»1,1%%%%%%0 IchbanRyushi 1,1%%%%%%2,1"¼1,2¼»2,2"¼2,2¼»10,2"¼2,10¼»4,10"¼10,4¼»0,4"¼4,0¼» }
elseif ($1 == -kuros) { msg $chan 4,0"¼0,4¼»6,4"¼4,6¼»13,6"¼6,13¼»13,13"¼13,13¼»11,13"¼13,11¼»11,11%%%%%%0 Kuros 11,11%%%%%%13,11"¼11,13¼»13,13"¼13,13¼»6,13"¼13,6¼»4,6"¼6,4¼»0,4"¼4,0¼» }
elseif ($1 == -ekal) { msg $chan 11,0"¼0,11¼»12,11"¼11,12¼»2,12"¼12,2¼»2,2"¼2,2¼»10,2"¼2,10¼»10,10%%%%%%0 Ekal 10,10%%%%%%2,10"¼10,2¼»2,2"¼2,2¼»12,2"¼2,12¼»11,12"¼12,11¼»0,11"¼11,0¼» }
elseif ($1 == -lunaki) { msg $chan 13,0"¼0,13¼»1,13"¼13,1¼»2,1"¼1,2¼»2,2"¼2,2¼»6,2"¼2,6¼»6,6%%%%%%0 Lunaki 6,6%%%%%%2,6"¼6,2¼»2,2"¼2,2¼»1,2"¼2,1¼»13,1"¼1,13¼»0,13"¼13,0¼» }
elseif ($1 == -marajah) { msg $chan 3,0"¼0,3¼»1,3"¼3,1¼»5,1"¼1,5¼»5,5"¼5,5¼»2,5"¼5,2¼»2,2%%%%%%15 Marajah 2,2%%%%%%5,2"¼2,5¼»5,5"¼5,5¼»1,5"¼5,1¼»3,1"¼1,3¼»0,3"¼3,0¼» }
elseif ($1 == -kuro) { msg $chan 6,0"¼0,6¼»2,6"¼6,2¼»12,2"¼2,12¼»12,12"¼12,12¼»1,12"¼12,1¼»1,1------13Kuro-Sakura1,1-----12,1"¼1,12¼»12,12"¼12,12¼»2,12"¼12,2¼»6,2"¼2,6¼»0,6"¼6,0¼» }
elseif ($1 == -peth) { msg $chan 14,0"¼0,14¼»15,14"¼14,15¼»1,15"¼15,1¼»1,1"¼1,1¼»7,1"¼1,7¼»7,7------0Penguin7,7-----1,7"¼7,1¼»1,1"¼1,1¼»15,1"¼1,15¼»14,15"¼15,14¼»0,14"¼14,0¼» }
elseif ($1 == -vrixis) { msg $chan 4,0"¼0,4¼»5,4"¼4,5¼»4,5"¼5,4¼»4,4"¼4,4¼»5,4"¼4,5¼»5,5------4Vrixis5,5-----4,5"¼5,4¼»4,4"¼4,4¼»5,4"¼4,5¼»4,5"¼5,4¼»0,4"¼4,0¼» }
elseif ($1 == -austin) { msg $chan 1,0"¼0,1¼»6,1"¼1,6¼»15,6"¼6,15¼»15,15"¼15,15¼»14,15"¼15,14¼»14,14------8Austindel The Horrendous14,14-----15,14"¼14,15¼»15,15"¼15,15¼»6,15"¼15,6¼»1,6"¼6,1¼»0,1"¼1,0¼» }
elseif ($1 == -iron) { msg $chan 1,0"¼0,1¼»2,1"¼1,2¼»14,2"¼2,14¼»14,14"¼14,14¼»4,14"¼14,4¼»4,4------8Ironguard The Fierce4,4-----14,4"¼4,14¼»14,14"¼14,14¼»2,14"¼14,2¼»1,2"¼2,1¼»0,1"¼1,0¼» }
}
|
|
|
|
Joined: Apr 2007
Posts: 228
Fjord artisan
|
OP
Fjord artisan
Joined: Apr 2007
Posts: 228 |
I'll try that, Deegee. Furthermore, I just wrote this up with the if $ == b, so people can make the bars bold if they want. !colorbar4 is working fine, !colorbar5 isn't. I coping this right out of the scripts editor, I can't figure out why !colorbar5 isn't spacing in front of the IF's. Yes, I know, less halt more return, and more else, but It's a work in progress. on *:text:!colorbar_how:#:/notice $nick To make a colorbar with five colors, you can type !colorbar5 color1 color2 color3 color4 color5 nickcolor nick. To make one with four colors, you may type !colorbar4 color1 color2 color3 color4 nickcolor nick. To access the list of colors, type -colors. You can put more than one word in the name. A title is optional. After you have picked a colobrar, contact Mpot and send it to him. He will add it to my database for easy call up, and join notice.
on *:text:!colorbar4 *:#:{
if (%icybot == off) { msg $chan Sorry, IcyBot has been disabled. | halt }
if (%bannermaker == off) { msg $chan Sorry, banner making has been disabled. | halt }
if ($$7 == b) { msg $chan $+(,$2,$chr(44),0"¼0,$chr(44),$2¼»,$3,$chr(44),$2"¼,$2,$chr(44),$3¼»,$4,$chr(44),$3"¼,$3,$chr(44),$4¼»,$4,$chr(44),$4"¼,$4,$chr(44),$4¼»,$5,$chr(44),$4"¼,$4,$chr(44),$5¼»,$5,$chr(44),$5,------,$6,,$8-,,,$5,$chr(44),$5,-----,,$4,$chr(44),$5"¼,$5,$chr(44),$4¼»,$4,$chr(44),$4"¼,$4,$chr(44),$4¼»,$3,$chr(44),$4"¼,$4,$chr(44),$3¼»,$2,$chr(44),$3"¼,$3,$chr(44),$2,¼»0,$chr(44),$2"¼,$2,$chr(44),0¼») | halt }
msg $chan $+(,$2,$chr(44),0"¼0,$chr(44),$2¼»,$3,$chr(44),$2"¼,$2,$chr(44),$3¼»,$4,$chr(44),$3"¼,$3,$chr(44),$4¼»,$4,$chr(44),$4"¼,$4,$chr(44),$4¼»,$5,$chr(44),$4"¼,$4,$chr(44),$5¼»,$5,$chr(44),$5,------,$6,$7-,,$5,$chr(44),$5,-----,,$4,$chr(44),$5"¼,$5,$chr(44),$4¼»,$4,$chr(44),$4"¼,$4,$chr(44),$4¼»,$3,$chr(44),$4"¼,$4,$chr(44),$3¼»,$2,$chr(44),$3"¼,$3,$chr(44),$2,¼»0,$chr(44),$2"¼,$2,$chr(44),0¼») | halt }
}
on *:text:!colorbar5 *:#:{
if (%icybot == off) { msg $chan Sorry, IcyBot has been disabled. | halt }
if (%bannermaker == off) { msg $chan Sorry, banner making has been disabled. | halt }
if ($8 == b) { msg $chan $+(,$2,$chr(44),0"¼0,$chr(44),$2¼»,$3,$chr(44),$2"¼,$2,$chr(44),$3¼»,$4,$chr(44),$3"¼,$3,$chr(44),$4¼»,$4,$chr(44),$4"¼,$4,$chr(44),$4¼»,$5,$chr(44),$4"¼,$4,$chr(44),$5¼»,$5,$chr(44),$5,------,$6,,$9-,,,$5,$chr(44),$5,-----,,$4,$chr(44),$5"¼,$5,$chr(44),$4¼»,$4,$chr(44),$4"¼,$4,$chr(44),$4¼»,$3,$chr(44),$4"¼,$4,$chr(44),$3¼»,$2,$chr(44),$3"¼,$3,$chr(44),$2,¼»0,$chr(44),$2"¼,$2,$chr(44),0¼») | halt }
msg $chan $+(,$2,$chr(44),0"¼0,$chr(44),$2¼»,$3,$chr(44),$2"¼,$2,$chr(44),$3¼»,$4,$chr(44),$3"¼,$3,$chr(44),$4¼»,$5,$chr(44),$4"¼,$4,$chr(44),$5¼»,$6,$chr(44),$5"¼,$5,$chr(44),$6¼»,$6,$chr(44),$6,-------,$7,$8-,,$6,$chr(44),$6,-------,,$5,$chr(44),$6"¼,$6,$chr(44),$5¼»,$4,$chr(44),$5"¼,$5,$chr(44),$4¼»,$3,$chr(44),$4"¼,$4,$chr(44),$3¼»,$2,$chr(44),$3"¼,$3,$chr(44),$2,¼»0,$chr(44),$2"¼,$2,$chr(44),0¼»)
}
Last edited by Mpot; 28/09/07 10:26 PM.
|
|
|
|
Joined: Apr 2007
Posts: 228
Fjord artisan
|
OP
Fjord artisan
Joined: Apr 2007
Posts: 228 |
|
|
|
|
Joined: Apr 2007
Posts: 228
Fjord artisan
|
OP
Fjord artisan
Joined: Apr 2007
Posts: 228 |
What is the $chr for a space?
|
|
|
|
Joined: Sep 2005
Posts: 2,881
Hoopy frood
|
Hoopy frood
Joined: Sep 2005
Posts: 2,881 |
|
|
|
|
Joined: Apr 2007
Posts: 228
Fjord artisan
|
OP
Fjord artisan
Joined: Apr 2007
Posts: 228 |
You are a life-saver. I couldn't seem to get it with $asc.
|
|
|
|
Joined: Apr 2007
Posts: 228
Fjord artisan
|
OP
Fjord artisan
Joined: Apr 2007
Posts: 228 |
Why is unload C:\IcyBot2\Scripts\Callup_Banners.mrc
not working?
|
|
|
|
Joined: Sep 2005
Posts: 2,881
Hoopy frood
|
Hoopy frood
Joined: Sep 2005
Posts: 2,881 |
|
|
|
|
Joined: Apr 2007
Posts: 228
Fjord artisan
|
OP
Fjord artisan
Joined: Apr 2007
Posts: 228 |
So, the -rs switch is required?
|
|
|
|
Joined: Jul 2006
Posts: 4,185
Hoopy frood
|
Hoopy frood
Joined: Jul 2006
Posts: 4,185 |
Yes : /unload <-a|-nrs> <filename>
In the help file, arguments that are between < > are required
Last edited by Wims; 29/09/07 09:10 PM.
#mircscripting @ irc.swiftirc.net == the best mIRC help channel
|
|
|
|
Joined: Apr 2007
Posts: 228
Fjord artisan
|
OP
Fjord artisan
Joined: Apr 2007
Posts: 228 |
This is not working. It works all the way to the message, and then messages the $nick, but the $read isn't working, so the bot messages the nick with one word, the nickname of the person who insulted them, and it messes up. This should be working. I have another script, in the same exact directory, with a $read of a file in that directory, and it works fine. >.> EDIT: I changed it to read the file that the other script does, and it worked. Which leads me to believe that insult.txt is buggered. But the problem is, I tried several other .txt's, didn't work... on *:TEXT:!insult*:#:{
if ($2 == $null) { msg $chan Specify someone to insult. }
msg $$2 $nick $read(insult.txt) | closemsg $$2 | msg $chan $$2 has been insulted.
}
on *:TEXT:!insult*:?:{
if ($2 == $null) { msg $nick Specify someone to insult. }
msg $$2 $nick $read(insult.txt) | closemsg $$2 | msg $nick $$2 has been insulted.
}
And, insult.txt:
Last edited by Mpot; 29/09/07 09:53 PM.
|
|
|
|
Joined: Sep 2005
Posts: 2,881
Hoopy frood
|
Hoopy frood
Joined: Sep 2005
Posts: 2,881 |
Type //echo -a $isfile(insult.txt) in any window to see if the file exists.
|
|
|
|
Joined: Apr 2007
Posts: 228
Fjord artisan
|
OP
Fjord artisan
Joined: Apr 2007
Posts: 228 |
It's coming back $false. But that makes no sense. Because I'm looking at the file right now. Saved. It's there.
EDIT: I changed it to $read(C:\IcyBot2\Scripts\insult.txt) and it worked fine. Weirdest thing I've ever seen. o-0
Last edited by Mpot; 29/09/07 10:01 PM.
|
|
|
|
Joined: Jun 2006
Posts: 508
Fjord artisan
|
Fjord artisan
Joined: Jun 2006
Posts: 508 |
I can't figure out why !colorbar5 isn't spacing in front of the IF's.
The colorbar4 script has a closing brace in the line with no /if, but there is no opening brace...
|
|
|
|
Joined: Apr 2007
Posts: 228
Fjord artisan
|
OP
Fjord artisan
Joined: Apr 2007
Posts: 228 |
I can't figure out why !colorbar5 isn't spacing in front of the IF's.
The colorbar4 script has a closing brace in the line with no /if, but there is no opening brace... That would indeed explain it.
|
|
|
|
Joined: Jun 2006
Posts: 508
Fjord artisan
|
Fjord artisan
Joined: Jun 2006
Posts: 508 |
It's coming back $false. But that makes no sense. Because I'm looking at the file right now. Saved. It's there.
EDIT: I changed it to $read(C:\IcyBot2\Scripts\insult.txt) and it worked fine. Weirdest thing I've ever seen. o-0 try typing this //echo -ag $nofile($mircexe) | echo -ag $mircdir $mircdir is where mirc.ini is located, not mirc.exe This is where mirc will look for files with no paths, or relative paths. You can set mirc to use the dir where mirc.exe is (or another dir) with the -r commandline switch /help command line
|
|
|
|
|