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.

I need someone to help me please

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
k
karolin
Voice
Posts: 8
Joined: Fri Dec 10, 2010 1:29 am

I need someone to help me please

Post by karolin »

Hi I would get this information through by API CALLS
API Documentation for vooly: http://www.voobly.com/pages/view/147/Ex ... umentation

There are two types of category:
Ladder: Random Map web: http://www.voobly.com/ladder/index/8
Ladder: Custom Scenario web: http://www.voobly.com/ladder/index/10

each category obtain the following information:
Rarting - Wins - Loss - Streak

in category: Ladder: Random Map command: !rm
For example:
player: _Daut_
image info capture: http://www.ircaoc.info/daut.jpg

in irc chan #voobly
karolin: !rm _daut_
bot: —=[ Voobly RM ]=—• player: _DauT_ rating: 2565 wins: 218 Loss: 116 Streak: 2
karolin: !rm asdasfshad
bot: —=[ Voobly RM ]=—• nick not registered
in categoy: Custom Scenario command: !cs
For example:
player: 13r1anx
image info capture: http://www.ircaoc.info/13r1anx.jpg
in irc chan #voobly

<karolin>: !cs 13r1anx
<bot> : —=[ Voobly CS ]=—• player: [b0x]13r1anx rating: 2760 wins: 1154 loss: 505 Streak: 8
I have a key by forum rules I can not publish
Last edited by karolin on Mon Dec 27, 2010 9:28 pm, edited 3 times in total.
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Next time when you post some code on a public forum take a minute and remove any private information you may have, in this case your unique ID for accessing the API of that page. This time I've replaced it with <my unique key>.

In this community we don't translate from mIRC to TCL much, so you would have slim chances to get that translated. On the other hand, having that API and saying what exactly you want to pull from there your chances will grow. :)
Once the game is over, the king and the pawn go back in the same box.
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

Karolin,
Please refrain from sending PM's solely to gain attention to your threads.
NML_375
k
karolin
Voice
Posts: 8
Joined: Fri Dec 10, 2010 1:29 am

Lo siento

Post by karolin »

Sorry someone could help me
User avatar
tomekk
Master
Posts: 255
Joined: Fri Nov 28, 2008 11:35 am
Location: Oswiecim / Poland
Contact:

Post by tomekk »

I have some old voobly script, I've made some fixes and it should work.

Script is kinda stupid and not flexible, there is no chance to add some extra scenarios without tweaking the source code, but for your purpose it should be enough.

In order to use this script you have to install 'tcllib' because this script is using 'ncgi::encode' to encode url string, and second thing - read the header info about '.chanset'

test it tiger:

Code: Select all

# Author: tomekk
# e-mail:  tomekk/@/oswiecim/./eu/./org
# home page: http://tomekk.oswiecim.eu.org/
#
# Version 0.1
#
# This file is Copyrighted under the GNU Public License.
# http://www.gnu.org/copyleft/gpl.html

# if you want to use this script on your chan, type in eggdrop console (via telnet or DCC chat)                 
# .chanset #channel_name +voobly
# and later .save   

# voobly key
set voobly_key "<key_in_here"

# !rm command reuse interval (seconds)
set rm_reuse_interval 15

# !cs command reuse interval (seconds)
set cs_reuse_interval 15

# HTTP connection timeout interval
set http_conn_timeout 10

###############################################################################################
bind pub -|- !rm proc_rm
bind pub -|- !cs proc_cs

package require http
package require ncgi

setudef flag voobly

set rm_reuse_time 1
set cs_reuse_time 1

proc net_data { link channel } {
	global http_conn_timeout

	set the_data ""
	set the_error ""

	set http_handle [http::config -useragent "simple-voobly.tcl <eggdrop script>"]

	if {![catch {set http_handle [http::geturl $link -timeout [expr {$http_conn_timeout * 1000}]]}]} {
		switch -- [http::status $http_handle] {
			"timeout" {
				set the_error "connection timeout"
			}
														                        "error" {
				set the_error [http::error $http_handle]
			}
														                        "ok" {
				switch -glob [http::ncode $http_handle] {
					200 {
						set the_data [http::data $http_handle]
					}

					default {
						set the_error [http::ncode $http_handle]
					}
				}
			}
		}
		http::cleanup $http_handle
	} {
		set the_error "connection failed"
	}

	if {$the_error != ""} {
		putquick "PRIVMSG $channel :$the_error"
	}

	return $the_data
}

proc show_stats { player_chan player_nick player_scenario player_info } {
	global voobly_key rm_reuse_time cs_reuse_time

	set url_player_nick [::ncgi::encode $player_nick]

	set user_id_data [net_data "http://www.voobly.com/api/finduser/$url_player_nick?key=$voobly_key" $player_chan]

	if {[string trim $user_id_data] != ""} {
		set user_id [lindex [split [lindex [split $user_id_data "\n"] 1] ","] 0]

		if {[regexp {^([0-9]+)$} $user_id]} {
			set user_stats_data [net_data "http://www.voobly.com/api/ladder/$player_scenario?key=$voobly_key&uid=$user_id" $player_chan]

			if {[string trim $user_stats_data] != ""} {
				set user_stats [split [lindex [split $user_stats_data "\n"] 1] ","]
				set user_rating [lindex $user_stats 3]
				set user_wins [lindex $user_stats 4]
				set user_loss [lindex $user_stats 5]
				set user_streak [lindex $user_stats 6]

				putquick "PRIVMSG $player_chan :—=\[ Voobly $player_info \]=—• player: $player_nick rating: $user_rating wins: $user_wins loss: $user_loss streak: $user_streak"

				if {$player_scenario == "8"} {
					set rm_reuse_time [clock seconds]
				} elseif {$player_scenario == "10"} {
					set cs_reuse_time [clock seconds]
				}
			} { 
				putquick "PRIVMSG $player_chan :—=\[ Voobly $player_info \]=—• nick $player_nick not found"
			}
		} {
			putquick "PRIVMSG $player_chan :—=\[ Voobly \]=—• nick $player_nick is not registered"
		}
	}
}

proc proc_rm { nick uhost hand chan arg } {
	global rm_reuse_time rm_reuse_interval

	if {![channel get $chan voobly]} {
		return
	}

	if {[expr [clock seconds] - $rm_reuse_time] >= $rm_reuse_interval} {
		set user_nick [string trim $arg]

		if {$user_nick != ""} {
			show_stats $chan $user_nick "8" "RM"
		} {
			putquick "PRIVMSG $chan :use: !rm <nick>"
		}
	} {
		putquick "PRIVMSG $chan :to fast dude - try again later..."
	}
}

proc proc_cs { nick uhost hand chan arg } {
	global cs_reuse_time cs_reuse_interval

	if {![channel get $chan voobly]} {
		return
	}

	if {[expr [clock seconds] - $cs_reuse_time] >= $cs_reuse_interval} {
		set user_nick [string trim $arg]

		if {$user_nick != ""} {
			show_stats $chan $user_nick "10" "CS"
		} {
			putquick "PRIVMSG $chan :use: !cs <nick>"
		}
	} {
		putquick "PRIVMSG $chan :to fast dude - try again later..."
	}
}

putlog "simple-voobly.tcl ver 0.1 by tomekk loaded"
00:04 <@tomekk> !rm _Daut_
00:04 < botty> —=[ Voobly RM ]=—• player: _Daut_ rating: 2565 wins: 218 loss: 116 streak: 2
00:04 <@tomekk> !cs [Eot_]Zanchy
00:04 < botty> —=[ Voobly CS ]=—• player: [Eot_]Zanchy rating: 1649 wins: 232 loss: 258 streak: 2
00:04 <@tomekk> !rm _Daut_asd
00:05 < botty> —=[ Voobly ]=—• nick _Daut_asd is not registered
00:05 <@tomekk> !cs _Daut_
00:05 < botty> —=[ Voobly CS ]=—• nick _Daut_ not found
Last edited by tomekk on Sat Jan 08, 2011 12:51 pm, edited 1 time in total.
k
karolin
Voice
Posts: 8
Joined: Fri Dec 10, 2010 1:29 am

as installed ncgi in one shell?

Post by karolin »

as installed ncgi in one shell?
User avatar
tomekk
Master
Posts: 255
Joined: Fri Nov 28, 2008 11:35 am
Location: Oswiecim / Poland
Contact:

Post by tomekk »

ncgi is a TCL module which is a part of TCLLIB,
install just TCLLIB on your system
k
karolin
Voice
Posts: 8
Joined: Fri Dec 10, 2010 1:29 am

thanks

Post by karolin »

Thanks tomekk for creating this wonderful script thanks again.

I have not tested yet, due to not knowing how to install if there is a manual to install in a shell linux
k
karolin
Voice
Posts: 8
Joined: Fri Dec 10, 2010 1:29 am

I had happy

Post by karolin »

I had happy.
I was happy until I received this message

friends no other way without installing tcllib please

Re: install tcllib please‏

Para karolin
Enviado: viernes, 07 de enero de 2011 10:37:01 a.m.
Para: karolin
Not allowed, sorry.

--
Regards, shells Admin
User avatar
tomekk
Master
Posts: 255
Joined: Fri Nov 28, 2008 11:35 am
Location: Oswiecim / Poland
Contact:

Post by tomekk »

scared 'admin', anyway....

Code: Select all

# Author: tomekk
# e-mail:  tomekk/@/oswiecim/./eu/./org
# home page: http://tomekk.oswiecim.eu.org/
#
# Version 0.1
#
# This file is Copyrighted under the GNU Public License.
# http://www.gnu.org/copyleft/gpl.html

# if you want to use this script on your chan, type in eggdrop console (via telnet or DCC chat)                 
# .chanset #channel_name +voobly
# and later .save   

# voobly key
set voobly_key "your_key"

# !rm command reuse interval (seconds)
set rm_reuse_interval 15

# !cs command reuse interval (seconds)
set cs_reuse_interval 15

# HTTP connection timeout interval
set http_conn_timeout 10

###############################################################################################
bind pub -|- !rm proc_rm
bind pub -|- !cs proc_cs

package require http

setudef flag voobly

set rm_reuse_time 1
set cs_reuse_time 1

# borrowed from ncgi.tcl
proc encode { string } {
	for {set i 1} {$i <= 256} {incr i} {                                                              
		set c [format %c $i]                                                            
		
		if {![string match \[a-zA-Z0-9\] $c]} {                                                      
			set map($c) %[format %.2X $i]
		}

		# These are handled specially 
		array set map {                     
			" " +   \n %0D%0A
		}
	}

	# 1 leave alphanumerics characters alone
	# 2 Convert every other character to an array lookup                                        
	# 3 Escape constructs that are "special" to the tcl parser                               
	# 4 "subst" the result, doing all the array substitutions
		
	regsub -all -- \[^a-zA-Z0-9\] $string {$map(&)} string
	# This quotes cases like $map([) or $map($) => $map(\[) ...
	regsub -all -- {[][{})\\]\)} $string {\\&} string                                          
	return [subst -nocommand $string]
}
#######################

proc net_data { link channel } {
	global http_conn_timeout

	set the_data ""
	set the_error ""

	set http_handle [http::config -useragent "simple-voobly.tcl <eggdrop script>"]

	if {![catch {set http_handle [http::geturl $link -timeout [expr {$http_conn_timeout * 1000}]]}]} {
		switch -- [http::status $http_handle] {
			"timeout" {
				set the_error "connection timeout"
			}
														                        "error" {
				set the_error [http::error $http_handle]
			}
														                        "ok" {
				switch -glob [http::ncode $http_handle] {
					200 {
						set the_data [http::data $http_handle]
					}

					default {
						set the_error [http::ncode $http_handle]
					}
				}
			}
		}
		http::cleanup $http_handle
	} {
		set the_error "connection failed"
	}

	if {$the_error != ""} {
		putquick "PRIVMSG $channel :$the_error"
	}

	return $the_data
}

proc show_stats { player_chan player_nick player_scenario player_info } {
	global voobly_key rm_reuse_time cs_reuse_time

	set url_player_nick [encode $player_nick]

	set user_id_data [net_data "http://www.voobly.com/api/finduser/$url_player_nick?key=$voobly_key" $player_chan]

	if {[string trim $user_id_data] != ""} {
		set user_id [lindex [split [lindex [split $user_id_data "\n"] 1] ","] 0]

		if {[regexp {^([0-9]+)$} $user_id]} {
			set user_stats_data [net_data "http://www.voobly.com/api/ladder/$player_scenario?key=$voobly_key&uid=$user_id" $player_chan]

			if {[string trim $user_stats_data] != ""} {
				set user_stats [split [lindex [split $user_stats_data "\n"] 1] ","]
				set user_rating [lindex $user_stats 3]
				set user_wins [lindex $user_stats 4]
				set user_loss [lindex $user_stats 5]
				set user_streak [lindex $user_stats 6]

				putquick "PRIVMSG $player_chan :â&#128;&#148;=\[ Voobly $player_info \]=â&#128;&#148;â&#128;˘ player: $player_nick rating: $user_rating wins: $user_wins loss: $user_loss streak: $user_streak"

				if {$player_scenario == "8"} {
					set rm_reuse_time [clock seconds]
				} elseif {$player_scenario == "10"} {
					set cs_reuse_time [clock seconds]
				}
			} { 
				putquick "PRIVMSG $player_chan :â&#128;&#148;=\[ Voobly $player_info \]=â&#128;&#148;â&#128;˘ nick $player_nick not found"
			}
		} {
			putquick "PRIVMSG $player_chan :â&#128;&#148;=\[ Voobly \]=â&#128;&#148;â&#128;˘ nick $player_nick is not registered"
		}
	}
}

proc proc_rm { nick uhost hand chan arg } {
	global rm_reuse_time rm_reuse_interval

	if {![channel get $chan voobly]} {
		return
	}

	if {[expr [clock seconds] - $rm_reuse_time] >= $rm_reuse_interval} {
		set user_nick [string trim $arg]

		if {$user_nick != ""} {
			show_stats $chan $user_nick "8" "RM"
		} {
			putquick "PRIVMSG $chan :use: !rm <nick>"
		}
	} {
		putquick "PRIVMSG $chan :to fast dude - try again later..."
	}
}

proc proc_cs { nick uhost hand chan arg } {
	global cs_reuse_time cs_reuse_interval

	if {![channel get $chan voobly]} {
		return
	}

	if {[expr [clock seconds] - $cs_reuse_time] >= $cs_reuse_interval} {
		set user_nick [string trim $arg]

		if {$user_nick != ""} {
			show_stats $chan $user_nick "10" "CS"
		} {
			putquick "PRIVMSG $chan :use: !cs <nick>"
		}
	} {
		putquick "PRIVMSG $chan :to fast dude - try again later..."
	}
}

putlog "simple-voobly.tcl ver 0.1 by tomekk loaded"
k
karolin
Voice
Posts: 8
Joined: Fri Dec 10, 2010 1:29 am

thank you very much friend

Post by karolin »

thank you very much friend
I am happy thanks again
Post Reply