egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Simple Vhost 1.3 by sLiDer.

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Support & Releases
View previous topic :: View next topic  
Author Message
starpossen
Op


Joined: 10 Jan 2006
Posts: 139

PostPosted: Fri May 09, 2008 1:32 pm    Post subject: Simple Vhost 1.3 by sLiDer. Reply with quote

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

########################################################################
#                                                                      #
#  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:

[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.
Back to top
View user's profile Send private message
starpossen
Op


Joined: 10 Jan 2006
Posts: 139

PostPosted: Sat May 10, 2008 7:15 pm    Post subject: Reply with quote

I tried changing $chan to $nick but it still shows in partyline, this is really getting on my nerves.
Back to top
View user's profile Send private message
speechles
Revered One


Joined: 26 Aug 2006
Posts: 1398
Location: emerald triangle, california (coastal redwoods)

PostPosted: Sun May 11, 2008 2:21 am    Post subject: Reply with quote

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:

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. Wink

Change: set vhostnick $nick
Into : set vhostnick $chan
and change all NOTICE into PRIVMSG.
Back to top
View user's profile Send private message
starpossen
Op


Joined: 10 Jan 2006
Posts: 139

PostPosted: Sun May 11, 2008 5:36 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
speechles
Revered One


Joined: 26 Aug 2006
Posts: 1398
Location: emerald triangle, california (coastal redwoods)

PostPosted: Sun May 11, 2008 6:44 am    Post subject: Reply with quote

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. Wink
Back to top
View user's profile Send private message
starpossen
Op


Joined: 10 Jan 2006
Posts: 139

PostPosted: Sun May 11, 2008 6:51 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Support & Releases All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber