Joining messages

By slub77 on Jan 30, 2010

Ok another part of my dialog, it is a joining message dialog :D.

The dialog will show you what they have set as there join message, delete it, or shout it out

Commands
!!joininfo
!!delinfo

menu
The menu does what the dialog does, but dialog looks better

menu * {
joining dialog:dialog $iif($dialog(test),-x,-m test) test
}

dialog test {

  title The Dialog

  size -1 -1 208 112

  option dbu
  edit , 60, 7 21 24 18, limit 50, autohs,
  button Enter, 61, 32 20 20 19,
  edit , 62, 55 21 140 18,disable. vsbar
  button Delete, 63, 55 41 140 20,
  button Change channel, 64, 7 40 45 20,
  button Change, 65, 55 61 140 20,
  button Shout out, 66, 55 81 140 20
  button Turn off, 67, 7 82 45 10, tab 6
  button Turn on, 68, 7 92 45 10, 
  edit Msg channel: $group(#joinmsg), 69, 7 60 45 20, disable.

}
on *:dialog:test:init:*:{ 
  if ($active == $chan) { set %channel $active | did -h test 63-66 }
}

on 1:DIALOG:TEST:sclick:61:{
  if $len($did(60).text) >= 1  {
    if $did(60).text !ison %channel { did -o test 62 1 That person is not in %channel | did -v test 64 }
    else {
      set %person $did(60).text
      if $readini(join.ini, Users, $address(%person,3)) { did -h test 64 | did -v test 63,65,66 | did -o test 62 1 $readini(join.ini, Users, $address(%person,3)) }
      else { did -o test 62 1 That person has not got a join message | did -v test 65 | did -h test 63,64,66
      }
    }
  }
}

on 1:DIALOG:TEST:sclick:63:remini join.ini Users $address(%person,3) | did -o test 62 1 Delete %person Join message 
on 1:DIALOG:TEST:sclick:64:set %channel $?="Enter the new channel"
on 1:DIALOG:TEST:sclick:65:writeini join.ini Users $address(%person,3) $?="Enter there new join message" | did -o test 62 1 Changed %person Join message to: $!
on 1:DIALOG:TEST:sclick:66:/msg %channel %person Join message: $readini(join.ini, Users, $address(%person,3))
on 1:DIALOG:TEST:sclick:68:/enable #join msg | did -o test 69 1 Joining is now ON 
on 1:DIALOG:TEST:sclick:67:/disable #joinmsg | did -o test 69 1 Joining is now OFF 

Joining :D

menu nicklist {
  .Joining Dialog:dialog test test
}

on *:TEXT:!!joininfo*&:#:{
  writeini join.ini Users $address($nick,3) $2-
  notice $nick Done
}

on *:TEXT:!!joindel*&:#:{
  if !$readini(join.ini, [np], Users, $address($2,3)) = $true { notice $nick $2 has not set a join message }
  else {
    remini join.ini Users $address($2,3) 
    notice $nick Done
  }
}

on *:TEXT:!!joindel:#:{
  if !$readini(join.ini, [np], Users, $address($nick,3)) = $true { notice $nick You have not set yourself a join message  }
  else {
    remini join.ini Users $address($nick,3) 
    notice $nick Done
  }
}

#joinmsg on

on *:JOIN:#:{
  if $var($+(%,join,.,$nick),0) >= 1 { halt }
  else {
    if !$readini(join.ini, [np], Users, $address($nick,3)) = $true { set -z $+(%,join,.,$nick) 400 }
    else {
      set -z $+(%,join,.,$nick) 400
    msg $chan $+($nick,:) $readini(join.ini, [np], Users, $address($nick,3)) }
  }
}

#joinmsg end

Comments

Sign in to comment.
slub77   -  Jan 31, 2010

Edited it:
This is one of my first few tries at dialogs, so i am bound to make a few rookie screw up's lol.
originally it was set to disable other id's so i had to include brackets, as the id's were no where near each other, and the id's with in that range were needed.

 Respond  
Silo   -  Jan 31, 2010
menu * {
joining dialog:/dialog -ma test test

You're missing a closing bracket. I'd think twice about assigning the * to all the popups, plus, when you're not connected you don't need to see the dialog on the popup menu..

A cleaner way to open the dialog would be to use an $iif so as you don't get "the dialog already in use error message by using:

 dialog $iif($dialog(test),-x,-m test) test 
set %channel $active 

What if the $active window was the status window?
if ($active ischan) or if ($active == $chan) can sort that out nicely. then you can use a return if the $active window isn't the #channel

When using dialog flags you can condense control id's, for example:

did -h test 63,64,65,66

Can be:

did -h test 63-66

makes it neater and you can also separate clumps with a comma like 63-66,74-82 etc

 Respond  
gooshie   -  Jan 30, 2010

The way you wrote the on join event it will create a set variable (harddrive write) for every nick that joins on any channel with each of these set variables being rewritten every second until they unset after 400 seconds. I would do something that was network and channel specific maybe like this:

on !*:JOIN:#:{
  if !$($+(%,j.,$network,#,$nick),2) && $readini(join.ini,$+($network,#),$nick) {
    msg # $+($nick,:) $v1
    inc -u999 $+(%,j.,$network,#,$nick)
  }
}
 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.