mIRC Home    About    Download    Register    News    Help

Print Thread
#212875 08/06/09 01:33 AM
Joined: Jun 2009
Posts: 9
B
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
B
Joined: Jun 2009
Posts: 9
I know this has been covered a thousand times, and I've tried modifying the scripts that cover the same type of deal from this site, but I've failed...

I want people to be able to do !player <name> in a channel and get the player info from an online search.

The link to the search is http://herald.uthgard-server.net/daoc/sig.php?name=<charname>&txt=on

So, for a character named 'Fighter' it would be http://herald.uthgard-server.net/daoc/sig.php?name=Fighter&txt=on

I would like to get the output like:
.msg $chan <name> <lastname> (<level>, <class>) - <guild> - <realmlevel> (<realmpoints>)

For Example:
.msg $chan Fighter DoesTheFighting (43, Armsman) - The Legendary Knights - 2.5 (26685)

This is what I have so far:

Code:
on *:TEXT:*!player*:#: {
  if ($1 == %c $+ player) {
    set %playerurl /daoc/sig.php?name= $+ $+($replace($2-,$chr(32),+),&txt=on)
    playerlookup
  }
}

alias playerlookup {
  sockopen player herald.uthgard-server.net 80
}

on *:SOCKOPEN:player: {
  sockwrite -nt $sockname GET %playerurl HTTP/1.1
  sockwrite -nt $sockname Accept-Language: en-us
  sockwrite -nt $sockname User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.2; rv:1.7.3) Gecko/20040913 Firefox/0.10.1
  sockwrite -nt $sockname Host: herald.uthgard-server.net
  sockwrite -nt $sockname Connection: keep-alive
  sockwrite -t $sockname $str($crlf,2)
}



Any help would be greatly appreciated.

Last edited by Borg8401; 08/06/09 01:37 AM.
Joined: Jun 2007
Posts: 933
5
Hoopy frood
Offline
Hoopy frood
5
Joined: Jun 2007
Posts: 933
A quick whip-up (not the prettiest maybe):
Code:
on *:TEXT:!player*:#: {
  if ($1 == %c $+ player) {
    set %playerurl /daoc/sig.php?name= $+ $+($replace($2-,$chr(32),+),&txt=on)
    set %playerchan $chan
    playerlookup
  }
}

alias playerlookup {
  sockopen player herald.uthgard-server.net 80
}

on *:SOCKOPEN:player: {
  sockwrite -nt $sockname GET %playerurl HTTP/1.1
  sockwrite -nt $sockname Accept-Language: en-us
  sockwrite -nt $sockname User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.2; rv:1.7.3) Gecko/20040913 Firefox/0.10.1
  sockwrite -nt $sockname Host: herald.uthgard-server.net
  sockwrite -nt $sockname Connection: keep-alive
  sockwrite -t $sockname $str($crlf,2)
}

on *:SOCKREAD:player:{
  if ($sockerr > 0) { return }
  :nextread
  sockread %player
  if ($sockbr == 0) { return }
  if (%player == [player] { set %playerget on | goto nextread }
  if (%playerget) {
    var %playerinfo = $gettok(%player,1,61)
    var %playerdata = $gettok(%player,2,61)
    if (!%playerdata) { set %playernull on }
    set %player $+  %playerinfo %playerdata
  }
  goto nextread
}
on *:SOCKCLOSE:player:{
  if (!%playernull) { .msg %playerchan %playername %playerlastname ( $+ %playerlevel $+ , %playerclass $+ ) - %playerguild - %playerrealmlevel ( $+ %playerrealmpoints $+ ) }
  unset %player*
}


P.S. The if-statement in the on TEXT event seems to be obsolete. I don't think you need it.

EDIT: changed it so you don't output data for a non-existing player.

Last edited by 5618; 08/06/09 03:26 PM.
5618 #212912 08/06/09 09:47 PM
Joined: Jun 2009
Posts: 9
B
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
B
Joined: Jun 2009
Posts: 9
You are a god... Thank you soooooo much... small problem, when I run it, it spits this out at me:

Code:
* /elseif: invalid format (line 27, player.mrc)
-
* /msg: insufficient parameters (line 74, sys.mrc)
-
Date: No such nick
-
* /elseif: invalid format (line 27, player.mrc)
-
* /msg: insufficient parameters (line 74, sys.mrc)
-
* /elseif: invalid format (line 27, player.mrc)
-
X-Powered-By: No such nick
-
Keep-Alive: No such nick
-
Content-Type: No such nick
-
cached=1HTTP/1.1 No such nick
-
Server: No such nick
-
Content-Length: No such nick
-
Connection: No such nick


Will try to tinker with it to get it to work, but if you have any suggestions please feel free to post them.

Last edited by Borg8401; 08/06/09 09:49 PM.
Joined: Jun 2007
Posts: 933
5
Hoopy frood
Offline
Hoopy frood
5
Joined: Jun 2007
Posts: 933
Well, I see I missed a closing bracket in the line...
Code:
if (%player == [player] { set %playerget on | goto nextread }

that should be...
Code:
if (%player == [player]) { set %playerget on | goto nextread }

The other error messages don't make any sense though. I assume you edited the script? Can you paste the whole script?

5618 #212915 09/06/09 05:59 AM
Joined: Jun 2009
Posts: 9
B
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
B
Joined: Jun 2009
Posts: 9
I'm sorry man, I caught the ')' when you first posted the script so it was np... The problem was with me, I accidently forgot to delete my pathetic excuse for a script and it was using !player and breaking yours...

The script works... but not for players without last names, not sure why that would matter, any ideas?

Last edited by Borg8401; 09/06/09 06:22 AM.
Joined: Jun 2007
Posts: 933
5
Hoopy frood
Offline
Hoopy frood
5
Joined: Jun 2007
Posts: 933
To fix that change...
Code:
if (!%playerdata) { set %playernull on }

to...
Code:
if (%playerinfo == name) && (!%playerdata) { sockclose player | unset %player* }


With this code change you can also remove the "if (!%playernull)" check from the on SOCKCLOSE event.

Last edited by 5618; 09/06/09 02:40 PM.
5618 #212925 09/06/09 03:11 PM
Joined: Jun 2009
Posts: 9
B
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
B
Joined: Jun 2009
Posts: 9
Amazing work man grin thank you for the help, couldn't have done it myself (obviously). /bow


Link Copied to Clipboard