Hashtable Binding Script
Posted by Log1x
Friday, March 30, 2007
Description: Made by Log1x for Log1xBot
Pretty much this is a simple script that allows you to bind things and you can modify it to your needs. The trigger depends on the variable %trigger so you can change that around if you wish. It uses hashtables and saves as binds.db. If %trigger == $null it will make the trigger default @.
The commands that are included are:
binds - Shows all of the commands you have binded.
bind - Binds a command. (Also can be used to change a current bind.)
unbind - Unbinds a command.
If you need any help message Log1x @ irc.GameSurge.net. You can also join #Log1x and contact me also.
<mirc>
on *:TEXT:*:#:{
if ($hget(binds) == $null) {
hmake binds
if ($exists(binds.db) == $true) {
hload binds binds.db
}
}
if (!%trigger) { var %trigger = @ }
if ($mid($1-,1,$len(%trigger)) == %trigger) {
tokenize 32 $mid($1-,$calc($len(%trigger) + 1) $+ -)
}
else { halt }
if ($hget(binds,$1) != $null) {
.msg $chan $v1
}
if ($ulevel >= 5) {
if ($1 == bind) {
if ($3 == $null) { notice $nick Specify [command] [text] }
else {
hadd binds $2 $2 $+ : $3-
.notice $nick Binded $2 to $3-
hsave binds binds.db
}
}
}
if ($ulevel >= 5) {
if ($1 == binds) {
unset %n | unset %b | set %n 1
while (%n <= $lines(binds.db)) {
set %b %b %trigger $+ $read(binds.db,%n)
inc %n 2 }
.msg $chan Binds: %b
}
}
if ($ulevel >= 5) {
if ($1 == unbind) {
if ($2 == $null) { notice $nick Specify [command] }
else {
if ($hget(binds,$2) == $null) { Notice $nick $2 }
else {
hdel binds $2
.notice $nick Successfully unbinded $+($2,.)
hsave binds binds.db
}
}
}
}
}
Pretty much this is a simple script that allows you to bind things and you can modify it to your needs. The trigger depends on the variable %trigger so you can change that around if you wish. It uses hashtables and saves as binds.db. If %trigger == $null it will make the trigger default @.
The commands that are included are:
binds - Shows all of the commands you have binded.
bind - Binds a command. (Also can be used to change a current bind.)
unbind - Unbinds a command.
If you need any help message Log1x @ irc.GameSurge.net. You can also join #Log1x and contact me also.
<mirc>
on *:TEXT:*:#:{
if ($hget(binds) == $null) {
hmake binds
if ($exists(binds.db) == $true) {
hload binds binds.db
}
}
if (!%trigger) { var %trigger = @ }
if ($mid($1-,1,$len(%trigger)) == %trigger) {
tokenize 32 $mid($1-,$calc($len(%trigger) + 1) $+ -)
}
else { halt }
if ($hget(binds,$1) != $null) {
.msg $chan $v1
}
if ($ulevel >= 5) {
if ($1 == bind) {
if ($3 == $null) { notice $nick Specify [command] [text] }
else {
hadd binds $2 $2 $+ : $3-
.notice $nick Binded $2 to $3-
hsave binds binds.db
}
}
}
if ($ulevel >= 5) {
if ($1 == binds) {
unset %n | unset %b | set %n 1
while (%n <= $lines(binds.db)) {
set %b %b %trigger $+ $read(binds.db,%n)
inc %n 2 }
.msg $chan Binds: %b
}
}
if ($ulevel >= 5) {
if ($1 == unbind) {
if ($2 == $null) { notice $nick Specify [command] }
else {
if ($hget(binds,$2) == $null) { Notice $nick $2 }
else {
hdel binds $2
.notice $nick Successfully unbinded $+($2,.)
hsave binds binds.db
}
}
}
}
}