New Eggdrop-TCL Script please!!!!

I´m searching the hole internet for a good Whatpulse-TCL-Script,
but they all broken.

Can somebody please code a new one :confused: :smile:

I’m the only one that codes TCL around here, and I’ve just not had time to do it. ETA on when it’ll be done? Never know.

~Century0

Ok i tried it myself but i got an error can you take a look @ its a very simple tcl.

It only reads from the users profile page

[CODE]

		<dt>User:</dt>
		<dd>VirusZero</dd>
		<dt>Keys:</dt>
		<dd>2,929</dd>
		<dt>Clicks:</dt>
		<dd>1,047</dd>

		<dt>Miles:</dt>
		<dd>0.10</dd>
	</dl>[/CODE]

Here is my Script

[CODE]bind pub -|- !pulse whatpulse

package require http

proc whatpulse { nick uhost handle chan text } {
global whatpulse

set connection [http::config -useragent “Mozilla 4.0”]
catch {set connection [http::geturl http://whatpulse.org/stats/users/$text -timeout 3000]} error

set data [http::data $connection]
http::cleanup $connection

regexp – {^.?

(.?)
(.?)
(.?)
(.?)
(.?)
(.?)
(.?)
(.*?)
} $data → tabelle1

putquick “PRIVMSG $chan :$tabelle1”

}[/CODE]

The TCL error is

Tcl error [whatpulse]: can't read "tabelle1": no such variable

please fix it ^^

edit : fixed it myself

laterz i post the hole script now it reads from the api

Here is my Script its very very simple but it runs

Syntax: !pulse USERID

[CODE]bind pub -|- !pulse whatpulse

package require http

proc whatpulse { nick uhost handle chan text } {
global whatpulse

set connection [http::config -useragent “Mozilla 4.0”]
catch {set connection [http::geturl http://whatpulse.org/api/user.php?UserID=$text -timeout 3000]} error

set data [http::data $connection]
http::cleanup $connection

regexp – {^.?(.?)} $data → tabelle1

regexp – {^.?(.?)} $tabelle1 → post1

regexp – {^.?(.?)} $tabelle1 → post2

regexp – {^.?(.?)} $tabelle1 → post3

regexp – {^.?(.?)} $tabelle1 → post4

regexp – {^.?(.?)} $tabelle1 → post5

regexp – {^.?(.?)} $tabelle1 → post6

regexp – {^.?(.?)} $tabelle1 → post7

regexp – {^.?(.?)} $tabelle1 → post8

regexp – {^.?(.?)} $tabelle1 → post9

regexp – {^.?(.?)} $tabelle1 → post10

regexp – {^.?(.?)} $tabelle1 → post11

regexp – {^.?(.?)} $tabelle1 → post12

regexp – {^.?(.?)} $tabelle1 → post13

putquick “PRIVMSG $chan : AccountName: $post1”
putquick “PRIVMSG $chan : Country: $post2”
putquick “PRIVMSG $chan : DateJoined: $post3”
putquick “PRIVMSG $chan : TotalKeyCount: $post4”
putquick “PRIVMSG $chan : TotalMouseClicks: $post5”
putquick “PRIVMSG $chan : TotalMiles: $post6”
putquick “PRIVMSG $chan : Rank: $post7”
putquick “PRIVMSG $chan : TeamName: $post8”
putquick “PRIVMSG $chan : TeamMembers: $post9”
putquick “PRIVMSG $chan : TeamKeys: $post10”
putquick “PRIVMSG $chan : TeamClicks: $post11”
putquick “PRIVMSG $chan : TeamMiles: $post12”
putquick “PRIVMSG $chan : TeamRank: $post13”

}

putlog “Whatpulse.by.Viruszero”[/CODE]

please change the xx from http::geturl because i´m not allowed to post url befor i have 15 posts ^^

I think I got the link fixed - let me know if I messed it up.

~ X

P.S: Sadly, I don’t know anything about TCL script, so I can’t be of much help here.

[quote=X-Kal]I think I got the link fixed - let me know if I messed it up.

~ X

P.S: Sadly, I don’t know anything about TCL script, so I can’t be of much help here.[/quote]

Looks fine to me. His script is fine, granted it’s very spammy. I may go and code a more customizable one later.

~Century0

I have a littel Update

Now u can search for Teams or put the TeamID in the Script.

[CODE]TeamID=$text or TeamID=ID

catch {set connection [http::geturl hxxp://whatpulse.org/api/team.php?TeamID=$text -timeout 3000]} error

[/CODE]

[CODE]bind pub -|- !upulse upulse
bind pub -|- !tpulse tpulse

package require http

proc upulse { nick uhost handle chan text } {
global upulse

if {$text == “”} {
putserv “PRIVMSG $chan :$nick - Syntax is !upulse UserID”
return 0
}

set connection [http::config -useragent “Mozilla 4.0”]
catch {set connection [http::geturl hxxp://whatpulse.org/api/user.php?UserID=$text -timeout 3000]} error

set data [http::data $connection]
http::cleanup $connection

regexp – {^.?(.?)} $data → tabelle1

regexp – {^.?(.?)} $tabelle1 → post1
regexp – {^.?(.?)} $tabelle1 → post2
regexp – {^.?(.?)} $tabelle1 → post3
regexp – {^.?(.?)} $tabelle1 → post4
regexp – {^.?(.?)} $tabelle1 → post5
regexp – {^.?(.?)} $tabelle1 → post6
regexp – {^.?(.?)} $tabelle1 → post7
regexp – {^.?(.?)} $tabelle1 → post8
regexp – {^.?(.?)} $tabelle1 → post9

putnow “PRIVMSG $chan : AccountName: $post1”
putnow “PRIVMSG $chan : DateJoined: $post2”
putnow “PRIVMSG $chan : TotalKeyCount: $post3”
putnow “PRIVMSG $chan : TotalMouseClicks: $post4”
putnow “PRIVMSG $chan : TotalMiles: $post5”
putnow “PRIVMSG $chan : TotalRank: $post6”
putnow “PRIVMSG $chan : RankInTeam: $post7”
putnow “PRIVMSG $chan : LastPulse: $post8”
putnow “PRIVMSG $chan : TotalPulses: $post9”

}

proc tpulse { nick uhost handle chan text} {
global tpulse

set connection [http::config -useragent “Mozilla 4.0”]
catch {set connection [http::geturl hxxp://whatpulse.org/api/team.php?TeamID=$text -timeout 3000]} error

set data [http::data $connection]
http::cleanup $connection

regexp – {^.?(.?)} $data → haupt1
regexp – {^.?(.?)} $haupt1 → stats

regexp – {^.?(.?)} $stats → link1
regexp – {^.?(.?)} $stats → link2
regexp – {^.?(.?)} $stats → link3
regexp – {^.?(.?)} $stats → link4
regexp – {^.?(.?)} $stats → link5
regexp – {^.?(.?)} $stats → link6
regexp – {^.?(.?)} $stats → link7
regexp – {^.?(.?)} $stats → link8

putnow “PRIVMSG $chan : TeamName: $link1”
putnow “PRIVMSG $chan : TeamDescription: $link2”
putnow “PRIVMSG $chan : TeamMembers: $link3”
putnow “PRIVMSG $chan : TeamKeys: $link4”
putnow “PRIVMSG $chan : TeamClicks: $link5”
putnow “PRIVMSG $chan : TeamMiles: $link6”
putnow “PRIVMSG $chan : TeamRank: $link7”
putnow “PRIVMSG $chan : TeamDateFormed: $link8”
}

putlog “7Whatpulse.by.VirusZero”
[/CODE]

I use my own Script for getting Data from whatpulse.

[CODE]package require http
bind pub - ?whatpulse L:whatpulse
proc L:whatpulse {nick host hand chan arg} {
set connection [http::config -useragent “Mozilla 4.0”]
catch {set connection [http::geturl XXXX://whatpulse.org/stats/users/[lindex $arg 0]/ -timeout 3000]} error
set wpdata [http::data $connection]
http::cleanup $connection

regexp {(?i)has been a participant since(.*?)users to WhatPulse.} $wpdata -> wp(readout)
regexp {(?i)This user is in team(.*?)in that team.} $wpdata -> wp(readteam)
if {[info exists wp(readteam)]} { regexp {(?i)target="_blank" rel="nofollow">(.*?)</a>} $wp(readteam) -> wp(team); set wp(teamrank) [lindex $wp(readteam) 7] }

Design Variables for Channel-Output

set wp(nick) 			[lindex $arg 0]
set wp(keys) 			[lindex $wp(readout) 10]
set wp(clicks) 		[lindex $wp(readout) 13]
set wp(mouse_miles) 		[lindex $wp(readout) 22]
set wp(keys_per_sec) 	[lindex $wp(readout) 25]
set wp(clicks_per_sec) 	[lindex $wp(readout) 28]
set wp(lastpulse_date) 	[lindex $wp(readout) 42]
set wp(lastpulse_time) 	[lindex $wp(readout) 43]
set wp(number_of_pulses) 	[lindex $wp(readout) 50]
set wp(country) 		[lindex $wp(readout) 56]
set wp(refered_users) 	[lindex $wp(readout) 60]
# $wp(team) 		-> ->	contains the teamname - if user is in an team
# $wp(teamrank) 	-> ->	contains the rank in team - if user is in an team

Bugfixing

if {$wp(country) == "United"} { $wp(country) == "United States" }

Channel-Output

putserv "privmsg $chan :«Whatpulse» $wp(nick) ($wp(country)) hat $wp(keys) gezählte Tastenanschläge und $wp(clicks) Mausklicks. (Last Pulse: $wp(lastpulse_date) um $wp(lastpulse_time) Uhr)"
if {[info exists wp(team)]} {
	##INFO## this line will only be executed if the user is in an team.
	putserv "privmsg $chan :«Whatpulse» $wp(nick) ist im Team $wp(team) und hat dort den Rang: $wp(teamrank)"
}

}
putlog “Whatpulse-Script by LuZ1 loaded”[/CODE]

the only thing you have to do is change the XXXX in line 5 of this script to http (board restrictions for urls ^^)

is dont use the given api for getting information, because i dont want to search an userid - i want to search an nickname
currently the script is in german - but its easy to translate - just use the vars and layout it yourself.

see it work:

[quote]«18:53:55» <@LuZ1F3R> ?whatpulse LuZ1F3R
«18:53:56» <@Zwergnase> «Whatpulse» LuZ1F3R (Germany.) hat 13,712,854 gezählte Tastenanschläge und 4,946,254 Mausklicks. (Last Pulse: 2009-10-28 um 17:04:33 Uhr)
«18:53:57» <@Zwergnase> «Whatpulse» LuZ1F3R ist im Team #t2f-palace und hat dort den Rang: 2nd[/quote]