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
Odeon
Novice


Joined: 17 Nov 2008
Posts: 30

PostPosted: Wed Jan 14, 2009 8:35 am   

Flee and mapper
 
Hi,

Directional Flee

How do i move the current location in the mapper screen with the directional flee ?
For example if i type retreat east i would like point in mapper to go one room east.

Solution : #TRIGGER {You retreat ({west|east|south|north|up|down})} {#MOVE %1} [see topics]

Non-Directional Flee

When normal fleeing (non directional) is there a walkthrough to catch the right room with the mapper ?
ex : I am in a room with 4 exits (n w s e)
Movement with a flee will get me to one of these rooms. Is there a script to catch the "right" exit with mapper
[Several rooms have the same name and same description]
[but in general not the same exits]

Solution : #FIND maybe with a look only to the adjacent rooms (rooms next to the previous one)
Maybe someone have a script ?

Recall and mapper

If i recall, i go to one of "recalls" room but it's not always the same room.
So i would like mapper to quick search the right room and locate myself.
Atm, i'm using the binoculars button to locate room (i think it's not a bad way, maybe #LOOK)

Solution : #FIND should work well

Any comments welcome :)
Thanks,

Topics on the subject

I need Help with mapper and flee
http://forums.zuggsoft.com/forums/viewtopic.php?p=85604&highlight=

Newbie Question--"Look" and "Find Location on Map" not working
http://forums.zuggsoft.com/forums/viewtopic.php?p=140282

Automatic location
http://forums.zuggsoft.com/forums/viewtopic.php?t=27303&highlight=
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Wed Jan 14, 2009 2:13 pm   
 
Can you give some more details? To help write the triggers you need, we'll need stuff like the text that the mud sends when you recall, or when you non-directionally flee. I'll see about coming up with the right code.

[edit] I think we'll also need an example of the room name, description and exit lines. Somehow you'll have to capture those into variables, I think.
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Wed Jan 14, 2009 2:25 pm   
 
I should explain a bit. #Find cannot be limited to a list of rooms. It will always work on the entire map. So what you are asking for is some code that does the equivalent of #Find on a specific list of rooms.
Reply with quote
Odeon
Novice


Joined: 17 Nov 2008
Posts: 30

PostPosted: Wed Jan 14, 2009 4:20 pm   
 
Thanks Rahab So here are the infos required :

Rooms are like this : (Multi mud - english version)
http://forums.zuggsoft.com/forums/viewtopic.php?p=140427&highlight=#140427
zMUD General Discussion - Mapping - Room names, descriptions, ...

Mapping is based on triggers created by Fang Xianfu (cf post)

FLEE SUCCESSFUL

Code:

132H 100M 15V >e
You enter a dark hallway.

<(-------------------------------------------------------------------------)>
 <(                               The Vault                               )>
<(-------------------------------------------------------------------------)>

   You step into a giant vault. A blood-splattered carpet is on the floor and
black candles are burning on the wall. No dust is on the floor and on the
ceiling you see no spiderwebs. Only the air seems to be mustier than before.
Some bats are flying through the air.
[ Exits: N W ]
(Red Aura) A small fierce-looking bat is hanging from the ceiling, obviously sleeping.

[...]

59H 9M 36V nasty wounds >flee
<(-------------------------------------------------------------------------)>
 <(                               The Vault                               )>
<(-------------------------------------------------------------------------)>

   You step into a giant vault. A blood-splattered carpet is on the floor and
black candles are burning on the wall. No dust is on the floor and on the
ceiling you see no spiderwebs. Only the air seems to be mustier than before.
Some bats are flying through the air.
[ Exits: E S ]
You flee head over heels.
You lose 1477 points.


FLEE FAILED

Code:

74H 7M 39V pretty hurt >
You pound a cityguard of Aycethera hard.
A cityguard of Aycethera massacres you to small fragments with his hit.

53H 7M 39V pretty hurt >flee
PANIC!  You couldn't escape!

53H 7M 39V pretty hurt >
You pound a cityguard of Aycethera hard.
A cityguard of Aycethera misses a wild punch at you.


WIMPY

Code:

199H 431M 61V >e
<(-------------------------------------------------------------------------)>
 <(                            Door to Kingdom                            )>
<(-------------------------------------------------------------------------)>

Here the path turns to the west.  You can see a door in front of you,
and the path continues to the west and south.
[ Exits: S W ]
(Blue Aura) A dwarven mining worker is here.
(Blue Aura) A giant is wandering around the mountainside here.
(Blue Aura) A dwarven guard is here.
        ... he glows with a bright light!
(Blue Aura) A dwarven guard is here.
        ... he glows with a bright light!

[...]

56H 356M 60V nasty wounds >cast 'cause critical wounds'

Stand up and fight, COWARD!!!
The dwarf guard OBLITERATES you with his deadly slash!
You wish that your wounds would stop BLEEDING so much!
You wimp out, and attempt to flee!
You should try standing first, it makes easier to run away.
You manage to dodge the dwarf guard's slash and laugh, HA!
You wish that your wounds would stop BLEEDING so much!
You wimp out, and attempt to flee!
You should try standing first, it makes easier to run away.

25H 356M 60V nasty wounds >cast 'cure serious wounds'
You stop resting to finish what you've started!

25H 356M 60V nasty wounds >You pound the dwarf guard.
The dwarf guard cools you with the breeze of his missed slash at you.
You wish that your wounds would stop BLEEDING so much!
You wimp out, and attempt to flee!
<(-------------------------------------------------------------------------)>
 <(                              Guard House                              )>
<(-------------------------------------------------------------------------)>

You are in the guard house to the west of the entrance
to the castle.  There are nudie posters covering the walls.
[ Exits: E ]
You flee head over heels.
You lose 4084 points.
Upon who should the spell be cast?


(wimpy is a special case of flee)

What's strange with that mud is it shows the room and then informs you your "flee" was successful.
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Thu Jan 15, 2009 2:34 pm   
 
Excellent! You are already identifying and manually tagging the room name, description, and exits. That helps a lot. The first step is to edit those triggers to store the name, description, and exits into variables, as well as tag them for the mapper. For extra speed, set the variables to use default (which can be blank), so it won't bother trying to save the values to disk.

The fact that it tells you the flee was successful after displaying the new room is actually helpful! That means we can trigger off of that and use the variables for room name and exits right away. I'll poke at some code later today to see what I can come up with.
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Thu Jan 15, 2009 4:30 pm   
 
Here is what I've come up with. First, you have to modify the trigger Fang helped you with so that in addition to doing #tag, it will create variables containing the room name, description, and exit list. In the following code, I assume these are named @roomname, @roomdesc, and @roomexits. The following trigger does most of the work:
Code:
<trigger priority="1870" enabled="false" id="187">
  <pattern>You flee head over heels.</pattern>
  <value>#local $oldexits $exit $newroom $newexits
$oldexits = @pathtodirlist(%roomexit)
#while ($oldexits) {
  $exit = %pop($oldexits)
  #if (%ismember($exit, "n|ne|e|se|s|sw|w|nw|u|d")) {
    $newroom = %roomlink(, $exit)
  } {
    $newroom = %item(%roomportal(, $exit), 2)
  }
  #if ($newroom = -1) {$newroom = %roomnum}
  #if ($newroom != -2) {
    $newexits = %sort(@pathtodirlist(%roomexit($newroom)))
    $roomexits = %sort(%replace(%lower(@roomexits), " ", "|"))
    #if (%roomname($newroom) = @roomname AND %roomdesc($newroom) = @roomdesc AND $newexits = $roomexits) {
      #teleport $newroom
      #exit
    }
  }
}
#say "Cannot identify room you have fled to!  Correct your map location manually."
</value>
</trigger>

The code uses a function I wrote for myself a while back, @pathtodirlist(). This function takes a string list containing map directions and converts l/j/k/h to se/ne/sw/nw. It looks like your mud may not use the diagonal directions, so this might not be necessary.
Code:
<func name="pathtodirlist" id="48">
  <value>#local $newlist
#forall %1 {
  #switch (%i)
    ("l") {$newlist = %additem("se", $newlist)}
    ("j") {$newlist = %additem("ne", $newlist)}
    ("k") {$newlist = %additem("sw", $newlist)}
    ("h") {$newlist = %additem("nw", $newlist)}
    {$newlist = %additem(%i, $newlist)}
}
#return $newlist</value>
</func>

This code will work with non-compass exits. One possible issue would be hidden exits. If one of the possible flee rooms has an exit which is not visible but is marked in the map, the code will not identify it as a match. I haven't tested the trigger, but I based about half of it on my own code and I think the logic works.
Reply with quote
Odeon
Novice


Joined: 17 Nov 2008
Posts: 30

PostPosted: Thu Jan 15, 2009 6:37 pm   
 
Great! I'll take time to try as soon as possible Very Happy
I can even simplify it because in that mud there is no (ne,se,sw,nw), just plain directions n,w,s,e,u,d :)
Thanks a lot,
Odeon
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Thu Jan 15, 2009 9:35 pm   
 
If your mud doesn't use 'other' types of directions either (e.g. out, in, enter cave,...), it can be simplified even further. The section:
Code:
  #if (%ismember($exit, "n|ne|e|se|s|sw|w|nw|u|d")) {
    $newroom = %roomlink(, $exit)
  } {
    $newroom = %item(%roomportal(, $exit), 2)
  }

can be reduced to:
Code:
$newroom = %roomlink(, $exit)
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