i have set it as RandomMove cuz it was sudden NPC's lead and don't remember if there was a 'entering to N' type of line.
for the moment, im away from Avatar Mud.
instead, i have been trying to delete "
," (comma) and "
and" from matches[2] of Exits trigger.
target mud is The Two Towers MUD this time.
t2t mud has 2 mode for expression. verbose and brief.
default exits are "N W S E U D", enter, out and cardinal ways.
in verbose mode, room expression is like this. (no color separation in real screen)
This is the
main street of Bywater. To your north you see the rathermain
street of Bywater
run-down looking town hall. The main road also makes a turn to the east
and continues. To the west stands the Hobbiton courthouse.
The sun shines down from directly overhead.
A light wind blows from the southwest, and clouds form overhead.
The only obvious exits are
west,
south,
east and
north.
HP:50 EP:50>
in brief mode, (again, no color separation in real screen)
Bywater's main street(
w,
s,
e and
n)
A playful hobbit child
HP:50 EP:50>
as combined exits trigger, (usually im playing in brief mode. but when "look"ed, room text becomes to verbose temporarily.)
patterns(2):
\((.*)\) --for brief mode
^\s*The only obvious exits? (?:are|is) (.*)\. --for verbose mode
script(default=as is):
local exits = string.gsub(matches[2],"and","")
map.prompt.exits = exits
raiseEvent("onNewRoom")
default trigger gave me a hint, but string.gsub replaces only 1 strings. and this script is to delete "and" only.
so im getting a result of 'west
, south
, east north' (verbose) or 'w
, s
, e n' (brief)
there are
commas attached to west,south and w,s.
so, those are not recognized as exits.
additionally, there are so called "named direction" like "bar" or "counter" in the room. which has no exit and is just interactive like shop NPC but counted and shown in exits line/part.
so, i have no idea how should i do.
simplest way might be to limit to only conventional exits. but there should be a case when this could be a door with direction.
also, swim and boat seems to be separated way.
i have tried many things to make Exits trigger working like using string.find(failed/not fully understand) or just making a table to call from within string.gsub (currently working on).
my failing script
Exit:
Del = {}
table.insert(Del, "[color=#FF0000],[/color]")
table.insert(Del, "[color=#FF0000]and[/color]")
local exits = string.gsub(matches[2],DT,"")
map.prompt.exits = exits
raiseEvent("onNewRoom")
print(map.prompt.exits)
should i make a function instead ?
Room Name, Prompt and on Failed Move triggers seems to be working properly.
but there was a room of no-name in verbose mode.... im getting headache.
Room Name trigger
patterns(4 and verbose type are increasing):
^(.+)\( --for brief
^\s+This is the (.+)\. --for verbose
^\s+You now stand in the (.+)\. --for verbose
^\s+You are on the (.+)\. --for versose
script:
map.prompt.room = matches[2]
Prompt Trigger
pattern:
^HP\:\d+
script:
raiseEvent("onPrompt")
Failed Move Trigger
patterns(2):
You can't go that way! --exact matching
^The .+ is closed.
script:
raiseEvent("onMoveFail")
EDIT:
i found a way. simple stack of string.gsub did the job.
script became like this.
Exits Trigger(seems ok ?)
patterns(2):
\((.*)\) --for brief
^\s*The only obvious exits? (?:are|is) (.*)\. --for verbose
script:
s = string.gsub(matches[2],",","")
local exits = string.gsub(s,"and","")
map.prompt.exits = exits
raiseEvent("onNewRoom")
print(map.prompt.exits)
i could execute "start mapping <new area name>" command and mapper starts working at last.
but there are no exits drawn on room and strange thing is happening.
the echoes of exits are shown like this. (underline represents blank space. since its automatically cut here.)
north_east__south <<< between east and south, originally where "and" was put, has 2 blank spaces.
its same with brief type.
n_e__ s
seems there are still some mistakes in somewhere.