mIRC Home    About    Download    Register    News    Help

Print Thread
#127774 16/08/05 08:40 PM
Joined: Jan 2003
Posts: 36
S
s0tt0 Offline OP
Ameglian cow
OP Offline
Ameglian cow
S
Joined: Jan 2003
Posts: 36
i need script which will take some info from webpage and display it in the channel when someone types what is needed. ok the place where it gets the info is... hiscore-web.runescape.com and http://hiscore-web.runescape.com/aff/runescape/hiscorepersonal.cgi?username=username

ok and when your in the channel and write !cooking username it gets the cooking skill exp of that username and displays it back in channel. please help me to make this script. ill try to put my effort to it also, but i need some headstart from you guys smile

#127775 17/08/05 12:52 PM
Joined: Jan 2003
Posts: 36
S
s0tt0 Offline OP
Ameglian cow
OP Offline
Ameglian cow
S
Joined: Jan 2003
Posts: 36
ok to make it easier then i have someone others script but it doesnt work, but why?

Code:
; ______________________________________________________ ______________________ 
; 
; Runescape script 
; ______________________________________________________ ______________________ 
 
; ______________________________________________________ ______________________ 
; Events 
 
on *:text:@skills:#: msg $chan Available skills are: $replace($rune_skills,|,$chr(44)) 
 
on *:text:@*:#: { 
var %skills = overall attack defence strength ranged hitpoints magic fletching thieving crafting cooking firemaking fishing smithing mining prayer runecrafting herblore agility 
var %query = $remove($1,@) 
if ($istok(%skills,%query,32)) { 
if ($2) runescape $chan %query $2- 
else msg $chan You must specify a player name, ie, $1 $nick 
} 
else msg $chan You must specify a valid skill, type @skills to see the skill list 
} 
 
; ______________________________________________________ ______________________ 
; Aliases 
 
;; Function: gets data on runescape 
;; Usage: /runescape <target> <type> <name of player> 
alias runescape { 
var %sock = runescape. $+ $ticks 
hadd -m %sock target $1 
hadd %sock query $2 
hadd %sock name $3- 
sockopen %sock hiscore-web.runescape.com 80 
} 
 
;; Function: simply writes to the object database, a shortcut for the lazy/uninformed 
;; Usage: /rune.add <skill type> <object> <xp> 
alias rune.add { writeini $shortfn($scriptdirrunedb.ini) $1 $2 $$3 } 
 
;; Function: displays the skills list 
;; Usage: $rune_skills 
alias rune_skills { return overall|attack|defence|strength|range|hitpoints|magic| fletching|thieving|crafting|cooking|firemaking|fishing|s mithing|mining|prayer|runecrafting|herblore|agility } 
 
;; Function: delimits a number with a given character (ie, adds commas to large numbers) 
;; Usage: $delimit(<number>,<C>) 
;; Comments: <C> is an ASCII representation of a char, as used in $gettok 
alias delimit { 
var %regex = (^[-+]?\d+?(?=(?>(?:\d{3})+)(?!\d))|\G\d{3}(?=\d)) 
.echo -q $regsub($1,m~ %regex ~xg,\1 $+ $chr($2),%regex) 
return %regex 
} 
 
;; Function: returns the xp needed at a specified level in runescape 
;; Usage: $lvlxp(<level>) 
alias lvlxp { 
var %A, %B, %C, %i = 1 
while (%i <= $1) { 
%A = $floor($calc(%C / 4)) 
%B = $floor($calc(%i + 300 * 2^(%i / 7))) 
%C = $calc(%C + %B) 
inc %i 
} 
return %A 
} 
 
; ______________________________________________________ ______________________ 
; Connection 
 
on *:sockopen:runescape.*: { 
;; remove spaces from the names and replace them with +'s, for URL encoding 
var %name = $replace($hget($sockname,name),$chr(32),+) 
sockwrite -n $sockname GET http://hiscore-web.runescape.com/aff/runescape/highsco rerank.cgi?username=$+ 
sockwrite -n $sockname Host: http://hiscore-web.runescape.com/aff/runescape/hiscore s.html 
sockwrite -n $sockname Connection: close 
sockwrite -n $sockname 
} 
 
on *:sockread:runescape.*: { 
var %temp 
sockread %temp 
 
if (*class=c>*</a></td>* iswm %temp) { 
hadd $sockname subject $nohtml(%temp) 
hinc $sockname capture 
} 
elseif ($nohtml(%temp)) && ($hget($sockname,capture)) { 
var %cap = $ifmatch, %subject = $hget($sockname,subject) 
hadd $sockname %subject $+ $gettok(_rank _level _xp,%cap,32) $nohtml(%temp) 
if (%cap >= 3) hdel $sockname capture 
else hinc $sockname capture 
} 
} 
 
on *:sockclose:runescape.*: { 
;; type of query the person is asking for: overall, attack, defence, etc 
var %query = $hget($sockname,query), %results 
;; give overall stats --> list the level for each topic 
if (%query == overall) { 
var %i = 1 
while ($hfind($sockname,*_level,%i,w)) { 
;; get the type and value of each topic (ie, type = attack, value = 99) 
var %type = $gettok($ifmatch,1,95), %value = $hget($sockname,$ifmatch) 
;; concatenate the results 
%results = %results $+([^B],%type,[^B] %value : 
inc %i 
} 
} 
;; give stats for each area (attack,defense,etc) 
else { 
;; find the XP for next level 
var %level = $hget($sockname,%query $+ _level) 
var %lvlXP = $lvlxp($calc(%level + 1)) 
;; find the current XP 
var %currentXP = $hget($sockname,%query $+ _xp) 
;; find how much XP is needed to advance 
var %needXP = $calc(%lvlXP - $remove(%currentXP,$chr(44))) 
 
;; format the 'stats' part of the message 
var %stats = [^B]Rank:[^B] $hget($sockname,%query $+ _rank) : [^B]Level:[^B] $hget($sockname,%query $+ _level) : [^B]XP:[^B] %currentXP : [^B]XP required to level:[^B] $delimit(%needXP,44) 
 
;; format and add the 'objects' part of the message 
var %i = 1, %objects, %file = $shortfn($scriptdirrunedb.ini) 
;; cycle through the available objects for the skill in question 
while ($ini(%file,%query,%i)) { 
var %object = $ifmatch, %xp = $readini(%file,%query,$ifmatch) 
if (%xp) %objects = %objects $+([^B],%object,[^B] $floor($calc(%needxp / %xp)) 
inc %i 
;; damned 'smithing' skill requires two lists of objects: smelt, and smith+smelt 
if (%query == smithing) && (%i > $ini(%file,%query,0)) var %objects = [^B][Smelt][^B] %objects [^B][Smith + Smelt][^B], %query = smelt, %i = 1 
} 
;; set query back to smithing 
if (%query == smelt) %query = smithing 
;; combine the two 
var %results = %stats :: %objects 
} 
 
;; message the results to the target 
msg $hget($sockname,target) %query stats for $hget($sockname,name) :: $iif($hget($sockname,%query $+ _level),%results,No data found) 
} 

  

Last edited by s0tt0; 17/08/05 12:52 PM.
#127776 18/08/05 10:05 AM
Joined: Jan 2003
Posts: 36
S
s0tt0 Offline OP
Ameglian cow
OP Offline
Ameglian cow
S
Joined: Jan 2003
Posts: 36
Whaaaa??? no one can help me?

#127777 19/08/05 01:28 AM
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Be patient. I can't help you since I know nothing about how sockets work, but it can take a few days to get a response...replying to your own posts does nothing but generate a higher number of posts for you. Generally if you haven't gotten a response within a week, then post a reply.

We help people out to the best of our abilities as our free time allows.

#127778 19/08/05 01:42 AM
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Well, briefly..

sockwrite -n $sockname GET http://hiscore-web.runescape.com/aff/runescape/highsco rerank.cgi?username=$+
sockwrite -n $sockname Host: http://hiscore-web.runescape.com/aff/runescape/hiscore s.html

You've got some unwanted spaces there. I assume it should be highscorerank.cgi ($+ shouldn't be joined to the end of the URL) and hiscores.html should have no space either.
Code:
sockwrite -n $sockname GET $+(http://hiscore-web.runescape.com/aff/runescape/highscorerank.cgi?username=,%some.nick)
sockwrite -n $sockname Host: http://hiscore-web.runescape.com/aff/runescape/hiscores.html


-Andy

#127779 19/08/05 07:34 AM
Joined: Jan 2003
Posts: 36
S
s0tt0 Offline OP
Ameglian cow
OP Offline
Ameglian cow
S
Joined: Jan 2003
Posts: 36
i tried to change those socket addresses already but it didnt work. and it may not seem so but im very greatful that you are trying to help me. i replyed so quickly becuse i always get anwer within 1 day in these forums smile

#127780 19/08/05 11:30 PM
Joined: Jun 2005
Posts: 21
F
Ameglian cow
Offline
Ameglian cow
F
Joined: Jun 2005
Posts: 21
magic| fletching

another space that doesnt belong there

#127781 20/08/05 10:47 AM
Joined: Jan 2003
Posts: 36
S
s0tt0 Offline OP
Ameglian cow
OP Offline
Ameglian cow
S
Joined: Jan 2003
Posts: 36
its not the spaces!!!! i have fixed those in my script it doesnt workd theres something else,,,


Link Copied to Clipboard