Jump to content
coders-irc_Bot

MeMessage.mrc

Recommended Posts

  • Administrators

Creates a managed dialog box for editing " /ME " messages. It also allows you to count the characters typed, customize the color and command for sending a message.

Control: To open the Control Panel, press the "F9" key. (You can reassign the key in the alias to a more convenient one for you.)

################################################### ####################
# Name: Me Message v1.0
# Author: Epic (epicnet@mail.ru, http://epicnet.ru)
# Description: Creates a managed dialog for editing "/ME" messages.
# Management: To open the control panel, press the "F9" key.
################################################### ####################

alias F9 {
  if (!$dialog(me)) {
    unset %me_chars %me_mess | .dialog -mp me me | .dialog -r me
    me_colors me 5 | if (%me_colors) .did -c me 5 %me_colors
    me_select me 6 | if (%me_select) .did -c me 6 %me_select | else .did -c me 6 1
  }
  else .dialog -x me
}
dialog me {
  title "Me Message"
  size -1 -1 300 235
  option pixels
  edit "", 1, 10 10 280 130, multi autovs, limit 900
  text "Characters:", 2, 30 155 55 20, nowrap
  edit "0", 3, 88 152 30 21, read rich right, limit 4
  text "Color:", 4, 130 155 40 20, nowrap
  combo 5, 165 151 104 20, drop
  combo 6, 30 191 65 20, drop
  button "Submit ➤", 10, 105 190 165 23
}
on *:DIALOG:me:edit:1: unset %me_chars | var %q 1 | while (%q <= $did($dname,$did).lines) { %me_chars = $calc(%me_chars + $did($dname,$did,%q).len) | inc %q } | .did -o $dname 3 1 %me_chars
on *:DIALOG:me:sclick:5: %me_colors = $did($dname,$did).sel
on *:DIALOG:me:sclick:6: %me_select = $did($dname,$did).sel
alias -l me_colors { .did -a $1 $2 White | .did -a $1 $2 Black | .did -a $1 $2 T.Blue | .did -a $1 $2 Green | .did -a $1 $2 Red | .did -a $1 $2 Brown | .did -a $1 $2 Purple | .did -a $1 $2 Orange | .did -a $1 $2 Yellow | .did -a $1 $2 Light green | .did -a $1 $2 Marine | .did -a $1 $2 Blue | .did -a $1 $2 Blue | .did -a $1 $2 Pink | .did -a $1 $2 Gray | .did -a $1 $2 C.Grey }
alias -l me_select { .did -a $1 $2 /me | .did -a $1 $2 /ame | .did -a $1 $2 /qme }
on *:DIALOG:me:sclick:10:{
  unset %me_mess | var %q 1 | while (%q <= $did($dname,1).lines) { %me_mess = %me_mess $did($dname,1,%q).text | inc %q }
  if (%me_colors) { var %me_col $calc(%me_colors -1) | if ($len(%me_col) == 1) var %me_col $+($chr(3),0,%me_col) | else var %me_col $+($chr(3),%me_col) }
  if (%me_chars > 0) .editbox -an $did($dname,6,0).text $+(%me_col,%me_mess)
  else .echo -a :: Please write your text ➤

 

Link to comment
Share on other sites

  • Administrators

Description: Creates a managed dialog box for editing " /ME " messages. It also allows you to count the typed characters, customize the color and command for sending a message.

Management: To open the control panel, press the " F9 " key. (You can remap the key in the alias to something more convenient for you).

Update:

Improved and optimized the overall functionality of the code.

Added a color palette for easy selection of the message color.

The color label on the button has been changed - now it is in the form of a serial number in brackets.

Added a button for setting options when working with a dialog box.

################################################### ####################
# Name: Me Message v1.1
# Author: Epic (epicnet@mail.ru, http://epicnet.ru)
# Description: Creates a managed dialog for editing "/ME" messages.
# Management: To open the control panel, press the "F9" key.
################################################### ####################

alias F9 {
  if (!$dialog(me)) {
    unset %me_chars | me_set | .dialog -mp me me | .dialog -r me
    if (%me_color) .did -a me 4 %me_tcolors $+($chr(40),%me_color,$chr(41))
    me_select me 6 | if (%me_select) .did -c me 6 %me_select | else .did -c me 6 1
    if (%meo_check2) { .did -a me 1 %me_mess | me_calclines me 1 }
  } | else .dialog -x me
}
dialog -l me {
  title %me_title
  size -1 -1 300 235
  option pixels
  edit "", 1, 10 10 280 130, multi autovs, limit 900
  text %me_tchars, 2, 30 155 39 20, nowrap
  edit "0", 3, 74 152 27 21, read rich right, limit 4
  button %me_tcolors, 4, 115 151 120 22
  button %me_tbutton_set, 5, 248 151 22 22
  combo 6, 30 191 70 20, drop
  button %me_tbutton_ok, 10, 115 190 155 23, default
}
on *:DIALOG:me:close:0: me_winclose
on *:DIALOG:me:edit:1: me_calclines $dname $did | me_winclose
on *:DIALOG:me:sclick:4: me_colors $dname | if (!$window(@MeColors)) .did -f me 1
on *:DIALOG:me:sclick:5: me_options $dname
on *:DIALOG:me:sclick:6: %me_select = $did($dname,$did).sel
on *:DIALOG:me:sclick:10:{
  me_winclose | unset %me_mess | var %q 1 | while (%q <= $did($dname,1).lines) { %me_mess = %me_mess $did($dname,1,%q).text | inc %q }
  if (%me_color) { var %me_col $+($chr(3),%me_color) }
  var %me_message $did($dname,6,0).text $+(%me_col,%me_mess)
  if (%me_chars > 0) {
    if (!%meo_check3) .editbox -afn %me_message
    if (%meo_check3) .editbox -af %me_message
    if (!%meo_check2) { .did -r $dname 1 | unset %me_chars | .did -i $dname 3 1 0 }
    if (%meo_check1) .dialog -x $dname
  }
  else { .echo -a %me_terror_notext | .did -f me 1 }
}
-------------------------------------------------- --------------------
alias -l me_set {
  %me_title = Me Message
  %me_tchars = Symbol:
  %me_tcolors = Color:
  %me_tbutton_set = 
  %me_tbutton_ok = Submit 
  %me_tselect = /me /ame /qme
  %me_terror_notext = :: Please write text 
}
alias -l me_winclose { if ($window(@MeColors)) .window -c @MeColors | if ($dialog(me_options)) .dialog -x me_options }
alias -l me_calclines { unset %me_chars | var %q 1 | while (%q <= $did($1,$2).lines) { %me_chars = $calc(%me_chars + $did($1,$2,%q).len) | inc %q } | .did -o $1 3 1 %me_chars }
alias -l me_select { var %me_q 1 | while (%me_q <= $numtok(%me_tselect,32)) { .did -a $1 $2 $gettok(%me_tselect,%me_q,32) | inc %me_q } }
alias -l me_colors {
  if (!$window(@MeColors)) {
    .window -padhik0 +beL @MeColors $calc($dialog($1).x +45) $calc($dialog($1).y +90) 215 63 | .window -a @MeColors
    .drawrect -f @MeColors 14 1 0 0 250 80
    var %me_x 6 | var %me_y 6 | var %me_q 0 | while (%me_q <= 15) {
      .drawrect -f @MeColors %me_q 1 %me_x %me_y 22 22
      .drawrect @MeColors 15 1 %me_x %me_y 22 22
      .hadd -m mecoordcol-x %me_q $+(%me_x,-,$calc(%me_x +22))
      .hadd -m mecoordcol-y %me_q $+(%me_y,-,$calc(%me_y +22))
      inc %me_q | inc %me_x 25 | if (%me_q == 8) { var %me_x 6 | inc %me_y 25 }
    }
  }
  else .window -c @MeColors
}
menu @MeColors {
  sclick {
    var %me_mx $mouse.x | var %me_my $mouse.y
    var %me_q 0 | while (%me_q <= 15) {
      var %me_hx $hget(mecoordcol-x,%me_q) | var %me_hy $hget(mecoordcol-y,%me_q)
      if (%me_mx isnum %me_hx && %me_my isnum %me_hy) { if (%me_q < 10) var %me_q $+(0,%me_q) | .did -a me 4 %me_tcolors $+($chr(40),%me_q,$chr(41)) | %me_color = %me_q | .break}
      inc %me_q
    }
    .window -c @MeColors | if ($dialog(me)) .did -f me 1
  }
}
-------------------------------------------------- --------------------
alias -l me_options {
  if (!$dialog(me_options)) {
    me_options_set | .dialog -mp me_options me_options
    if (%meo_check1) .did -c me_options 1
    if (%meo_check2) .did -c me_options 2
    if (%meo_check3) .did -c me_options 3
  }
  else .dialog -x me_options
}
dialog -l me_options {
  title "Me Options"
  size -1 -1 340 100
  option pixels
  check %meo_t1, 1, 15 20 320 20
  check %meo_t2, 2, 15 40 320 20
  check %meo_t3, 3, 15 60 320 20
}
alias -l me_options_set {
  %meo_t1 = Close window after clicking "Submit"
  %meo_t2 = Save message after click "Submit"
  %meo_t3 = Move message to EditBox after clicking "Submit"
}
on *:DIALOG:me_options:close:0: if ($dialog(me)) .did -f me 1
on *:DIALOG:me_options:sclick:1: if ($did($dname,$did).state == 1) %meo_check1 = 1 | else unset %meo_check1
on *:DIALOG:me_options:sclick:2: if ($did($dname,$did).state == 1) %meo_check2 = 1 | else unset %meo_check2
on *:DIALOG:me_options:sclick:3: if ($did($dname,$did).state == 1) %meo_check3 = 1 | else unset %meo_check3

 

MeMessage_v1.1.rar

Link to comment
Share on other sites

  • Administrators

Description: Creates a managed dialog box for editing " /ME " messages. It also allows you to count the typed characters, customize the color and command for sending a message.

Management: To open the control panel, press the " F9 " key. (You can remap the key in the alias to something more convenient for you).

Update:

Improved and optimized the overall functionality of the code.

Improved the style and position of the palette for selecting the color of the message.

Added graphical effects when choosing a color in the color palette.

Added a new item in the options for convenient work with the dialog box.

Dialog box icon changed.

################################################### ####################
# Name: Me Message v1.2
# Author: Epic (epicnet@mail.ru, http://epicnet.ru)
# Description: Creates a managed dialog for editing "/ME" messages.
# Management: To open the control panel, press the "F9" key.
################################################### ####################

alias F9 {
  if (!$dialog(me)) {
    unset %me_chars | me_set | .dialog -mp me me | .dialog -r me
    if (%me_color) .did -a me 4 %me_tcolors $+($chr(40),%me_color,$chr(41))
    me_select me 6 | if (%me_select) .did -c me 6 %me_select | else .did -c me 6 1
    if (%meo_check2) { .did -a me 1 %me_mess | me_calclines me 1 }
  } | else .dialog -x me
}
dialog -l me {
  title %me_title
  size -1 -1 300 235
  option pixels
  icon $mircexe,24
  edit "", 1, 10 10 280 130, multi autovs, limit 900
  text %me_tchars, 2, 30 155 39 20, nowrap
  edit "0", 3, 74 152 27 21, read rich right, limit 3
  button %me_tcolors, 4, 115 151 120 22
  button %me_tbutton_set, 5, 248 151 22 22
  combo 6, 30 191 70 20, drop
  button %me_tbutton_ok, 10, 115 190 155 23, default
}
on *:DIALOG:me:close:0: me_winclose
on *:DIALOG:me:edit:1: me_calclines $dname $did | me_winclose
on *:DIALOG:me:sclick:4: me_colors $dname | if (!$window(@MeColors)) .did -f me 1
on *:DIALOG:me:sclick:5: me_options $dname
on *:DIALOG:me:sclick:6: %me_select = $did($dname,$did).sel
on *:DIALOG:me:sclick:10:{
  me_winclose | unset %me_mess | var %q 1 | while (%q <= $did($dname,1).lines) { %me_mess = %me_mess $did($dname,1,%q).text | inc %q }
  if (%me_color) { var %me_col $+($chr(3),%me_color) }
  var %me_message $did($dname,6,0).text $+(%me_col,%me_mess)
  if (%me_chars > 0) {
    if (!%meo_check3) { if (%meo_check4) .editbox -afn %me_message | else { .editbox -an %me_message | if ($dialog(me)) .did -f me 1 } }
    if (%meo_check3) .editbox -af %me_message
    if (!%meo_check2) { .did -r $dname 1 | unset %me_chars | .did -i $dname 3 1 0 }
    if (%meo_check1) .dialog -x $dname
  }
  else { .echo -a %me_terror_notext | .did -f me 1 }
}
-------------------------------------------------- --------------------
alias -l me_set {
  %me_title = Me Message
  %me_tchars = Symbol:
  %me_tcolors = Color:
  %me_tbutton_set = 
  %me_tbutton_ok = Submit 
  %me_tselect = /me /ame /qme
  %me_terror_notext = :: Please write text 
}
alias -l me_winclose { if ($window(@MeColors)) .window -c @MeColors | if ($dialog(me_options)) .dialog -x me_options }
alias -l me_calclines { unset %me_chars | var %q 1 | while (%q <= $did($1,$2).lines) { %me_chars = $calc(%me_chars + $did($1,$2,%q).len) | inc %q } | .did -o $1 3 1 %me_chars }
alias -l me_select { var %me_q 1 | while (%me_q <= $numtok(%me_tselect,32)) { .did -a $1 $2 $gettok(%me_tselect,%me_q,32) | inc %me_q } }
alias -l me_colors {
  if (!$window(@MeColors)) {
    .window -padhik0 +beL @MeColors $calc($dialog($1).x +50) $calc($dialog($1).y +90) 207 62 | .window -a @MeColors
    .drawrect -f @MeColors 94 1 0 0 207 62
    var %me_x 7 | var %me_y 7 | var %me_q 0 | while (%me_q <= 15) {
      .drawrect -f @MeColors %me_q 1 %me_x %me_y 22 22 | .drawrect @MeColors 97 2 %me_x %me_y 22 22 | .drawrect @MeColors 93 1 %me_x %me_y 22 22
      .hadd -m mecoordcol-x %me_q $+(%me_x,-,$calc(%me_x +22)) | .hadd -m mecoordcol-y %me_q $+(%me_y,-,$calc(%me_y +22))
      inc %me_q | inc %me_x 24 | if (%me_q == 8) { var %me_x 7 | inc %me_y 24 }
    }
  }
  else .window -c @MeColors
}
menu @MeColors {
  mouse {
    var %me_mx $mouse.x | var %me_my $mouse.y
    var %me_x 7 | var %me_y 7 | var %me_q 0 | while (%me_q <= 15) {
      var %me_hx $hget(mecoordcol-x,%me_q) | var %me_hy $hget(mecoordcol-y,%me_q)
      if (!$hget(me,bl-stop) && %me_mx isnum %me_hx && %me_my isnum %me_hy) {
        .drawrect @MeColors 98 2 %me_x %me_y 22 22 | .drawrect @MeColors 66 1 %me_x %me_y 22 22 | .hadd -m me bl-stop %me_hx %me_hy | halt
      }
      if (%me_mx !isnum $gettok($hget(me,bl-stop),1,32)) || (%me_my !isnum $gettok($hget(me,bl-stop),2,32)) {
        .drawrect @MeColors 97 2 %me_x %me_y 22 22 | .drawrect @MeColors 93 1 %me_x %me_y 22 22 | if ($hget(me,bl-stop)) .hdel -sw me bl-stop
      }
      inc %me_q | inc %me_x 24 | if (%me_q == 8) { var %me_x 7 | inc %me_y 24 }
    }
  }
  sclick {
    var %me_mx $mouse.x | var %me_my $mouse.y
    var %me_q 0 | while (%me_q <= 15) {
      var %me_hx $hget(mecoordcol-x,%me_q) | var %me_hy $hget(mecoordcol-y,%me_q)
      if (%me_mx isnum %me_hx && %me_my isnum %me_hy) { if (%me_q < 10) var %me_q $+(0,%me_q) | .did -a me 4 %me_tcolors $+($chr(40),%me_q,$chr(41)) | %me_color = %me_q | .break}
      inc %me_q
    }
    .window -c @MeColors | if ($dialog(me)) .did -f me 1
  }
}
-------------------------------------------------- --------------------
alias -l me_options {
  if (!$dialog(me_options)) {
    me_options_set | .dialog -mp me_options me_options
    if (%meo_check1) .did -c me_options 1
    if (%meo_check2) .did -c me_options 2
    if (%meo_check3) .did -c me_options 3
    if (%meo_check4) .did -c me_options 4
  }
  else .dialog -x me_options
}
dialog -l me_options {
  title "Me Options"
  size -1 -1 340 110
  option pixels
  icon $mircexe,24
  check %meo_t1, 1, 15 15 320 20
  check %meo_t2, 2, 15 35 320 20
  check %meo_t3, 3, 15 55 320 20
  check %meo_t4, 4, 15 75 320 20
}
alias -l me_options_set {
  %meo_t1 = Close window after clicking "Submit"
  %meo_t2 = Save message after click "Submit"
  %meo_t3 = Move message to EditBox after clicking "Submit"
  %meo_t4 = Set focus to EditBox after submit click
}
on *:DIALOG:me_options:close:0: if ($dialog(me)) .did -f me 1
on *:DIALOG:me_options:sclick:1: if ($did($dname,$did).state == 1) %meo_check1 = 1 | else unset %meo_check1
on *:DIALOG:me_options:sclick:2: if ($did($dname,$did).state == 1) %meo_check2 = 1 | else unset %meo_check2
on *:DIALOG:me_options:sclick:3: if ($did($dname,$did).state == 1) %meo_check3 = 1 | else unset %meo_check3
on *:DIALOG:me_options:sclick:4: if ($did($dname,$did).state == 1) %meo_check4 = 1 | else unset %meo_check4

 

MeMessage_v1.2.rar

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...


×
×
  • Create New...