This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Simple Vhost 1.3 by sLiDer.

Support & discussion of released scripts, and announcements of new releases.
Post Reply
s
starpossen
Op
Posts: 139
Joined: Tue Jan 10, 2006 1:08 am

Simple Vhost 1.3 by sLiDer.

Post by starpossen »

This is the final script I found to add to my bot, and then it should be exactly to my liking, the script:

Code: Select all

########################################################################
#                                                                      #
#  Simple Vhost 1.3 by sLiDer.                                         #
#                                                                      #
#  Just like any other script... load it up... set the channel to      #
#  what ever channel you want to use the script in                     # 
#  .chanset #chan +vhchan. Make sure and set a ircopnick and pass      # 
#  and change <ircopnick> <pass>. Pretty Simple eh? Best used with     # 
#  Anope Services but can easily be converted to use with others.      #
#  Enjoy :P                                                            #
#                                                                      #
########################################################################

setudef flag vhchan

bind pub - !setvhost pub:vhost
bind notc - * msg:vhchan
bind evnt - init-server oper:connect

proc oper:connect init-server {
 putserv "OPER ****** ******"
}
proc pub:vhost {nick host hand chan text} {
 if {![channel get $chan vhchan]} {return}
	set vhost [lindex $text 0]
      if {($vhost == "")} {putserv "PRIVMSG $chan :$nick Please specify a hostname you would like... Try again!"; return}
	 if {($vhost != "")} {
    putserv "PRIVMSG hostserv :set $nick $vhost"
   }
}
proc msg:vhchan {nick uhost hand text chan} {
  if {[string match -nocase "HostServ" $nick]} {
   set line [lrange [split $text] 0 end]
    putserv "PRIVMSG $chan :[join $line]"
    if {([string match -nocase "*A vhost must*" $line])} {putserv "PRIVMSG $chan :Please use proper format. \(!setvhost ident@vhost.com\)"; return}
     putserv "PRIVMSG $chan :To Activate your vhost type /msg hostserv on"
     putserv "PRIVMSG $chan :Please part the channel. Thanks."
   }
}
putlog "Simple Vhost 1.3 loaded by sLiDer"
I added my bot as a service admin, and access working and all

I join the channel where I activated the script, I use the commands,
<user> !setvhost testing.vhost

And that's it, no msg in the channel, but in partyline I get this:

Code: Select all

[19:25:36] <bot> [19:25] -HostServ (services@localhost.net)- vhost for user set to testing.vhost.
[19:25:37] <bot> [19:25] [bot!bot@bot.of.bot] vhost for user set to testing.vhost.
[19:25:38] <bot> [19:25] [bot!bot@bot.of.bot] To Activate your vhost type /msg hostserv on
[19:25:39] <bot> [19:25] [bot!bot@bot.of.bot] Please part the channel. Thanks.
And without me being a super scripter, I would say that the output should go in the channel and not in partyline, would anyone be so kind and help me with this, this is the last script I need fixed for my bot to be as I wanted.

Ps. I searched for the author name in the forum, and did not get any results, also as you can see, there are no other contact forms.
s
starpossen
Op
Posts: 139
Joined: Tue Jan 10, 2006 1:08 am

Post by starpossen »

I tried changing $chan to $nick but it still shows in partyline, this is really getting on my nerves.
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Post by speechles »

starpossen wrote:I tried changing $chan to $nick but it still shows in partyline, this is really getting on my nerves.
It's because you are using a notice bind during the second procedure. Hostserv will message your bot, and chan will in effect become the botnick and it will display in partyline because the bot is messaging itself. That script is flawed. Use the code below and it should solve that problem.

Code: Select all

setudef flag vhchan

bind pub - !setvhost pub:vhost
bind notc - * notc:vhchan
bind evnt - init-server oper:connect

proc oper:connect init-server {
 putserv "OPER ****** ******"
} 

proc pub:vhost {nick host hand chan text} {
  global vhostnick
  if {![channel get $chan vhchan]} {return}
  set vhost [lindex [split $text] 0]
  if {$vhost == ""} {
    putserv "PRIVMSG $chan :$nick Please specify a hostname you would like... Try again!"
    return
  } else {
    putserv "PRIVMSG hostserv :set $nick $vhost"
    set vhostnick $nick
  }
}
proc notc:vhchan {nick uhost hand text {dest ""}} {
  if {$dest == ""} {set dest $::botnick}
  global vhostnick
  if {[string match -nocase "HostServ" $nick] && [string match $::botnick $dest] && $vhostnick != ""} {
    putserv "NOTICE $vhostnick :$text"
    if {[string match -nocase "*A vhost must*" $text]} {
      putserv "NOTICE $vhostnick :Please use proper format. \(!setvhost ident@vhost.com\)"
      return
    }
    putserv "NOTICE $vhostnick :To Activate your vhost type /msg hostserv on"
    putserv "NOTICE $vhostnick :Please part the channel. Thanks."
    set vhostnick ""
  }
}
putlog "Simple Vhost 1.3 loaded by sLiDer (modified egghelp version)" 
If you wish to have it private message the channel, instead of simply noticing the user wishing the vhost, follow the steps below. ;)

Change: set vhostnick $nick
Into : set vhostnick $chan
and change all NOTICE into PRIVMSG.
s
starpossen
Op
Posts: 139
Joined: Tue Jan 10, 2006 1:08 am

Post by starpossen »

Thank you very much, this sorted everything, and also thanks for privare message steps you added, this really helped me alot, I also tried comparing the two scripts, to try to understand things a bit more, and slowly im learning.
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Post by speechles »

starpossen wrote:Thank you very much, this sorted everything, and also thanks for privare message steps you added, this really helped me alot, I also tried comparing the two scripts, to try to understand things a bit more, and slowly im learning.
The global variable, vhostnick, is what was needed in this case. It can carry over variable associations. When a user triggers the vhost procedure, it invokes a hostserv reply by asking it to vhost the nickname with the given vhost. Now when the notice comes in, the bot will only receive who sent the notice (hostserv), where the notice was sent (the bot), and basically the contents of the notice. What is missing here is the channel/nickname of the user originally triggering the vhost procedure (which is why that script was flawed). That's exactly the purpose of vhostnick to fix said flaw. Also incorporated additional statements onto the if handler within the notice procedure so that clashes with other hostserv scripts would be minimized. Hope this helps explain how it all works. ;)
s
starpossen
Op
Posts: 139
Joined: Tue Jan 10, 2006 1:08 am

Post by starpossen »

Indeed it helps, anf ofcourse I read the docs from time to time (mayb eI should read them a bit more) but not everything is explained just as well, but at the end of the day, it all makes sense in one way otr another, I just have to quit reading when im tired hehe, anyways, thanks again.
Post Reply