Advanced amsg by Savage_CL

By Savage_CL on Aug 28, 2011

Whipped this up on a whim to improve my amsg while loop.

; Use to send global messages.
; allows for the exemption of channels (ctrl + click or click & drag to highlight)
; Saves an (optional) history of past amsg's
; WARNING: Use at your own risk, as this script bypasses the normal "no multi-target messaging" channel mode!

; Use to send global messages.
; allows for the exemption of channels (ctrl + click or click & drag to highlight)
; Saves an (optional) history of past amsg's
; WARNING: Use at your own risk, as this script bypasses the normal "no multi-target messaging" channel mode!

; Drop by #savage_CL on SwiftIRC (irc.swiftirc.net) and let me know what you think!

menu menubar,channel,status {
  amsg:dmsg
}
alias dmsg dialog -mh amsg amsg 15 15 128 107
dialog -l amsg {
  title "amsg by Savage_CL 1.0"
  size -1 -1 128 107
  option dbu
  list 1, 65 1 62 75, size extsel
  text "Exempted chans ->", 2, 5 2 59 8, right
  check "Global prefix", 3, 8 20 50 10
  check "/amsg suffix", 4, 8 30 50 10
  check "Save message?", 6, 8 40 50 10
  combo 7, 3 94 98 10, drop
  edit "", 8, 3 80 122 10
  text "Message:", 9, 5 71 32 8
  button "SEND!", 10, 103 94 22 12, ok
  text "(control click) ", 11, 5 12 59 8, right
  button "Clear History", 5, 8 53 49 12
}

on *:DIALOG:amsg:init:0:{
  if ($server) { 
    if ($chan(0)) {
      var %temp 1
      while (%temp <= $chan(0)) {
        did -a amsg 1 $chan(%temp)
        inc %temp
      }
      if ($isfile(data/amsg.txt)) {
        if ($lines(data/amsg.txt)) {
          var %ttemp $lines(data/amsg.txt)
          while (%ttemp) {
            did -a amsg 7 $read(data/amsg.txt,%ttemp)
            dec %ttemp
          }
        }
        else { did -b amsg 7 }
      }
      else { did -b amsg 7 }
    }
    else { did -x amsg | noop $input(You aren't in any channels on $network $+ . }
  }
  else { did -x amsg | noop $input(You must be connected to a server to use this dialog! }
}
on *:DIALOG:amsg:sclick:5:{ 
  if (($isfile(data/amsg.txt)) && ($input(Are you sure? $crlf $+ This is permenant!,yw,amsg by Savage_CL 1.0))) {
    did -rb amsg 7 | .remove data/amsg.txt 
  }
}
on *:DIALOG:amsg:edit:8:{
  if ($did(amsg,8,1).len == 0) {
    did -bl amsg 6

  }
  else {
    did -e amsg 6
  }
}
on *:DIALOG:amsg:sclick:10:{
  if ($did(amsg,8,1).len != 0) {
    var %msg $did(amsg,8).text
    if ($did(amsg,6).state) write data/amsg.txt %msg
  }
  else {
    if ($did(amsg,7)) { var %msg $did(amsg,7).text }
    else { { noop $input(You must choose a message to send!,wo,amsg by Savage_CL 1.0) | HALT } }
  }
  var %temp 1
  while (%temp <= $did(amsg,1).lines) {
    if ($did(amsg,1,%temp).state == 0) msg $did(amsg,1,%temp) $iif($did(amsg,3).state,$chr(40) $+ GLOBAL $+ $chr(41)) %msg $iif($did(amsg,4).state,[/amsg]))
    inc %temp
  }
  dialog -x amsg
}
on *:LOAD:{ if (!$isdir(data)) mkdir data }

Comments

Sign in to comment.
Jethro   -  Aug 31, 2011

ignore initialization events.I don't reckon there is an option to ignore or block it. I'm not certain where you get that idea from. > it WILL initiate a dialog that asks if you wish to perform them without loading them.it could happen, but it's not always the case.

 Respond  
Savage_CL   -  Aug 29, 2011

Unless you have mIRC specifically set up to ignore initializaiton events, it WILL initiate a dialog that asks if you wish to perform them without loading them. I appologise for my outburst, anyway, I was not a happy person because of real life circumstances.

 Respond  
err0r007   -  Aug 29, 2011

you have to learn to accept constructive criticism if you release public works. There are always those that post just to nit pick or troll. Jethro's post was an example of the constructive type. Meant only to improve the experience of ppl that wish to use your snippet. No reason to insult him over it. Having dealt with so many casual mirc users over the years I agree with Jethro. Most will simply copy and paste thus bypassing the on load.

 Respond  
Jethro   -  Aug 28, 2011

Look, this is social networking site. If you can't oblige people's suggestions and not get offended or cocky, perhaps you shouldn't post your snippet to begin with. You didn't have to add this line to create a bitter atmosphere > Next time please think about what you are saying before you post.
Perhaps next time you should think about adding that on load event to create a directory first, so that this script will work 100%. Thank you for nothing.

Incidentally, if a user copies and pastes your script directly onto his or her remote without loading, that load event will be purposeless.

 Respond  
Savage_CL   -  Aug 28, 2011

OR I can do it all with one line, like I intended on doing. Look in the on LOAD.

In other words, this isn't a personal script. I wouldn't go to the trouble for a personal script.

Next time please think about what you are saying before you post.

 Respond  
Jethro   -  Aug 28, 2011

This looks like one of your personal scripts submitted without being edited. Unfortunately this will not work:> write data/amsg.txt %msgbecause not everyone has a location path with "data" in it.

You're advised to change it to:

write $scriptdiramsg.txt %msg

this will make sure the text file is written to mIRC's remote directory. Finally, change the $read() bit to:

$read($scriptdiramsg.txt,%ttemp)

You can also use

$mircdiramsg.txt

if you prefer.

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.