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 

I need someone to help me please

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
karolin
Voice


Joined: 10 Dec 2010
Posts: 8

PostPosted: Mon Dec 27, 2010 2:22 am    Post subject: I need someone to help me please Reply with quote

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

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

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

Quote:
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
Back to top
View user's profile Send private message
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3741
Location: Mint Factory

PostPosted: Mon Dec 27, 2010 5:17 am    Post subject: Reply with quote

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. Smile
_________________
Once the game is over, the king and the pawn go back in the same box.
Back to top
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Mon Jan 03, 2011 4:26 pm    Post subject: Reply with quote

Karolin,
Please refrain from sending PM's solely to gain attention to your threads.
_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
karolin
Voice


Joined: 10 Dec 2010
Posts: 8

PostPosted: Mon Jan 03, 2011 8:33 pm    Post subject: Lo siento Reply with quote

Sorry someone could help me
Back to top
View user's profile Send private message
tomekk
Master


Joined: 28 Nov 2008
Posts: 255
Location: Oswiecim / Poland

PostPosted: Thu Jan 06, 2011 7:07 pm    Post subject: Reply with quote

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


Quote:
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
Back to top
View user's profile Send private message Visit poster's website
karolin
Voice


Joined: 10 Dec 2010
Posts: 8

PostPosted: Thu Jan 06, 2011 10:30 pm    Post subject: as installed ncgi in one shell? Reply with quote

as installed ncgi in one shell?
Back to top
View user's profile Send private message
tomekk
Master


Joined: 28 Nov 2008
Posts: 255
Location: Oswiecim / Poland

PostPosted: Fri Jan 07, 2011 6:36 am    Post subject: Reply with quote

ncgi is a TCL module which is a part of TCLLIB,
install just TCLLIB on your system
Back to top
View user's profile Send private message Visit poster's website
karolin
Voice


Joined: 10 Dec 2010
Posts: 8

PostPosted: Fri Jan 07, 2011 10:18 am    Post subject: thanks Reply with quote

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
Back to top
View user's profile Send private message
karolin
Voice


Joined: 10 Dec 2010
Posts: 8

PostPosted: Fri Jan 07, 2011 11:53 am    Post subject: I had happy Reply with quote

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

friends no other way without installing tcllib please


Quote:
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
Back to top
View user's profile Send private message
tomekk
Master


Joined: 28 Nov 2008
Posts: 255
Location: Oswiecim / Poland

PostPosted: Sat Jan 08, 2011 6:15 am    Post subject: Reply with quote

scared 'admin', anyway....

Code:
# 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 :—=\[ 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"
Back to top
View user's profile Send private message Visit poster's website
karolin
Voice


Joined: 10 Dec 2010
Posts: 8

PostPosted: Sat Jan 08, 2011 3:43 pm    Post subject: thank you very much friend Reply with quote

thank you very much friend
I am happy 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 Requests 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