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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
Endalos
Newbie


Joined: 14 Mar 2009
Posts: 8

PostPosted: Mon Mar 16, 2009 1:39 am   

Automapping Achaea
 
After trying Achaea I decided I liked it more than Lusternia and I have also had more success with automapping, however when I opened up cmud just now, I have had a few more problems with getting to to know when I have moved. Room names, descriptions and exits are all fine. Here is the script.

//room naming
#TRIGGER {(.*)..*$} {#if (@roomnaming) {roomexits = "";roomname = %stripansi(%1);roomname = %concat( @roomname, ".")};roomnaming = 0;#tag Name @roomname}

Options selected: Line Colour (to match the room name), trigger on newline, trigger on trigger, regular expression

//exit naming
#Trigger {^You see (*.)} {roomnaming = 1;roomexits = %concat( "You see ", %1);exitstrip = (%pos( ., @roomexits)) + 1;roomexits = (%delete( @roomexits, @exitstrip, 100));#if (%pos( ., @roomexits)) {#tag Exit @roomexits}}

Options selected: Trigger on Trigger, trigger on newline

Both manage to send the room name and exit and they seem to be copied correctly.

On the mapper itself, If I create a brand new room (A) and reload the information, name, description and exits are created normally. If I move a new room (B) is created with all information correct. Moving back to room A works fine, however, if I move to room B it doesn't record it and no longer does so between those two rooms.

Any help appreciated, I am slowly learning my way through all of this with your help :)
Reply with quote
ReedN
Wizard


Joined: 04 Jan 2006
Posts: 1279
Location: Portland, Oregon

PostPosted: Mon Mar 16, 2009 4:29 am   
 
Here's some of the stuff I have for Achaea. I do it through ATCP mostly, but it is supplemented with the normal room name and prompt to account for the wonky order I get from the server and for things like rooms without exits and other weird stuff.

It won't be exactly what you need, but you can look through it and get ideas.

Exits:
Code:

<trigger name="RoomExitsTrigger" type="Telnet" param="200" priority="1" case="true" stop="true" regex="true" id="3324">
  <pattern>^Room\.Exits\s+(.*)$</pattern>
  <value>//#var atcp %additem( %1, @atcp)
#var RoomExits %subchar( %1, ",", "|")
#add RoomExitsSeen 1</value>
</trigger>


Vitals:
Code:

<trigger type="Telnet" param="200" priority="4" case="true" stop="true" regex="true" id="3335">
  <pattern>^Char\.Vitals\12(H:(\d+)/(\d+) M:(\d+)/(\d+)) E:(\d+)/(\d+) W:(\d+)/(\d+) NL:\d+/100</pattern>
  <value>#if (%1 <> @stats_old) {
  #var stats_old %1
  #var health %2
  #var max_health %3
  #var mana %4
  #var max_mana %5
  #RAISEEVENT Vitals
  }
#var endurance %6
#var max_endurance %7
#var willpower %8
#var max_willpower %9</value>
</trigger>


Room Name
Code:

<trigger name="RoomBriefTrigger" type="Telnet" param="200" priority="2" case="true" stop="true" regex="true" id="3321">
  <pattern>^Room\.Brief\s+(?:Flying above |In the trees above )?(.+?)(?: \(road\))?$</pattern>
  <value>//#var atcp %additem( %1, @atcp)
#var RoomName %1
#add RoomNameSeen 1</value>
</trigger>

<trigger priority="10" case="true" ansi="true" stop="true" regex="true" id="3647">
  <pattern>^(?:(?:\e\[37m)?(?:Flying above|In the trees above))?\e\[1;33m</pattern>
  <value>//#var atcp %additem( "Non-ATCP RoomName", @atcp)
#if (@RoomNameSeen > 1) {
  RoomNameLogic
  #var RoomNameSeen 0
  #var RoomExitsSeen 0
  }</value>
</trigger>

<alias name="RoomNameLogic" id="3653">
  <value>#tag name @RoomName
#if (@RoomExitsSeen == 0) {#var RoomExits %null}
#tag exit @RoomExits
#if ((@flag( moving) or %walkactive) and !@flag( find)) {#ok} {find_current}
#RAISEEVENT RoomName %1
</value>
</alias>

<event event="Prompt" priority="36510" id="3651">
  <value>#if (@RoomNameSeen > 1) {RoomNameLogic}
#var RoomNameSeen 0
#var RoomExitsSeen 0
</value>
</event>


Prompt:
Code:

<trigger name="prompt" priority="6" case="true" regex="true" newline="false" prompt="true" id="3339">
  <pattern>^\d+h, \d+m, \d+e, \d+w ([cexkdb]*)\-</pattern>
  <value>//#var atcp %additem( prompt, @atcp)
#var pflags %1
#RAISEEVENT BlackoutCured
#RAISEEVENT Prompt
#if (%regex( @pflags, "ex")) {#RAISEEVENT PromptBalanced}
#tag prompt</value>
</trigger>
Reply with quote
Endalos
Newbie


Joined: 14 Mar 2009
Posts: 8

PostPosted: Tue Mar 17, 2009 3:56 am   
 
Thanks alot :)

I have had a quick look over it and it might be better than the system I have just slapped together :)
Reply with quote
ReedN
Wizard


Joined: 04 Jan 2006
Posts: 1279
Location: Portland, Oregon

PostPosted: Tue Mar 17, 2009 5:06 am   
 
It should be pretty good. It's about my 6th version of the code. It's about my most reworked code of all, each time I refine it and make it work just a bit better.
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Tue Mar 17, 2009 11:10 am   
 
That's a very interesting way of handling changes in stats only, by the way ReeN, and one that definitely bears some thought for my future scripts :D I think I'd probably raise two events, one on every prompt for handling all the stuff I want to reset and check then, and another for handling stuff only when my stats have changed (like healing and so on). Perhaps I'll put that Stats-handling even inside an OnPrompt event handler, just to confuse the issue even more :P
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
ReedN
Wizard


Joined: 04 Jan 2006
Posts: 1279
Location: Portland, Oregon

PostPosted: Tue Mar 17, 2009 2:09 pm   
 
Computing health deltas and displaying them is a bit more costly than doing one compare, so I try to bypass it as often as possible.

I'm always trying to find ways to optimize it, so if you see something that could be done better, let me know.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD General Discussion 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