XML eqlist queries

Scripts for wintin.

XML eqlist queries

Postby Shiv » Tue May 30, 2006 6:10 pm

Hey all,
I made a change to my xml.php file in the eqlist directory so that it can be queried for a specific item name, and will return the results as an XML set.

The full path is [url]http://www.slothmud.org/eqlist/xml.php?eqname={item name}[/url]

If someone out there in scripting land can figure out how to query it from within .net without using a browser, and to then parse the results and display them in a logical manner in a wintin.net window, I'd be very grateful-- and I imagine a lot of other people would be, too!

Thanks,
-Shiv/Enea
Shiv
 
Posts: 9
Joined: Fri Jul 02, 2004 7:41 pm
Status: Offline

Postby Frobisher » Wed May 31, 2006 12:24 pm

Here's a script that will work with Wintin 2.x - it needs C# scripting which isn't available in v1.

To use the script, right click in the Script Manager and create a new alias. Call it eqlist or anything else you want. Copy and paste the text below into the alias properties box, and select C# as the script language.

With the alias defined, you can say for example 'eqlist diamond' to get a list of all the diamond thingies.

For the time being this is pointing at the backup eq list as there is a problem with the slothmud one. Just change the url in the listing below when Shiv has fixed the problem.
[code:1byr8p9k] Editor's Note: the problem has been fixed.
[/code:1byr8p9k]

regards

Fro
[code:1byr8p9k]
using System;
using System.Windows.Forms;
using System.Xml;
using System.IO;
using System.Net;

using ScriptEngine;
//css_reference ScriptEngine.dll;

public class Script : WintinScript
{
public override void Init()
{
string line = wintin.Line.Trim();
string url = "http://www.slothmud.org/eqlist/xml.php?eqname=" + line;
WebRequest req;
Stream st = null;
XmlTextReader xr = null;

try
{
req = WebRequest.Create(url);
WebResponse resp = req.GetResponse();
st = resp.GetResponseStream();
xr = new XmlTextReader(st);

string eqname, type, armor, affects, res;

while(xr.Read())
{
xr.MoveToElement();

if(xr.Name == "eq" && xr.NodeType == XmlNodeType.Element)
{
eqname = "";
type = "";
armor = "";
affects = "";

do
{
xr.Read();

if(xr.NodeType == XmlNodeType.Element)
{
if(xr.Name == "eqname")
eqname = xr.ReadElementString();
if(xr.Name == "type")
type = xr.ReadElementString();
if(xr.Name == "armor")
armor = xr.ReadElementString();
if(xr.Name == "affects")
affects = xr.ReadElementString();
}
}
while(xr.Name != "eq" || xr.NodeType != XmlNodeType.EndElement);

res = eqname + " (" + type + ") " + armor + " " + affects + "\r\n";
wintin.SendToScreen(res);
}
}

}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
finally
{
if(st != null)
st.Close();

if(xr != null)
xr.Close();
}
}
}[/code:1byr8p9k]
Frobisher
 
Posts: 1
Joined: Wed May 31, 2006 12:20 pm
Status: Offline

Postby 12345 » Wed May 31, 2006 12:31 pm

Impressive.
Kein Mehrheit Fur Die Mitleid -KMFDM
User avatar
12345
Avatar Poster
 
Posts: 1024
Joined: Thu Oct 21, 2004 10:27 am
Location: 127.0.0.1
Status: Offline

Correction to the url line in the script

Postby Shiv » Wed May 31, 2006 1:50 pm

Shiv
 
Posts: 9
Joined: Fri Jul 02, 2004 7:41 pm
Status: Offline

Just added another xml tool

Postby Shiv » Sat Jun 10, 2006 10:00 am

Hi everyone,
Since the mud was down I took some time and wrote another xml tool. This one is used to get the forge/brew/etc item about an info. It's at:

<http://www.slothmud.org/eqlist/forgexml.php?eqname=(your item name here)>

Once again I'll let somone else write the client-side script for it, but it's a pretty easy tool to use. For best results to see what it looks like, open it in IE, since IE has that neato built-in xml viewing tool... I keep hoping a coming version of Firefox will have something similar...

-Shiv/Enea
Shiv
 
Posts: 9
Joined: Fri Jul 02, 2004 7:41 pm
Status: Offline

Eqlist tools

Postby Avatar » Mon Jun 12, 2006 10:57 am

That's pretty nice, both of the web-based query tools.

I've been considering keeping my forge notes scripted in the client, instead of my current setup = bunches of txt files and an excel spreadsheet. Now it would be possible to integrate the two. I could import the list of forge ingredients and flag each one as it pops.

I'll have to think of the benefits, but these new tools create interesting possibilities.
User avatar
Avatar
Triple 40 Poster
 
Posts: 487
Joined: Sat Feb 21, 2004 1:09 am
Status: Offline

eqlist scripts and proxy

Postby Mannu » Tue Jun 13, 2006 7:49 pm

I'd love to use those scripts, but I'm logged on through a socks proxy. It seems like the connection to the website cannot be made. Is there a way to make it work with proxy connections?
User avatar
Mannu
 
Posts: 6
Joined: Mon May 03, 2004 1:43 pm
Status: Offline

Re: XML eqlist queries

Postby Vekna » Sun Jan 09, 2011 6:13 am

Hi, immortals! Any chances to return "old" xml interface of eqlist?
Vekna
 
Posts: 14
Joined: Tue Jul 13, 2004 4:11 pm
Status: Offline

Re: XML eqlist queries

Postby *Breeze* » Sun Jan 09, 2011 7:51 am

sorry but no time soon because if i do that,

it will be limited to 10 or so results per search

and people will complain that is not enough
so
then someone will ask for filters
then someone will ask for more filters
then someone will ask me to change the format of the xml output
then someone will want a way to choose between the different xml outputs

... it never ends ..

its the same thing i went through with the html eqlist

like recently when Chobbs asked what people like about the MUD and someone brought up the eqlist how it was 'lacking' something to tell you what components go to what forges... that wasn't even what he asked..

anyways to be honest I don't have the time nor desire to mess with it at the moment

I would do a complete export weekly or so in xml format which could be downloaded and parsed by the clients but on the old eqlist when i did that people just linked to it directly instead of caching it which caused a ton of traffic since some moron(s) had it automatically look up every item he(they) saw, which downloaded a huge xml file each time.

so you see, not to rant too much but there is really no feasible way to do it at the moment.
User avatar
*Breeze*
Avatar Poster
 
Posts: 520
Joined: Mon Nov 05, 2007 9:24 am
Status: Offline

Re: XML eqlist queries

Postby Vekna » Sun Jan 09, 2011 3:50 pm

*Benq* wrote:I would do a complete export weekly or so in xml format which could be downloaded and parsed by the clients but on the old eqlist when i did that people just linked to it directly instead of caching it which caused a ton of traffic since some moron(s) had it automatically look up every item he(they) saw, which downloaded a huge xml file each time..


It will be great! :)
Vekna
 
Posts: 14
Joined: Tue Jul 13, 2004 4:11 pm
Status: Offline

Re: XML eqlist queries

Postby Tuck » Mon Jan 10, 2011 3:32 pm

*Benq* wrote:I would do a complete export weekly or so in xml format which could be downloaded and parsed by the clients but on the old eqlist when i did that people just linked to it directly instead of caching it which caused a ton of traffic since some moron(s) had it automatically look up every item he(they) saw, which downloaded a huge xml file each time.


You can ban morons by IP, even make it automatically.
Tuck
Triple 40 Poster
 
Posts: 323
Joined: Mon Jun 22, 2009 12:06 pm
Location: Planet Earth
Status: Offline

Re: XML eqlist queries

Postby *Breeze* » Mon Jan 10, 2011 3:50 pm

yeah that would be the first thing i work on before doing the actual output.
User avatar
*Breeze*
Avatar Poster
 
Posts: 520
Joined: Mon Nov 05, 2007 9:24 am
Status: Offline


Return to WinTin Scripts

Who is online

Users browsing this forum: No registered users and 5 guests

cron