Define system

By Areeb on Sep 29, 2014

DescriptionThis is my first ever script that I'm posting on hawkee, also I'm a newbie in mIRC scripting so I hope you like it,

Define System:
System that saves definitions for different nicks / objects etc.
Features:
!setdefine <object/nick>
!define <object/nick>
!editdefine <object/nick> -------------------------> To edit a definition
!deldefine <object/nick> -----------------------------------> To delete a definition

The !deldefine and !editdefine are conditional, i.e you can replace "CHANGE_ME" with your nick to redirect access of the cmds.

;Define script by Areeb
on *:text:!dhelp:#: { /msg $chan Define system cmds: } { /msg $chan 12!setdefine <object/nick> <definition>, !define <object/nick> }
on *:text:!setdefine *:#: {
  if (%define. [ $+ [ $2 ] ] = $null) {
    set %define. $+ $2 $3- [Define by: $nick $+ ]
  /msg $chan 12Define for $2 was saved! }
  else { 
  /msg $chan 4Error:1 $2 is already defined }
}
on *:text:!editdefine *:#: { 
  if ($nick = CHANGEME) {
    set %define. $+ $2 $3- [Edited by: $nick $+ ]
  /msg $chan 12New define for $2 was saved! }
  else { 
  /msg $chan 4Error:1 You're not authorised to perform this action. }
}
on *:text:!deldefine *:#: { 
  if ($nick = CHANGEME) {
    set %define. $+ $2 $null
  /msg $chan 12Define for $2 was deleted. }
  else { 
  /msg $chan 4Error: 1You're not authorised to perform this action. }
}
on *:text:!define *:#:{
  var %define = %define. [ $+ [ $2 ] ]
  if (%define != $null) {
    msg $chan 4 $2 $+ :1 %define $+ .
  }
  else {
    msg $chan 12 $2 doesn't have a define set yet. !setdefine $2 <definition> to set a define for $2 $+ .
  }
}

Comments

Sign in to comment.
dma   -  Jan 06, 2016

i get strange answers ... like it wants me to a define a thing like NEW YORK

 Respond  
Herc08   -  Sep 29, 2014

Couple things to point out. In the first on text event, you have two sets of commands in different brackets ({ }). Also instead of all of those event, combine those in one. Using if/elseif statements. Also, there is no need for a slash in the msg part. I know I am nitpicking, but it's just me. I know that this is your first one, but it isn't that bad. Probably the last part I would recommend is either storing them in a hash table or INI file, because with that, you can identify which term is valid, with the use of evaluation brackets.

Areeb  -  Sep 30, 2014

Thanks for the feedback, will improve my scripts accordingly :).

Sign in to comment

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.