Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD Beta Forum
Belmyrddyn
Magician


Joined: 17 Oct 2001
Posts: 371
Location: USA

PostPosted: Sun Nov 08, 2009 1:46 am   

[3.12] Simutronics XML Mapping
 
Hi, everyone!

So, I've been working for the last two days on getting XML support for Simutronics games into cMUD. It's been going pretty well. The most important functionality is based on the following triggers:

Code:
<trigger priority="2" stop="true" id="1">
    <pattern>(<(/%x)>)(*%x*)</pattern>
    <value>
$curpos = %pos(%1, %line)
$endoftag = %word(%x1, 2) + 1
#SUB ""
#GAG
#SHOW %left(%line, $endoftag)
#SHOW %right(%line, $endoftag)
    </value>
</trigger>
<trigger priority="3" stop="true" id="2">
    <pattern>((*%x*)(<*%x*/>))</pattern>
    <value>
#SUB ""
#GAG
#SHOW %2
#SHOW %3
    </value>
</trigger>
<trigger priority="1" stop="true" id="3">
    <pattern>(*/>*%x*)</pattern>
    <value>
$curpos = %eval(%pos("/>", %1) + 1)
#SUB ""
#GAG
#SHOW %left(%1, $curpos)
#SHOW %right(%1, $curpos)
    </value>
</trigger>


This slows down screen display a little, but its only dramatic when you first log in and a tremendous amount of XML is loaded into the system.

This is a question about mapping, so let me post two outputs:

Without XML Parsing:

Quote:
<streamWindow id='main' title='Story' subtitle=" - Middens, Alerin Slade" location='center' target='drop'/><streamWindow id='room' title='Room' subtitle=" - Middens, Alerin Slade" location='center' target='drop' ifClosed='' resident='true'/><clearStream id='room'/><pushStream id='room'/><nav/><compDef id='room desc'>Some of the famed exports of The Slade hustle by you - thieves, mercenaries, brigands and press laborers - en route to or returning from the Crossing. Stonefaced and purposeful, as shady as these characters appear, you cannot help but wonder if their grim determination is the product of hungry mouths huddled in squalid shacks somewhere nearby.</compDef><compDef id='room objs'></compDef>
<compDef id='room players'></compDef>
<compDef id='room exits'>Obvious paths: <d>northeast</d>, <d>south</d>, <d>northwest</d></compDef>
<popStream id='room'/>
<component id='room players'></component>
<resource/><resource picture="0"/><style id="roomName" />[Middens, Alerin Slade]
<style id=""/><style id="roomDesc"/>Some of the famed exports of The Slade hustle by you - thieves, mercenaries, brigands and press laborers - en route to or returning from the Crossing. Stonefaced and purposeful, as shady as these characters appear, you cannot help but wonder if their grim determination is the product of hungry mouths huddled in squalid shacks somewhere nearby.<style id=""/>
Obvious paths: northeast, south, northwest.
<compass><dir value="ne"/><dir value="s"/><dir value="nw"/></compass><prompt time="1257644082">></prompt>


With XML parsing:

Quote:
<streamWindow id='main' title='Story' subtitle=" - Middens, Gravel Way" location='center' target='drop'/>
<streamWindow id='room' title='Room' subtitle=" - Middens, Gravel Way" location='center' target='drop' ifClosed='' resident='true'/>
<clearStream id='room'/>
<pushStream id='room'/>
<nav/>
<compDef id='room desc'>Very surly, very rank Gor'Togs shoulder by you, nearly knocking you to the ground in their melancholy haste. You are accustomed to the brusque ways of their city-dwelling kin, but these squatters seem to be driven by some inner force, which you can almost see in their thick-lidded eyes. Small children with swollen bellies trail after the grownups, pointing at you as they titter among themselves.</compDef>

<compDef id='room players'></compDef>
<compDef id='room exits'>Obvious paths: <d>north</d>

<popStream id='room'/>
<component id='room players'></component>
<resource/>
<resource picture="0"/>
<style id="roomName" />
[Middens, Gravel Way]
<style id=""/>
<style id="roomDesc"/>
Very surly, very rank Gor'Togs shoulder by you, nearly knocking you to the ground in their melancholy haste. You are accustomed to the brusque ways of their city-dwelling kin, but these squatters seem to be driven by some inner force, which you can almost see in their thick-lidded eyes. Small children with swollen bellies trail after the grownups, pointing at you as they titter among themselves.
<style id=""/>
Obvious paths: north, east, south.
<compass>
<dir value="n"/>
<dir value="e"/>
<dir value="s"/>
</compass>


Now, I've written a bunch of triggers to gag most of the nonsense text. The <pushStream> tags are designed to send certain content to secondary windows. All of this is working quite lovely.

My main problem is the following section:
Quote:
<compass>
<dir value="n"/>
<dir value="e"/>
<dir value="s"/>
</compass>


I've written the following triggers to deal with this:

Code:

<trigger name="Compass" priority="670" id="67">
  <pattern></pattern>
  <value>
#GAG
//DRcMUD/SystemTriggers/XML/roomExits = ""
  </value>
  <trigger regex="true">
    <pattern></pattern>
    <value>
#GAG
$dir = %1
#IF ($dir = "out") {
  $dir = "o"
}
#IF ($dir = "in") {
  $dir = "i"
}
#IF (%numitems(@//DRcMUD/SystemTriggers/XML/roomExits) < 1) {
  //DRcMUD/SystemTriggers/XML/roomExits = $dir
} {
  //DRcMUD/SystemTriggers/XML/roomExits = %additem($dir, @//DRcMUD/SystemTriggers/XML/roomExits)
}
#STATE Compass 1
     </value>
  </trigger>
</trigger>


<trigger priority="700" id="70">
  <pattern></pattern>
  <value>#GAG
#STATE Compass 0
#TAG exit @//DRcMUD/SystemTriggers/XML/roomExits
#TAG prompt
#OK
   </value>
</trigger>


Note the trigger state:

Trigger 1.0: <compass> - just gags
Trigger 1.1: <dir value='xxx'> - stores the "XXX" value into a stringlist of the room exits
Trigger 2: </compass> - Tags the stringlist of exits.

So, when I'm walking around trying to map in the MUD, the mapper gets the room name and the room description fine. But it either doesn't get the exits at all, or they're absolutely crazy. I also tried abandoning using the compass settings for the room exits, though they're a bit more accurate, and tried the "Obvious paths:" line of text. It was much more likely to get crazy responses here than anywhere else.

I should also note that the triggers themselves are working, in terms of setting up the correct stringlist of exits. The stringlist is correct - just not the mapper.

The mapper works great when I've got GSL enabled, but I'm really hoping to get this to work to take advantage of the extra features that the XML offers.

Any thoughts on why the mapping isn't working?

Thanks!
_________________
Belmyrddyn
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Sun Nov 08, 2009 2:36 am   
 
It's not recognizing the prompt. It looks like your prompt trigger has nothing as the pattern, and CMud mapping totally bombs if it can't find a prompt.

Quote:

<style id="roomName" />
[Middens, Gravel Way]
<style id=""/>


#trigger {<style id="roomName" />} {#gagspace}
#condition {^~[([%w%s,])~]$} {Roomname = %1;#tag name @Roomname}
#condition {<style id="" />} {#gagspace}

Quote:

<style id="roomDesc"/>
Very surly, very rank Gor'Togs shoulder by you, nearly knocking you to the ground in their melancholy haste. You are accustomed to the brusque ways of their city-dwelling kin, but these squatters seem to be driven by some inner force, which you can almost see in their thick-lidded eyes. Small children with swollen bellies trail after the grownups, pointing at you as they titter among themselves.
<style id=""/>


#trigger {<style id="roomDesc" />} {#gagspace}
#condition {([%x%s])} {Roomdesc = %1}
#condition {<style id="" />} {#gagspace}

Quote:

<compass>
<dir value="n"/>
<dir value="e"/>
<dir value="s"/>
</compass>


#trigger "tRoomExits" {^<compass>$} {#gagspace;RoomExits = ""}
#condition {(<(*)>)} {#if (%1 = "/compass") {#state tRoomExits 0} {#local $exit;#call %match(%stripq(%1),"dir value=(%w)/",$exit);#additem RoomExits $exit}} {manual}

I don't remember what the prompt looks like in SF mode, but you should be able to wing it from the above examples.
_________________
EDIT: I didn't like my old signature
Reply with quote
orphean
Apprentice


Joined: 21 Oct 2008
Posts: 147
Location: Olympia, WA

PostPosted: Sun Nov 08, 2009 3:31 am   
 
How are you connecting? I can't even connect to Dragonrealms with the client type set to STORM, it just autodisconnects me and I'd love to play with the xml stream.
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Sun Nov 08, 2009 5:25 am   
 
GSL client should be set to "stormfront", and the GSL mode should be set to either PLAY or STORM (one will work, the other won't).
_________________
EDIT: I didn't like my old signature
Reply with quote
orphean
Apprentice


Joined: 21 Oct 2008
Posts: 147
Location: Olympia, WA

PostPosted: Sun Nov 08, 2009 5:46 am   
 
Looks like the correct settings are 'stormfront' for the GSL client, and PLAY for the GSL mode.

STORM for the GSL Mode fails to login in all circumstances as far as I can tell.
Reply with quote
orphean
Apprentice


Joined: 21 Oct 2008
Posts: 147
Location: Olympia, WA

PostPosted: Sun Nov 08, 2009 5:55 am   
 
Hmm well I'm connected and get some XML now, but it seems to be a subset of what Belmyrddyn is getting so I suspect he is either doing some negotiation with the server or connecting in a different manner.

Anyway, sorry to hijack your thread Belmyrddyn, I'm just really interested in this as well. :)

Edit: MXP wasn't showing unknown tags, think i'm good to go now.
Reply with quote
Belmyrddyn
Magician


Joined: 17 Oct 2001
Posts: 371
Location: USA

PostPosted: Mon Nov 09, 2009 8:24 pm   
 
Thanks for the help! I got the mapping working, but now I'm trying to rewrite those three XML triggers to just be one which displays all the XML in a single-round. This should hopefully speed up processing, since I'm not constantly reparsing the same text over and over again.
_________________
Belmyrddyn
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD Beta Forum All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net