Danical
10-06-2008, 08:17 PM
Alright, so I'm trying to learn how to deal with all this XML stuff.
First, if anyone has any good resources that would be swell because I'd rather just learn it myself instead of having to keep asking like a n00blet.
Second, I'm trying to construct a variable that tracks the "room data" for creatures "that appears dead".
Here's a clip of the XML data:
<component id='room objs'> You also see<b> <pushBold/>a <a exist="155399057" noun="magus">triton magus</a><popBold/></b>that appears dead,<b> <pushBold/>a <a exist="155414465" noun="combatant">triton combatant</a><popBold/></b> that appears dead,<b> <pushBold/>an <a exist="155395937" noun="sentry">ethereal triton sentry</a><popBold/></b>,<b> <pushBold/>a <a exist="155396102" noun="defender">spectral triton defender</a><popBold/></b> and <a exist="156024" noun="muck">some muck</a>.</component>
I've got the following to track creatures in the room:
before_dying{ untrace_var(:$_SERVERSTRING_) }
trace_var(:$_SERVERSTRING_, proc { |data|
if data =~ /<pushStream id=['"]room['"]\/>.+<compDef id=['"]room objs['"]>.*<\/compDef>|<component id=['"]room objs['"]>.*<\/component>/
$npcs2 = data.scan(/<pushBold\/>[^<]*<a exist=['"]\d+['"] noun=['"][^'"]+['"]>/).collect { |val| /noun=['"]([^'"]+)['"]/.match(val).captures[0].dup }
end
})
How can I modify for my purposes above?
Also, the current iteration of checkloot forces a "look" action which I assume is for the wizard. How can I create a variable that analyzes the room data similar to above but with respect to objects.
First, if anyone has any good resources that would be swell because I'd rather just learn it myself instead of having to keep asking like a n00blet.
Second, I'm trying to construct a variable that tracks the "room data" for creatures "that appears dead".
Here's a clip of the XML data:
<component id='room objs'> You also see<b> <pushBold/>a <a exist="155399057" noun="magus">triton magus</a><popBold/></b>that appears dead,<b> <pushBold/>a <a exist="155414465" noun="combatant">triton combatant</a><popBold/></b> that appears dead,<b> <pushBold/>an <a exist="155395937" noun="sentry">ethereal triton sentry</a><popBold/></b>,<b> <pushBold/>a <a exist="155396102" noun="defender">spectral triton defender</a><popBold/></b> and <a exist="156024" noun="muck">some muck</a>.</component>
I've got the following to track creatures in the room:
before_dying{ untrace_var(:$_SERVERSTRING_) }
trace_var(:$_SERVERSTRING_, proc { |data|
if data =~ /<pushStream id=['"]room['"]\/>.+<compDef id=['"]room objs['"]>.*<\/compDef>|<component id=['"]room objs['"]>.*<\/component>/
$npcs2 = data.scan(/<pushBold\/>[^<]*<a exist=['"]\d+['"] noun=['"][^'"]+['"]>/).collect { |val| /noun=['"]([^'"]+)['"]/.match(val).captures[0].dup }
end
})
How can I modify for my purposes above?
Also, the current iteration of checkloot forces a "look" action which I assume is for the wizard. How can I create a variable that analyzes the room data similar to above but with respect to objects.