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.

Help!!

Old posts that have not been replied to for several years.
P
Photon
Op
Posts: 170
Joined: Wed Aug 28, 2002 8:00 am
Location: Liverpool, England

Post by Photon »

Code: Select all

if{[getuser $user XTRA AUTHYES] == 1}
would return true if you were authed...
t
typefighter

Post by typefighter »

Fantastic, so my little peice of code ..

Code: Select all

bind msg o auth authuser

proc authuser {nick host hand text} {
        set authpass [lindex $text 0]
        if {$authpass == "password"} {
                setuser $hand XTRA "AUTHYES 1"
        }
}
.. is working and actually setting an XTRA field called AUTHYES ??

Brilliant, I'm catchin on :)

Thanks :)

- type

Oh, P.S. photon ..

You did

Code: Select all

 if{[getuser $user XTRA AUTHYES] == 1} 
to check wether AUTHYES == 1 but I did ..

Code: Select all

setuser $hand XTRA "AUTHYES 1"
What's the difference between $hand and $user ? What should I be using ?
User avatar
Papillon
Owner
Posts: 724
Joined: Fri Feb 15, 2002 8:00 pm
Location: *.no

Post by Papillon »

$user is a unknown variable.. $hand is the one you want to use
Elen sila lúmenn' omentielvo
P
Photon
Op
Posts: 170
Joined: Wed Aug 28, 2002 8:00 am
Location: Liverpool, England

Post by Photon »

As above - it depends on what you called the variable in the function declaration - in your case $hand - I just called it $user because, well I felt that way inclined (and I thought it might make it more obvious) (and I didnt read your code when typing it :oops: )
t
typefighter

Post by typefighter »

Sorry if I'm getting annoying, lol... but what actually is $hand then ? Is it the actual user-name of the person that is on the bot and not the nick of the person who issued the command ? I dont understand how it knows y'see.

- type.
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

$hand is just a name. You could ahve called it anything (yes you, not eggdrop), but it would still contain the same information.

In a message command, the following arguments are passed.

nickname - the nickname of the peson sending the message
usehost - the Ident!hostname portion of the userhost
handle - the handle that this person is matched to. In eggdrop handles are the username. This is determined by the nick!user@host matching a hostmask in the hanldes/users record.
args - the text sent.

you could defind the scripts as

Code: Select all

proc msgproc {what a stupid script} {
[/script]

$what would equal the nickname
$a would equal the userhost
$stupid would be the handle
and
$script would be the arguments

This simply sets what you want to refer to the variable as.

When using these variables in a script, you need to pass the correct one at the right time.

All the commands in tcl-commands.doc tell you want is expected, and what it will return.
P
Photon
Op
Posts: 170
Joined: Wed Aug 28, 2002 8:00 am
Location: Liverpool, England

Post by Photon »

woo, you are honoured ... SEVERAL long explanations from the wuvverly ppslim... :roll:

*ahem*
t
typefighter

Post by typefighter »

Ahhhhhh riiiiiggghhhhhtttt!!!!!!!!!!!!! LOL. ok ok. It's logical but I wouldn't think of that. hehe

Thanks ppslim!! :)

Hehe photon. Yeh well, it must be somefin to do with my enthusiasm to actually learn somefin :) Tell you what, when I finally got this script working I'm going out to celebrate :) more. beer.

- type.
t
typefighter

Another question ....

Post by typefighter »

Ok, completely different from my previous problem (which was originally about something completely different) but I thought I'd just stick to one chain. hehe.

Err ... my friend now wants my bot (cuz it's starting to look pretty nifty thanks to you guys) in his channel. I have set the users' flags on the bot to global (cuz I didn't even think that it would be in more than one channel). I've now removed all global o flags and made them channel specific ...

Code: Select all

HANDLE    PASS NOTES FLAGS           LAST
alex      yes      0 jmnoptx         21:59 (#.Power   )
   #.Power            om              21:59
  HOSTS: -telnet!*@*, *!type@123.12.*, *!type@*.192.O072=
JinXy     yes      0 jmnoptx         21:44 (partyline )
  HOSTS: *!noneya@321.107.99.*
Dr\\tz`{A yes      0 jptx            17:54 (#.Power   )
   #.Power            o               never
  HOSTS: *!Death@21.4.76.*
Angelic`{ yes      0 jptx            17:02 (#.Power   )
   #.Power            o               never
  HOSTS: *!Immortal1@12.70.93.*
Anywayyyy ....

I want a script that voices the channel specific o flags (and sends them a lil message, but that's easy so I'm leaving that till last) and m flags.

This is what I have ...

Code: Select all

bind join * check:priority

proc check:priority {nick host hand chan} {
        if {[matchchanattr $hand m $chan]} {
                pushmode $chan +v $nick
                return 0
        }
        if {[matchchanattr $hand o $chan]} {
                pushmode $chan +v $nick
                return 0
        }
        return 0
}
It will make me a voice, but I'm wondering if thats because I'm a global "op", but it wont give anyone who has an "o" channel flag a voice. Any obvious reasons ? I have tried EVERYTHING.

- type
s
spock
Master
Posts: 319
Joined: Thu Dec 12, 2002 8:40 pm

Post by spock »

are you doing a 'learn tcl exercise'
or dont you know about the voice(v) autovoice(g) flags :>
photon?
t
typefighter

Post by typefighter »

Huh ?
s
spock
Master
Posts: 319
Joined: Thu Dec 12, 2002 8:40 pm

Post by spock »

ok what i meant was:

you can .chattr handle +v #chan
+ .chanset #chan +autovoice

or .chattr handle +g #chan

to have someone autovoiced.

on the other hand, you could be doing this as a sortof 'exercise'
to learn more of the tcl language.

but i dont know which.

the only place ive seen 'matchchanattr' is in an old guide for 1.1.5

in tcl-commands the following is mentioned:

matchattr <handle> <flags> [channel]
returns: "1" if the specified user has the matching flags.
(using the new matching system)

im unable to test this myself at the moment.
photon?
t
typefighter

Post by typefighter »

Yeh it's sort of an exercise. I'll have to have another look tomorrow cuz I'm tired n stuff.

Thanks,

- type
User avatar
Papillon
Owner
Posts: 724
Joined: Fri Feb 15, 2002 8:00 pm
Location: *.no

Post by Papillon »

Code: Select all

matchattr $hand o|o
this will match global and channel flags, in this case "o"
Elen sila lúmenn' omentielvo
t
typefighter

Post by typefighter »

Hi Papillon,

So this should work ?

Code: Select all

if {[matchattr $hand -|o]} { body }
- type
Locked