Assign / Unassign

By nathggns123 on Jan 27, 2010

This script is a series of on text events and aliases, it will make you be able to make a bot that anyone can have on their channel. This script is for one server only at the moment but will Be for multi-server soon. Once you put this in your channel please run the following commands in this order

/cc #channel (This is the channel for the bot admin)
/ca #channel (This is the channel people go to to assign your bot to their channel)
/hn (hash table name, if you dont know what this is dont run it)
/trigger (the bit that goes before each command like ! or . (if you dont run it it will be !)
/runstart

; http://3taonline.com assign/ unassign
/set %hn assign
/set %trigger !
Alias runstart {
/hmake %hn 50
}

Alias cc {
/set %cc $$1
}

Alias ca {
/set %ca $$1
}

Alias /hn {
/set %hn $$1
}

Alias trigger {
/set %trigger $$1
}

alias j2 {
  /set %x 1
  /set %y $hget(%hn,0).Item
  while (%x <= %y) {
    /join $hget(%hn,%x).Item
    inc %x
  }
  /set %x 1
}

alias add {
  /hadd -s %hn $$1 $$1
  /hsave -o %hn %hn $+ .db
}

alias del {
  /hdel -sw %hn $$1
  /hsave -o %hn %hn $+ .db
}

alias list {
  /set %x 1
  /set %y $hget(%hn,0).Item
  while (%x <= %y) {
    if ($$1 == -a) {
      //echo -a $hget(%hn,%x).Item
    } 
    else {
      /msg $$1 $hget(%hn,%x).Item
    }
    inc %x
  }
  /set %x 1
}

on *:text:*: {
if ($chan == %ca) { 
if ($1 == %hn $+ add) {
/join $2
  /msg $chan I have been sucessfullied assigned to $2
  /msg $2 I have been assigned to this channel by $nick $+ , if you dont want me here can a op please say %hn $+ unassign $+ .
  /add $2
  /j2
  /msg %cc I have been assigned to $2 $+ .
}
}
if ($1 == %hn $+ del) {
if ($nick isop $chan || $nick ishop $chan) {
/msg $chan I have been unassigned, Bye!
/part $chan
/del $chan
/msg %cc I have been unassign from $chan
} else {
/msg $chan You do not have the required privs to unassign me!
}
}

on *:start: {
/runstart
}

on *:connect: {
/j2
}
}

Comments

Sign in to comment.
Serpentsounds   -  Jan 28, 2010

Yeah, the on text event needs more parameters than you have given it (you are missing the channel).

Also, have a /set command at the beginning of the remote file won't do anything. You'd probably want to do an on load event, but even then, here this script is being copy pasted as text and probably not loaded. My suggestion to change it: at the beginning of any script that uses the variables, declare a local variable of the same name equal to the global variable if it exists, else the default value.

Example, at the beginning of a script that uses %hn:
var %hn $iif(%hn,$v1,assign)

That way, the rest of the script can remain constant.

Otherwise, there is going to have to be some mandatory manual configuration from the user.

I didn't really look at the rest, but if it works, then great.

 Respond  
Linuxuser   -  Jan 28, 2010

your on text = fail

 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.