mIRC Home    About    Download    Register    News    Help

Print Thread
Page 1 of 4 1 2 3 4
#186435 22/09/07 06:47 PM
Joined: Apr 2007
Posts: 228
M
Mpot Offline OP
Fjord artisan
OP Offline
Fjord artisan
M
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:
Code:
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?

Mpot #186436 22/09/07 07:02 PM
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
For the unban script, you could try:

Code:
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.

Code:
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
M
Mpot Offline OP
Fjord artisan
OP Offline
Fjord artisan
M
Joined: Apr 2007
Posts: 228
I can't say I understand how the login script works.

Mpot #186439 22/09/07 07:37 PM
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
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
M
Mpot Offline OP
Fjord artisan
OP Offline
Fjord artisan
M
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?

Mpot #186470 23/09/07 05:20 AM
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
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
Riamus2 #186502 23/09/07 05:45 PM
Joined: Apr 2007
Posts: 228
M
Mpot Offline OP
Fjord artisan
OP Offline
Fjord artisan
M
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.
Code:
;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


Code:
;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.
Mpot #186508 23/09/07 06:11 PM
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Code:
;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
M
Mpot Offline OP
Fjord artisan
OP Offline
Fjord artisan
M
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.
Mpot #186531 23/09/07 06:57 PM
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
/help $date

Sorry for the vague reply, but it's fairly simple.

Joined: Apr 2007
Posts: 228
M
Mpot Offline OP
Fjord artisan
OP Offline
Fjord artisan
M
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? -_________-;

Mpot #186537 23/09/07 07:06 PM
Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
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:

Code:
var %dateformat = mmm,d,yy, %timeformat = h,n,s,TT
echo -a $date(%dateformat) $time(%timeformat)

hixxy #186540 23/09/07 07:08 PM
Joined: Apr 2007
Posts: 228
M
Mpot Offline OP
Fjord artisan
OP Offline
Fjord artisan
M
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.
Mpot #186543 23/09/07 07:12 PM
Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
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.

hixxy #186544 23/09/07 07:15 PM
Joined: Apr 2007
Posts: 228
M
Mpot Offline OP
Fjord artisan
OP Offline
Fjord artisan
M
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.
Mpot #186549 23/09/07 07:24 PM
Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
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.

Mpot #186551 23/09/07 07:26 PM
Joined: Dec 2002
Posts: 2,028
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Dec 2002
Posts: 2,028
Just use $date($+(mmm,$chr(44),d,$chr(44),yy)) ?

RoCk #186554 23/09/07 07:41 PM
Joined: Apr 2007
Posts: 228
M
Mpot Offline OP
Fjord artisan
OP Offline
Fjord artisan
M
Joined: Apr 2007
Posts: 228
Alright, then why is it working fine with $time but not with $date?

Mpot #186555 23/09/07 07:48 PM
Joined: Apr 2007
Posts: 228
M
Mpot Offline OP
Fjord artisan
OP Offline
Fjord artisan
M
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.

Mpot #186559 23/09/07 08:11 PM
Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
I told you that earlier.

Code:
var %dateformat = mmm,d,yy, %timeformat = h,n,s,TT
echo -a $date(%dateformat) $time(%timeformat)

hixxy #186566 23/09/07 09:02 PM
Joined: Apr 2007
Posts: 228
M
Mpot Offline OP
Fjord artisan
OP Offline
Fjord artisan
M
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?

Mpot #186567 23/09/07 09:22 PM
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Use a timer.

Joined: Apr 2007
Posts: 228
M
Mpot Offline OP
Fjord artisan
OP Offline
Fjord artisan
M
Joined: Apr 2007
Posts: 228
No clue how.

Joined: Jan 2006
Posts: 111
N
Vogon poet
Offline
Vogon poet
N
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.
noMen #186575 23/09/07 09:38 PM
Joined: Apr 2007
Posts: 228
M
Mpot Offline OP
Fjord artisan
OP Offline
Fjord artisan
M
Joined: Apr 2007
Posts: 228
So it'll read a line, wait, read a line, wait?

noMen #186576 23/09/07 09:40 PM
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
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
M
Mpot Offline OP
Fjord artisan
OP Offline
Fjord artisan
M
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?

Mpot #186582 23/09/07 09:57 PM
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
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
M
Mpot Offline OP
Fjord artisan
OP Offline
Fjord artisan
M
Joined: Apr 2007
Posts: 228
So

/play C:\IcyBot2\Scripts\bot-op_help.txt 1750

Would be the command?


Mpot #186586 23/09/07 10:20 PM
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
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
M
Mpot Offline OP
Fjord artisan
OP Offline
Fjord artisan
M
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:

Code:
on syscon:TEXT:!botop_help:*:{
  play C:\IcyBot2\Scripts\op_help.text 1750
  halt
}

Last edited by Mpot; 23/09/07 11:47 PM.
Mpot #186593 24/09/07 12:03 AM
Joined: Apr 2007
Posts: 228
M
Mpot Offline OP
Fjord artisan
OP Offline
Fjord artisan
M
Joined: Apr 2007
Posts: 228
This is not working. Why? (Yes, the access level syscon is taken care of)

Code:
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 }
}

Mpot #186594 24/09/07 12:08 AM
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Code:
on syscon:TEXT:!botop_help:*:{
  play $nick C:\IcyBot2\Scripts\op_help.text 1750
  halt
}

Joined: Apr 2007
Posts: 228
M
Mpot Offline OP
Fjord artisan
OP Offline
Fjord artisan
M
Joined: Apr 2007
Posts: 228
Any idea what's wrong with the !join?

Mpot #186600 24/09/07 03:16 AM
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
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
Riamus2 #186622 24/09/07 11:40 AM
Joined: Apr 2007
Posts: 228
M
Mpot Offline OP
Fjord artisan
OP Offline
Fjord artisan
M
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.

Mpot #186623 24/09/07 11:45 AM
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Quote:
and they do what I want.


You just said your Join Text event doesn't work.

Joined: Jan 2006
Posts: 111
N
Vogon poet
Offline
Vogon poet
N
Joined: Jan 2006
Posts: 111
Originally Posted By: SladeKraven
Quote:
and they do what I want.


You just said your Join Text event doesn't work.


Thats why he asks questions smile

But Mpot has a point:
Originally Posted By: Mpot
Quote:
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 ....

noMen #186675 24/09/07 08:34 PM
Joined: Apr 2007
Posts: 228
M
Mpot Offline OP
Fjord artisan
OP Offline
Fjord artisan
M
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:

Code:
;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.
Mpot #186678 24/09/07 08:49 PM
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Originally Posted By: Mpot
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
Riamus2 #186681 24/09/07 09:12 PM
Joined: Apr 2007
Posts: 228
M
Mpot Offline OP
Fjord artisan
OP Offline
Fjord artisan
M
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

Mpot #186694 24/09/07 10:24 PM
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
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
Riamus2 #186698 25/09/07 12:26 AM
Joined: Apr 2007
Posts: 228
M
Mpot Offline OP
Fjord artisan
OP Offline
Fjord artisan
M
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.
Mpot #186700 25/09/07 01:10 AM
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
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.

Code:
;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.
Code:
;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.

Code:
;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.

Code:
; #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
Riamus2 #186713 25/09/07 11:50 AM
Joined: Apr 2007
Posts: 228
M
Mpot Offline OP
Fjord artisan
OP Offline
Fjord artisan
M
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:

Code:
;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. }
}




Mpot #186714 25/09/07 12:25 PM
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
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,028
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Dec 2002
Posts: 2,028
...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)

RoCk #186716 25/09/07 12:44 PM
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
For that case yes, for his case either.

Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
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
M
Mpot Offline OP
Fjord artisan
OP Offline
Fjord artisan
M
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

Mpot #186749 25/09/07 10:01 PM
Joined: Apr 2007
Posts: 228
M
Mpot Offline OP
Fjord artisan
OP Offline
Fjord artisan
M
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:

Code:
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.
Mpot #186750 25/09/07 10:23 PM
Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
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:

Code:
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.

hixxy #186751 25/09/07 10:26 PM
Joined: Apr 2007
Posts: 228
M
Mpot Offline OP
Fjord artisan
OP Offline
Fjord artisan
M
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.


Code:
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.
Mpot #186762 26/09/07 02:04 AM
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
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...

Code:
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
Mpot #186770 26/09/07 09:58 AM
Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
You appear to misunderstand how else statements work, so here's few comments to explain it:

Code:
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. }

hixxy #186812 26/09/07 08:16 PM
Joined: Apr 2007
Posts: 228
M
Mpot Offline OP
Fjord artisan
OP Offline
Fjord artisan
M
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.

Mpot #186815 26/09/07 09:04 PM
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
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...

Code:
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
Riamus2 #186824 27/09/07 12:15 AM
Joined: Apr 2007
Posts: 228
M
Mpot Offline OP
Fjord artisan
OP Offline
Fjord artisan
M
Joined: Apr 2007
Posts: 228
I'll take a look at working on this tomorrow. Thanks for the hints!

Mpot #186896 27/09/07 11:22 PM
Joined: Apr 2007
Posts: 228
M
Mpot Offline OP
Fjord artisan
OP Offline
Fjord artisan
M
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?

Code:
;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,1112,11"11,122,12"12,22,2"2,210,2"2,1010,10%%%%%%0 Master Mpot 10,10%%%%%%2,10"10,22,2"2,212,2"2,1211,12"12,110,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,910,9"9,102,10"10,22,2"2,23,2"2,33,3%%%%%%8 Duncan007 3,3%%%%%%2,3"3,22,2"2,210,2"2,109,10"10,90,9"9,0 }
  if ($1 == -ichban) { msg $chan 4,0"0,410,4"4,102,10"10,22,2"2,21,2"2,11,1%%%%%%0 IchbanRyushi 1,1%%%%%%2,1"1,22,2"2,210,2"2,104,10"10,40,4"4,0 }
  if ($1 == -kuros) { msg $chan 4,0"0,46,4"4,613,6"6,1313,13"13,1311,13"13,1111,11%%%%%%0 Kuros 11,11%%%%%%13,11"11,1313,13"13,136,13"13,64,6"6,40,4"4,0 }
  if ($1 == -ekal) { msg $chan 11,0"0,1112,11"11,122,12"12,22,2"2,210,2"2,1010,10%%%%%%0 Ekal 10,10%%%%%%2,10"10,22,2"2,212,2"2,1211,12"12,110,11"11,0 }
  if ($1 == -lunaki) { msg $chan 13,0"0,131,13"13,12,1"1,22,2"2,26,2"2,66,6%%%%%%0 Lunaki 6,6%%%%%%2,6"6,22,2"2,21,2"2,113,1"1,130,13"13,0 }
  if ($1 == -marajah) { msg $chan 3,0"0,31,3"3,15,1"1,55,5"5,52,5"5,22,2%%%%%%15 Marajah 2,2%%%%%%5,2"2,55,5"5,51,5"5,13,1"1,30,3"3,0 }
  if ($1 == -kuro) { msg $chan 6,0"0,62,6"6,212,2"2,1212,12"12,121,12"12,11,1------13Kuro-Sakura1,1-----12,1"1,1212,12"12,122,12"12,26,2"2,60,6"6,0 }
  if ($1 == -peth) { msg $chan 14,0"0,1415,14"14,151,15"15,11,1"1,17,1"1,77,7------0Penguin7,7-----1,7"7,11,1"1,115,1"1,1514,15"15,140,14"14,0 }
  if ($1 == -vrixis) { msg $chan 4,0"0,45,4"4,54,5"5,44,4"4,45,4"4,55,5------4Vrixis5,5-----4,5"5,44,4"4,45,4"4,54,5"5,40,4"4,0 }
  if ($1 == -austin) { msg $chan 1,0"0,16,1"1,615,6"6,1515,15"15,1514,15"15,1414,14------8Austindel The Horrendous14,14-----15,14"14,1515,15"15,156,15"15,61,6"6,10,1"1,0 }
  if ($1 == -iron) { msg $chan 1,0"0,12,1"1,214,2"2,1414,14"14,144,14"14,44,4------8Ironguard The Fierce4,4-----14,4"4,1414,14"14,142,14"14,21,2"2,10,1"1,0 }
}

Mpot #186903 28/09/07 02:02 AM
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
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. smile


Invision Support
#Invision on irc.irchighway.net
Mpot #186911 28/09/07 05:42 AM
Joined: Jun 2006
Posts: 508
D
Fjord artisan
Offline
Fjord artisan
D
Joined: Jun 2006
Posts: 508
Like this perhaps...
Code:
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,1112,11"11,122,12"12,22,2"2,210,2"2,1010,10%%%%%%0 Master Mpot 10,10%%%%%%2,10"10,22,2"2,212,2"2,1211,12"12,110,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,910,9"9,102,10"10,22,2"2,23,2"2,33,3%%%%%%8 Duncan007 3,3%%%%%%2,3"3,22,2"2,210,2"2,109,10"10,90,9"9,0 }
    elseif ($1 == -ichban) { msg $chan 4,0"0,410,4"4,102,10"10,22,2"2,21,2"2,11,1%%%%%%0 IchbanRyushi 1,1%%%%%%2,1"1,22,2"2,210,2"2,104,10"10,40,4"4,0 }
    elseif ($1 == -kuros) { msg $chan 4,0"0,46,4"4,613,6"6,1313,13"13,1311,13"13,1111,11%%%%%%0 Kuros 11,11%%%%%%13,11"11,1313,13"13,136,13"13,64,6"6,40,4"4,0 }
    elseif ($1 == -ekal) { msg $chan 11,0"0,1112,11"11,122,12"12,22,2"2,210,2"2,1010,10%%%%%%0 Ekal 10,10%%%%%%2,10"10,22,2"2,212,2"2,1211,12"12,110,11"11,0 }
    elseif ($1 == -lunaki) { msg $chan 13,0"0,131,13"13,12,1"1,22,2"2,26,2"2,66,6%%%%%%0 Lunaki 6,6%%%%%%2,6"6,22,2"2,21,2"2,113,1"1,130,13"13,0 }
    elseif ($1 == -marajah) { msg $chan 3,0"0,31,3"3,15,1"1,55,5"5,52,5"5,22,2%%%%%%15 Marajah 2,2%%%%%%5,2"2,55,5"5,51,5"5,13,1"1,30,3"3,0 }
    elseif ($1 == -kuro) { msg $chan 6,0"0,62,6"6,212,2"2,1212,12"12,121,12"12,11,1------13Kuro-Sakura1,1-----12,1"1,1212,12"12,122,12"12,26,2"2,60,6"6,0 }
    elseif ($1 == -peth) { msg $chan 14,0"0,1415,14"14,151,15"15,11,1"1,17,1"1,77,7------0Penguin7,7-----1,7"7,11,1"1,115,1"1,1514,15"15,140,14"14,0 }
    elseif ($1 == -vrixis) { msg $chan 4,0"0,45,4"4,54,5"5,44,4"4,45,4"4,55,5------4Vrixis5,5-----4,5"5,44,4"4,45,4"4,54,5"5,40,4"4,0 }
    elseif ($1 == -austin) { msg $chan 1,0"0,16,1"1,615,6"6,1515,15"15,1514,15"15,1414,14------8Austindel The Horrendous14,14-----15,14"14,1515,15"15,156,15"15,61,6"6,10,1"1,0 }
    elseif ($1 == -iron) { msg $chan 1,0"0,12,1"1,214,2"2,1414,14"14,144,14"14,44,4------8Ironguard The Fierce4,4-----14,4"4,1414,14"14,142,14"14,21,2"2,10,1"1,0 }
  }
}

Riamus2 #186924 28/09/07 11:47 AM
Joined: Apr 2007
Posts: 228
M
Mpot Offline OP
Fjord artisan
OP Offline
Fjord artisan
M
Joined: Apr 2007
Posts: 228
Code:
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,1112,11"11,122,12"12,22,2"2,210,2"2,1010,10%%%%%%0 Master Mpot 10,10%%%%%%2,10"10,22,2"2,212,2"2,1211,12"12,110,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,910,9"9,102,10"10,22,2"2,23,2"2,33,3%%%%%%8 Duncan007 3,3%%%%%%2,3"3,22,2"2,210,2"2,109,10"10,90,9"9,0 }
  elseif ($1 == -ichban) { msg $chan 4,0"0,410,4"4,102,10"10,22,2"2,21,2"2,11,1%%%%%%0 IchbanRyushi 1,1%%%%%%2,1"1,22,2"2,210,2"2,104,10"10,40,4"4,0 }
  elseif ($1 == -kuros) { msg $chan 4,0"0,46,4"4,613,6"6,1313,13"13,1311,13"13,1111,11%%%%%%0 Kuros 11,11%%%%%%13,11"11,1313,13"13,136,13"13,64,6"6,40,4"4,0 }
  elseif ($1 == -ekal) { msg $chan 11,0"0,1112,11"11,122,12"12,22,2"2,210,2"2,1010,10%%%%%%0 Ekal 10,10%%%%%%2,10"10,22,2"2,212,2"2,1211,12"12,110,11"11,0 }
  elseif ($1 == -lunaki) { msg $chan 13,0"0,131,13"13,12,1"1,22,2"2,26,2"2,66,6%%%%%%0 Lunaki 6,6%%%%%%2,6"6,22,2"2,21,2"2,113,1"1,130,13"13,0 }
  elseif ($1 == -marajah) { msg $chan 3,0"0,31,3"3,15,1"1,55,5"5,52,5"5,22,2%%%%%%15 Marajah 2,2%%%%%%5,2"2,55,5"5,51,5"5,13,1"1,30,3"3,0 }
  elseif ($1 == -kuro) { msg $chan 6,0"0,62,6"6,212,2"2,1212,12"12,121,12"12,11,1------13Kuro-Sakura1,1-----12,1"1,1212,12"12,122,12"12,26,2"2,60,6"6,0 }
  elseif ($1 == -peth) { msg $chan 14,0"0,1415,14"14,151,15"15,11,1"1,17,1"1,77,7------0Penguin7,7-----1,7"7,11,1"1,115,1"1,1514,15"15,140,14"14,0 }
  elseif ($1 == -vrixis) { msg $chan 4,0"0,45,4"4,54,5"5,44,4"4,45,4"4,55,5------4Vrixis5,5-----4,5"5,44,4"4,45,4"4,54,5"5,40,4"4,0 }
  elseif ($1 == -austin) { msg $chan 1,0"0,16,1"1,615,6"6,1515,15"15,1514,15"15,1414,14------8Austindel The Horrendous14,14-----15,14"14,1515,15"15,156,15"15,61,6"6,10,1"1,0 }
  elseif ($1 == -iron) { msg $chan 1,0"0,12,1"1,214,2"2,1414,14"14,144,14"14,44,4------8Ironguard The Fierce4,4-----14,4"4,1414,14"14,142,14"14,21,2"2,10,1"1,0 }
}

Mpot #186936 28/09/07 10:21 PM
Joined: Apr 2007
Posts: 228
M
Mpot Offline OP
Fjord artisan
OP Offline
Fjord artisan
M
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.

Code:
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.
Mpot #186976 29/09/07 04:38 PM
Joined: Apr 2007
Posts: 228
M
Mpot Offline OP
Fjord artisan
OP Offline
Fjord artisan
M
Joined: Apr 2007
Posts: 228
Bump for great justice?

Mpot #186981 29/09/07 06:18 PM
Joined: Apr 2007
Posts: 228
M
Mpot Offline OP
Fjord artisan
OP Offline
Fjord artisan
M
Joined: Apr 2007
Posts: 228
What is the $chr for a space?

Mpot #186984 29/09/07 06:21 PM
Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
32

hixxy #186986 29/09/07 06:24 PM
Joined: Apr 2007
Posts: 228
M
Mpot Offline OP
Fjord artisan
OP Offline
Fjord artisan
M
Joined: Apr 2007
Posts: 228
You are a life-saver. I couldn't seem to get it with $asc.

Mpot #186989 29/09/07 06:38 PM
Joined: Apr 2007
Posts: 228
M
Mpot Offline OP
Fjord artisan
OP Offline
Fjord artisan
M
Joined: Apr 2007
Posts: 228
Why is
Code:
unload C:\IcyBot2\Scripts\Callup_Banners.mrc
not working?

Mpot #186993 29/09/07 07:02 PM
Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
unload -rs

hixxy #186994 29/09/07 07:05 PM
Joined: Apr 2007
Posts: 228
M
Mpot Offline OP
Fjord artisan
OP Offline
Fjord artisan
M
Joined: Apr 2007
Posts: 228
So, the -rs switch is required?

Mpot #186995 29/09/07 07:10 PM
Joined: Jul 2006
Posts: 3,971
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,971
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
Wims #186997 29/09/07 09:11 PM
Joined: Apr 2007
Posts: 228
M
Mpot Offline OP
Fjord artisan
OP Offline
Fjord artisan
M
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...

Code:
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:

Code:
insult
insult
insult
etc

Last edited by Mpot; 29/09/07 09:53 PM.
Mpot #187003 29/09/07 09:53 PM
Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
Type //echo -a $isfile(insult.txt) in any window to see if the file exists.

hixxy #187004 29/09/07 09:58 PM
Joined: Apr 2007
Posts: 228
M
Mpot Offline OP
Fjord artisan
OP Offline
Fjord artisan
M
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.
Mpot #187008 29/09/07 10:32 PM
Joined: Jun 2006
Posts: 508
D
Fjord artisan
Offline
Fjord artisan
D
Joined: Jun 2006
Posts: 508
Originally Posted By: Mpot

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...

deegee #187020 29/09/07 11:55 PM
Joined: Apr 2007
Posts: 228
M
Mpot Offline OP
Fjord artisan
OP Offline
Fjord artisan
M
Joined: Apr 2007
Posts: 228
Originally Posted By: deegee
Originally Posted By: Mpot

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.

Mpot #187027 30/09/07 01:30 AM
Joined: Jun 2006
Posts: 508
D
Fjord artisan
Offline
Fjord artisan
D
Joined: Jun 2006
Posts: 508
Originally Posted By: Mpot
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

Page 1 of 4 1 2 3 4

Link Copied to Clipboard