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.

Returning a variable from another process (Qnet auth system)

Old posts that have not been replied to for several years.
Locked
User avatar
Aron
Halfop
Posts: 86
Joined: Sat Mar 15, 2003 8:35 am

Returning a variable from another process (Qnet auth system)

Post by Aron »

I am working on a system to recognize people by their Q (Quakenet's bot) auth name.
It is returned in RAW 330.

Further explanation is in the script.

Code: Select all

# The idea is to be able to include this in other scripts like this:
#
# if {[returnauth nickname]} { blablablabla }
#
# The problem is that the returnauth process ends at the moment the whois 
# starts.
# I already tried using return $q_auth behind the whois, but that doesn't work # (obviously)
# Any ideas?
#
# Thanks in advance.


# this is just a temporarily testbind...
bind pub n !testauth checkauth
proc checkauth {nick host hand chan arg} {
 putserv "WHOIS [lindex [split $arg] 0]"
}

proc returnauth { } {
 global q_auth
 putserv "PRIVMSG #pieisyummy :$q_auth"
 return $q_auth
}

bind raw - 330 raw:getauth
proc raw:getauth {from key arg} {
 global q_auth
 set q_auth [lindex [split $arg] 2]
 returnauth
}
The best way to start learning is to start helping.
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

Indeed, you have spotted the pitfalls.

This is because eggdrop only processes one command at a time. It is not possible to read ahead of itself.

What you will need is some form of a callback system. Callback is the process or sending a command that can't complete right away on the spot, at this point, your eggdrop can go about its thing. The funny thing is, it can take one second to one year, and the process will work.

Once the information is available, a new script is called on which a reaction takes place.

Think of the RAW bind as a callback. You send the WHOIS to the server, and then later on the RAW is called once the information is available.
User avatar
Aron
Halfop
Posts: 86
Joined: Sat Mar 15, 2003 8:35 am

Post by Aron »

That sounds all good, but I don't have a CLUE how to set up a basic script which would do that :)
The best way to start learning is to start helping.
Locked