mIRC Home    About    Download    Register    News    Help

Print Thread
Page 1 of 2 1 2
Joined: Oct 2005
Posts: 126
PhyxiuS Offline OP
Vogon poet
OP Offline
Vogon poet
Joined: Oct 2005
Posts: 126
Hi, i already created a couple of scripts by myself, but none of them worked... Maybe there is someone who can help me with this stuff ! blush

What i need:

When i say: !avail or !addme , the script add's me to the topic... but then, when another member says: !avail or !addme, the script add his nick, but mine is gone... So, when members say !avail ... the nicknames have to stay in the topic.

Like:
<Bla> !avail
Topic: Avaible: [Bla,,,,]
<BooM> !avail
Topic: Avaible: [Bla,BooM,,,]
<ZieZ> !avail
Topic: Avaible: [Bla,BooM,ZieZ,,]

This is what i need ...

Thankx anyway... wink


If you mess with the best, u will die like the rest !
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Code:
on *:text:!avail:#yourchan: {
  if ($istok($remove($chan($chan).topic,44),$nick,32)) { .notice $nick You are already available. | return }
  if ($gettok($chan($chan).topic,2,58) == $null) { topic $chan Available: $nick }
  else topic $chan $chan($chan).topic $+ , $nick
}

* Change #yourchannel to whatever channel you want this for.

Note that you probably want to set a user level to this...

example:
on 100:text:!avail:#youchannel: {

Then, you set your ops (or whoever) to that level and only they could use the command.

Also, here's a unavailable script for you:

Code:
on *:text:!unavail:#yourchan: {
  if (!$istok($remove($chan($chan).topic,44),$nick,32)) { .notice $nick You are already unavailable. | return }
  topic $chan $remove($chan($chan).topic,$nick $+ $chr(44),$nick)
}


Again, you may want to use a user level for this, and change #yourchannel to whatever channel you want this for.

**EDIT** Thanks to Kelder's script below, I realized you could use $chan($chan).topic to get the topic... I had forgotten about that. So, I've edited this to use that. No need for variables now. laugh

Last edited by Riamus2; 07/10/05 02:19 PM.

Invision Support
#Invision on irc.irchighway.net
Joined: Apr 2003
Posts: 701
K
Hoopy frood
Offline
Hoopy frood
K
Joined: Apr 2003
Posts: 701
Code:
on *:TEXT:!avail*:#yourchannel:avail_topic $2 $nick
on *:INPUT:#yourchannel:if ($1 == !avail) avail_topic $2 $me
alias avail_topic {
  if ($regex($chan($chan).topic,Available: \[.*\])) {
    if ($regex($chan($chan).topic,Available: \[.*\Q $+ $1 $+ \E.*\])) {
      $iif($1 == $me,echo,msg) $chan you're already in!
      halt
    }
    else var %t, %r = $+($chr(44),$1,]), %q = $regsub($chan($chan).topic,(Available: ?\[.*)\],\1 $+ %r,%t)
  }
  else var %t = $iif($chan($chan).topic,$v1 &lt;&gt;) Available: $+([,$1,])
  topic $chan %t
}

Joined: Oct 2005
Posts: 126
PhyxiuS Offline OP
Vogon poet
OP Offline
Vogon poet
Joined: Oct 2005
Posts: 126
Ok, i tested that, but there are some problems init.

When i say: !avail - i'm added to the topic... & when another one says: !avail... his added to the topic, but then when the the second one who said !unavail his removed, & then i'm the only one on Avaible list, & then when i say: !unavail, i'm not getting removed from topic... so the last one on the avaible list can't be removed, can u fix that problem? confused

[16:13:33] <hYp`PhyX-> !avail
[16:13:34] * UP changes topic to 'Available: hYp`PhyX-,,, hYp`PhyX-, Dj`SlyteX^, hYp`PhyX-'
[16:13:40] <hYp`PhyX-> !unavail
[16:13:40] * UP changes topic to 'Available: hYp`PhyX-,,, Dj`SlyteX^,'
[16:13:49] <hYp`PhyX-> !unavail
[16:13:50] -UP- You are already unavailable.

-

So, plz can someone past me the "correct" code? !avail & !unavail ... i'm not expirienced to this sort of coding frown

Last edited by PhyxiuS; 07/10/05 02:18 PM.

If you mess with the best, u will die like the rest !
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
That should be fixed in the change I made above. laugh

The problem was all those commas in your topic. I'm not sure why you had all those. Anyhow, the update I made above should work for you.


*** I suggest erasing the topic completely and then using this script so that you're not getting conflicts caused by a topic formatted differently than the script expects.

Last edited by Riamus2; 07/10/05 02:18 PM.

Invision Support
#Invision on irc.irchighway.net
Joined: Oct 2005
Posts: 126
PhyxiuS Offline OP
Vogon poet
OP Offline
Vogon poet
Joined: Oct 2005
Posts: 126
Riamus, can u past me the correct code again? !avail & !unavail ? i'm not expirienced with this sort of coding & i even will do some things wrong by changing the code u gaved me...


If you mess with the best, u will die like the rest !
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Just erase what you put in before and then paste in what is above. The code is correct with the changes already in there.

EDIT:
Well, here it is all put together for you...

Code:
on *:text:!avail:#yourchan: {
  if ($istok($remove($chan($chan).topic,44),$nick,32)) { .notice $nick You are already available. | return }
  if ($gettok($chan($chan).topic,2,58) == $null) { topic $chan Available: $nick }
  else topic $chan $chan($chan).topic $+ , $nick
}

on *:text:!unavail:#yourchan: {
  if (!$istok($remove($chan($chan).topic,44),$nick,32)) { .notice $nick You are already unavailable. | return }
  topic $chan $remove($chan($chan).topic,$nick $+ $chr(44),$nick)
}


And, remember what I mentioned about user levels, changing #yourchan to your channel's name (in both spots), and completely erasing your topic before using this script.

Last edited by Riamus2; 07/10/05 02:27 PM.

Invision Support
#Invision on irc.irchighway.net
Joined: Oct 2005
Posts: 126
PhyxiuS Offline OP
Vogon poet
OP Offline
Vogon poet
Joined: Oct 2005
Posts: 126
Ok, thankx! I think it's working now, but look, 1 more problem, if there is someone leaving the channel, without saying !unavail, is it possible to auto remove him? ...

& when someone is using BNC, & his off... without saying !unavail ... is there a command where i can remove him with? like !remove hYp`SlyteX^ .... Cuz this is my problem:


[16:29:59] <hYp`PhyX-> !unavail
[16:29:59] * UP changes topic to 'Available: ,, Dj`SlyteX^,,,'
[16:30:01] <hYp`PhyX-> !avail
[16:30:01] * UP changes topic to 'Available: ,, Dj`SlyteX^,,,, hYp`PhyX-'

- oh... & it would be cool if u could past me a !totally reset command too ... Thankx m8... really wink

Last edited by PhyxiuS; 07/10/05 02:35 PM.

If you mess with the best, u will die like the rest !
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Ah, found the issue with the commas, so that's fixed. I also made it so you can do !unavail nick if you want to remove a specific nick yourself, and made it to remove them on quit/part.

And, I added the "!totally reset" command. You may want to change the wording of that to something easier to type (like !reset).

Finally, please don't forget to remove the topic before using this, changing all the #yourchans, and to consider using user levels.

Code:
on *:text:!avail:#yourchan: {
  if ($istok($remove($chan($chan).topic,44),$nick,32)) { .notice $nick You are already available. | return }
  if ($gettok($chan($chan).topic,2,58) == $null) { topic $chan Available: $nick }
  else topic $chan $chan($chan).topic $+ , $nick
}

on *:text:!unavail*:#yourchan: {
  if ($2 == $null) {
    if (!$istok($remove($chan($chan).topic,44),$nick,32)) { .notice $nick You already aren't available. | return }
    unavailablenick $nick $chan
  }
  else {
    if (!$istok($remove($chan($chan).topic,44),$2,32)) { .notice $nick $2 isn't marked as available. | return }
    unavailablenick $2 $chan
  }
}

on *:text:!totally reset:#yourchan: {
  topic $chan Available:
}

on *:quit:#yourchan: {
  unavailablenick $nick $chan
}

on *:part:#yourchan: {
  unavailablenick $nick $chan
}

on *:nick: {
  if (!$istok($remove($chan([color:red]#yourchan[/color]).topic,44),$nick,32)) { return }
  var %topic = $remove($chan([color:red]#yourchan[/color]).topic,$nick $+ $chr(44),$nick)
  var %topic = $iif($right(%topic,1) == $chr(44),$left(%topic,-1),%topic)
  if ($gettok(%topic,2,58) == $null) { var %topic = Available: $newnick }
  else var %topic = %topic $+ , $newnick
  topic $chan %topic
}

alias unavailablenick {
  if (!$istok($remove($chan($2).topic,44),$1,32)) { return }
  var %topic = $remove($chan($2).topic,$1 $+ $chr(44),$1)
  topic $chan $iif($right(%topic,1) == $chr(44),$left(%topic,-1),%topic)
}



***EDIT*** I added a part to change the topic if someone changes their nick. If someone is in the topic as available and they change their nick, the topic will change to show their new nick.

**EDIT AGAIN** Fixed the alias and fixed the /nick event (change the red text in the /nick event)

Last edited by Riamus2; 07/10/05 03:47 PM.

Invision Support
#Invision on irc.irchighway.net
Joined: Oct 2005
Posts: 126
PhyxiuS Offline OP
Vogon poet
OP Offline
Vogon poet
Joined: Oct 2005
Posts: 126
Ok, the !avail thingy is working nice... & the !reset thing too(not hard) ... but, the quit/part script & the (alias unavailablenick) script is wrong...+ ppl can't !unavail by themselves, is it the "alias unavailablenick" script that's wrong? or...

-------

<hYp`PhyX-> !avail
* UP changes topic to 'Available: hYp`PhyX-'
* hYp`PhyX- has left #hyp.zp
* hYp`PhyX- has joined #hyp.zp
* L sets mode: +o hYp`PhyX-
* fenriz` sets mode: +v hYp`PhyX-
<hYp`PhyX-> !unavail
<hYp`PhyX-> !unavail hYp`PhyX-
<hYp`PhyX-> !totally reset
* UP changes topic to 'Available:'
<hYp`PhyX-> !avail
* UP changes topic to 'Available: hYp`PhyX-'
<hYp`PhyX-> !unavail
<UP> !unavail hYp`PhyX-
<hYp`PhyX-> !unavail
<hYp`PhyX-> !unavail hYp`PhyX-
<hYp`PhyX-> !unavail $me
<hYp`PhyX-> !unavail hYp`PhyX-

--------------

see? frown


If you mess with the best, u will die like the rest !
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
My fault. When I switched it to an alias, I forgot to replace $chan... one second.

Ok, the script above is edited. Copy/Paste that over your current copy and it should work fine. Sorry for the confusion.

Ok, one last edit... I changed the /nick event as well since that would also not work with $chan. Just change the red text in it to your channel name. Make sure you copied it after I changed it (after there is red text visible in the script).

Last edited by Riamus2; 07/10/05 03:31 PM.

Invision Support
#Invision on irc.irchighway.net
Joined: Oct 2005
Posts: 126
PhyxiuS Offline OP
Vogon poet
OP Offline
Vogon poet
Joined: Oct 2005
Posts: 126
Hmm, it looks ok... but it don't changes topic when !unavail ... & it don't change topic when i change nick...

-----

[17:36:16] <hYp`PhyX-> !reset
[17:36:17] * UP changes topic to 'Available:'
[17:36:19] <hYp`PhyX-> !avail
[17:36:19] * UP changes topic to 'Available: hYp`PhyX-'
[17:36:22] <hYp`PhyX-> !unavail
[17:36:29] <hYp`PhyX-> !unavail hYp`PhyX-
[17:36:53] * hYp`PhyX- is now known as hYp`PhyXi-
[17:37:07] <hYp`PhyXi-> !unavail
[17:37:08] -UP- You already aren't available.

-------

[17:39:40] <hYp`PhyXi-> !reset
[17:39:41] * UP changes topic to 'Available:'
[17:39:44] <hYp`PhyXi-> !unavail
[17:39:44] -UP- You already aren't available.
[17:39:52] <hYp`PhyXi-> !avail
[17:39:52] * UP changes topic to 'Available: hYp`PhyXi-'
[17:39:54] <hYp`PhyXi-> !unavail
[17:40:03] <hYp`PhyXi-> !unavail
[17:40:05] <hYp`PhyXi-> !unavail

--------

... u know the problem? :s

Last edited by PhyxiuS; 07/10/05 03:41 PM.

If you mess with the best, u will die like the rest !
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Ok, that is fixed. I hope. Copy/Paste the entire code above and try it. laugh

Sorry for the problems. I can't connect from here, so I can't test the script out myself.

Still looking at the /nick part....

To test the /nick part...

Change the nick section to this:
Code:
on *:nick: {
  echo -a $chan(#yourchan).topic ~ $nick
  if (!$istok($remove($chan(#yourchan).topic,44),$nick,32)) { return }
  var %topic = $remove($chan(#yourchan).topic,$nick $+ $chr(44),$nick)
  var %topic = $iif($right(%topic,1) == $chr(44),$left(%topic,-1),%topic)
  if ($gettok(%topic,2,58) == $null) { var %topic = Available: $newnick }
  else var %topic = %topic $+ , $newnick
  topic $chan %topic
}

I just added the echo line if you don't want to paste the entire thing.
(Replace the #yourchans)

Then, try changing nicks and tell me what it echos.

Last edited by Riamus2; 07/10/05 03:54 PM.

Invision Support
#Invision on irc.irchighway.net
Joined: Oct 2005
Posts: 126
PhyxiuS Offline OP
Vogon poet
OP Offline
Vogon poet
Joined: Oct 2005
Posts: 126
Ok, sorry for wasting your time m8, but... :

[17:48:48] <hYp`PhyXi-> !reset
[17:48:49] * UP changes topic to 'Available:'
[17:48:57] <hYp`PhyXi-> !avail
[17:48:58] * UP changes topic to 'Available: hYp`PhyXi-'
[17:49:00] <hYp`PhyXi-> !unavail
[17:49:13] * hYp`PhyXi- is now known as hYp`PhyxX
[17:49:44] <hYp`PhyxX> !unavail
[17:49:45] -UP- You already aren't available.
[17:50:19] <hYp`PhyxX> !unavail hYp`PhyXi-
[17:50:46] <hYp`PhyxX> !unavail hYp`PhyXX
[17:50:46] -UP- hYp`PhyXX isn't marked as available.
[17:50:59] <hYp`PhyxX> !unavail
[17:50:59] -UP- You already aren't available.

--- i would check the !unavail thingy... & nick isn't changing in topic either ;\ ... If u think u writed wrong code down... This is what i got:


on *:text:!avail:#hYp.zp: {
if ($istok($remove($chan($chan).topic,44),$nick,32)) { .notice $nick You are already available. | return }
if ($gettok($chan($chan).topic,2,58) == $null) { topic $chan Available: $nick }
else topic $chan $chan($chan).topic $+ , $nick
}

on *:text:!unavail*:#hYp.zp: {
if ($2 == $null) {
if (!$istok($remove($chan($chan).topic,44),$nick,32)) { .notice $nick You already aren't available. | return }
unavailablenick $nick $chan
}
else {
if (!$istok($remove($chan($chan).topic,44),$2,32)) { .notice $nick $2 isn't marked as available. | return }
unavailablenick $2 $chan
}
}

on *:text:!reset:#hYp.zp: {
topic $chan Available:
}

on *:quit:#hYp.zp: {
unavailablenick $nick $chan
}

on *:part:#hYp.zp: {
unavailablenick $nick $chan
}

on *:nick: {
if (!$istok($remove($chan(#hYp.zp).topic,44),$nick,32)) { return }
var %topic = $remove($chan(#hYp.zp).topic,$nick $+ $chr(44),$nick)
var %topic = $iif($right(%topic,1) == $chr(44),$left(%topic,-1),%topic)
if ($gettok(%topic,2,58) == $null) { var %topic = Available: $newnick }
else var %topic = %topic $+ , $newnick
topic $chan %topic
}

alias unavailablenick {
if (!$istok($remove($chan($3).topic,44),$2,32)) { return }
var %topic = $remove($chan($3).topic,$2 $+ $chr(44),$2)
topic $chan $iif($right(%topic,1) == $chr(44),$left(%topic,-1),%topic)
}

Oh, wait sec... i'm changing Nick part, one sec.

Last edited by PhyxiuS; 07/10/05 03:56 PM.

If you mess with the best, u will die like the rest !
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Your alias isn't changed to match what is above. Change that and the !unavail should work. And, try the echo thing I mentioned to see if we can get the /nick part to work properly.


Invision Support
#Invision on irc.irchighway.net
Joined: Oct 2005
Posts: 126
PhyxiuS Offline OP
Vogon poet
OP Offline
Vogon poet
Joined: Oct 2005
Posts: 126
Ok, dude... the !unavail thingy is working great ! & when i'm leaving channel the topic is doing great ! smile Thankx for that

---

But 1 thing is not working... when ppl are avail in topic & change their nicks... Their nick wont change in topic...

Check:

on *:nick: {
echo -a $chan(#yourchan).topic ~ $nick
if (!$istok($remove($chan(#hYp.zp).topic,44),$nick,32)) { return }
var %topic = $remove($chan(#hYp.zp).topic,$nick $+ $chr(44),$nick)
var %topic = $iif($right(%topic,1) == $chr(44),$left(%topic,-1),%topic)
if ($gettok(%topic,2,58) == $null) { var %topic = Available: $newnick }
else var %topic = %topic $+ , $newnick
topic $chan %topic
}


If you mess with the best, u will die like the rest !
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Yes... I need to know the output of the echo when you change your nick while being marked as available.


Invision Support
#Invision on irc.irchighway.net
Joined: Oct 2005
Posts: 126
PhyxiuS Offline OP
Vogon poet
OP Offline
Vogon poet
Joined: Oct 2005
Posts: 126
on *:nick: {
echo -a $chan(#yourchan).topic ~ $nick
if (!$istok($remove($chan(#hYp.zp).topic,44),$nick,32)) { return }
var %topic = $remove($chan(#hYp.zp).topic,$nick $+ $chr(44),$nick)
var %topic = $iif($right(%topic,1) == $chr(44),$left(%topic,-1),%topic)
if ($gettok(%topic,2,58) == $null) { var %topic = Available: $newnick }
else var %topic = %topic $+ , $newnick
topic $chan %topic
}

-

I see what i did wrong
"echo -a $chan(#yourchan).topic ~ $nick"

forgot to change "$chan(#yourchan)"

"(#yourchan)" ... on that line, sorry wink Thankx for all !


If you mess with the best, u will die like the rest !
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
It works now when you change your nick?


Invision Support
#Invision on irc.irchighway.net
Joined: Oct 2005
Posts: 126
PhyxiuS Offline OP
Vogon poet
OP Offline
Vogon poet
Joined: Oct 2005
Posts: 126
No :| ... there still something wrong... This is what i've got now:

on *:nick: {
echo -a $chan(#hYp.zp).topic ~ $nick
if (!$istok($remove($chan(#hYp.zp).topic,44),$nick,32)) { return }
var %topic = $remove($chan(#hYp.zp).topic,$nick $+ $chr(44),$nick)
var %topic = $iif($right(%topic,1) == $chr(44),$left(%topic,-1),%topic)
if ($gettok(%topic,2,58) == $null) { var %topic = Available: $newnick }
else var %topic = %topic $+ , $newnick
topic $chan %topic
}

--
Still don't changes nick, u know the problem?
--
This is what shows up:

<hYp`PhyX-> !avail
* UP changes topic to 'Available: hYp`PhyX-'
°†° hYp`PhyX- is now known as testinggg
Available: hYp`PhyX- ~ hYp`PhyX- (this is echo line)

...

Last edited by PhyxiuS; 07/10/05 04:54 PM.

If you mess with the best, u will die like the rest !
Page 1 of 2 1 2

Link Copied to Clipboard