|
masterkrueger Wanderer
Joined: 24 Jan 2010 Posts: 65 Location: Hamburg
|
Posted: Tue Jun 22, 2010 8:29 pm
Delay an alias to fire after trigger |
Hi @All,
is it possible to delay an alias if a trigger is set on the same event?
Explanation: I use "ll" as an alias to look and want to set a complete
roomreload with it but i need the info from a trigger that is collection
and defining roomdata with the "ll" commandinput.
I tried #WAIT but i think it only fires after the ali is completed because i
got empy return vars in the ali and filled ones afterwards.
Thanks |
|
|
|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Tue Jun 22, 2010 8:34 pm |
Could you describe in a bit more detail what you want? I don't think I'm quite clear on it.
What I _think_ you are saying is you have a script, which does some stuff, and causes some thing to happen which should fire a trigger. You want this script to pause until after the trigger has executed, and then continue. Is that correct? If that is the case, there are several options, but you will have to give us a lot more detail on exactly what the script is doing, what is coming from the mud, and what the trigger is doing with it. |
|
|
|
masterkrueger Wanderer
Joined: 24 Jan 2010 Posts: 65 Location: Hamburg
|
Posted: Wed Jun 23, 2010 11:00 am |
What i mean is, i have an ALIAS and a TRIGGER both fiering on the same text.
My problem is, the trigger must fire before the alias.
Hope it is clearer now? :)
Thanks |
|
|
|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Wed Jun 23, 2010 1:15 pm |
It is clearer, but I don't see how an _alias_ can be firing on text. Unless you mean that the trigger is an oninput trigger, and the input it is firing on is also an alias. Which is a bit odd, but concievable.
If that is the case, all you have to do is make sure that the trigger has a lower priority number than the alias. If it is not the case, I'm afraid you'll have to explain how an alias and a trigger are firing on the same text. A specific example might be the best help. |
|
|
|
masterkrueger Wanderer
Joined: 24 Jan 2010 Posts: 65 Location: Hamburg
|
Posted: Wed Jun 23, 2010 3:30 pm |
Yep it's a bit weird :) but thats what i am doing hehe ;)
Ok change priority, sounds easy. Ill try and write my results here.
Thanks!! |
|
|
|
chamenas Wizard
Joined: 26 Mar 2008 Posts: 1547
|
Posted: Thu Jun 24, 2010 12:55 am |
Confused. Why not just have what the alias does be in the trigger and come after the first part? Why are they separate to begin with? If you share the script we can help a bit more.
|
|
|
|
masterkrueger Wanderer
Joined: 24 Jan 2010 Posts: 65 Location: Hamburg
|
Posted: Thu Jun 24, 2010 5:59 pm |
Ok, i'll share it :) the first part (the trigger) get's the room infos and the alias is to rewrite rooms that exists.
maybe i can share the complete package? but simple first:
Code: |
<trigger name="CaptureRoomInfo" type="Command Input" priority="8060" newline="false" prompt="true" id="871">
<pattern>^{@MoveKeywords}$</pattern>
<value>#IF (@Debug) {#PRINT {Start }}
RName = "" //optional
RDesc = "" //required
RExits = "" //optional
RObjects = "" //optional
RDBObjects = "" //optional
RCounter = 0 //debug
MoreExits = 0 //flag
//#IF (@Debug) {#PRINT { RName:@RName %CR RDesc:@RDesc %CR RExits:@RExits %CR RObjects:@RObjects}}
</value>
<notes>Trigger any movement</notes>
<trigger name="RoomDesc" type="Manual" param="25">
<pattern>^(*)$</pattern>
<value>#IF ((%pos("Ausgang: ",%1)) OR (%pos("Ausgaenge: ",%1)) OR (%pos("Richtung: ",%1)) OR {@MoreExits}) {
//first match to find multiline exits
#IF (@MoreExits) {
RExits = %concat(@RExits,%1)
#IF (@Debug) {#PRINT {MoreExits found: @RExits complete!}}
#STATE CaptureRoomInfo 2
} {
#IF (%match(%1,"Ausg??ng?:*.") OR %match(%1,"Richtung:*.")) {
//one exit line
#CALL %match(%1,"Ausg??ng?:(*)",RExits)
#CALL %match(%1,"Richtung:(*)",RExits)
#IF (@Debug) {#PRINT {Exits found: @RExits complete!}}
#STATE CaptureRoomInfo 2
} {
//two exit lines
#CALL %match(%1,"Ausg??ng?:(*)",RExits)
#CALL %match(%1,"Richtung:(*)",RExits)
#IF (@Debug) {#PRINT {more exits! @RExits}}
MoreExits = 1
#STATE CaptureRoomInfo 1
}
}
} {
//adding roomcontent
#IF (@NoDirFired) {
#IF (@Debug) {#PRINT {NoDirFired!}}
NoDirFired = 0
#STATE CaptureRoomInfo 0
} {
#ADD RCounter 1
RDesc = %concat(@RDesc,%1"|")
#IF (@Debug) {#PRINT {Desc @RCounter}}
}
}</value>
<notes>collect data</notes>
</trigger>
<trigger name="StopCapture" type="Manual" param="25" prompt="true">
<pattern>^(*)</pattern>
<value>#IF (%begins(%1,"> ")) {
RName = %item(@RDesc, 1)
//apply #TAG
#TAG name @RName
#TAG desc %expandlist(@RDesc,%cr)
RExits = %replace(@RExits,"und","|")
RExits = %replace(@RExits,",","|")
RExits = %replace(@RExits,".","")
RExits = %replace(@RExits," ","")
#TAG exit @RExits
#TAG prompt %1
#STATE CaptureRoomInfo 0
} {
//Object_Handling
#ADDITEM RObjects %trim(%1)
#IF (@Debug) {#PRINT {Object(s): %expandlist(@RObjects," ") Count:%numitems(@RObjects)}}
}</value>
<notes>#TAG data</notes>
</trigger>
</trigger>
|
then there is the onRoomCreate-Event that inserts the found items into the database:
Code: |
<event event="onRoomCreate" priority="8870" id="887">
<value>#IF (@Debug) {#PRINT Created Room:%roomnum();#IF (%null(@RObjects)) {#PRINT {adding -nothing-}} {#PRINT {processing @RObjects}}}
//Add Items to Database
#DBLOAD Items
#FORALL @RObjects {
#IF (%null(%find(%i, Items))) {
#IF (@Debug) {#PRINT {Item %i not found!}}
#NEW Items %i
#DBSAVE
#IF (@Debug) {#PRINT {Adding Item %i}}
} {
#IF (@Debug) {#PRINT {Item %i already exists}}
}
#ADDITEM RDBObjects %find(%i, Items)
}
//Add Items to RoomContent
#CALL %roomcontents( , @RDBObjects)</value>
</event>
|
the function i extracted to use it in the alias and the trigger:
Code: |
<func name="FindCurrentLocation" id="932">
<value>//Get first Sentence till .!? appears
#FIND
RNameConcat = %left(@RName, %match(@RName, "[.!?]")-1)
#IF (%null(@RNameConcat)) {RNameConcat = @RName}
#IF (@Debug) {#PRINT {Searching for room: <@RNameConcat>}}
RNameConcat = {'%@RNameConcat%'}
RLocation = %mapquery("[Name] LIKE " @RNameConcat)
#IF (@Debug) {#PRINT {Found location: @RLocation}}
#LOCATION JasonSteel @RLocation BLUE</value>
</func>
|
and at last the alias which i mentioned in my first post :)
Code: |
<alias name="ll" autoappend="true" id="680">
<value>RCurrentLocation = %roomkey()
//@FindCurrentLocation()
#FIND
#PRINT {Name: @RName}
#PRINT {Desc: @RDesc}
#PRINT {Obj : @RObjects}
#CALL %maplocked(0)
#LOCATION JasonSteel @RCurrentLocation BLUE
#CALL %roomname(, @RName)
#CALL %roomdesc(, %expandlist(@RDesc,%cr))
#CALL %roomexit(, @RExits)
#RAISEEVENT onRoomCreate
#CALL %maplocked(1)
</value>
<notes>Find location on map</notes>
</alias>
|
I don't post all the other variables, they exist and work ;)
You said i can set the priority of the alias higher than the prio of the trigger,
the problem is, i don't see a priority-flag at the alias?! |
|
|
|
chamenas Wizard
Joined: 26 Mar 2008 Posts: 1547
|
Posted: Thu Jun 24, 2010 6:32 pm |
Actually, the explanation was bit better this time and that alone may help. Unfortunately I have some network issues on my Desktop to fix and a house to clean. I'll come take a look at this later if Rahab hasn't already solved this mystery for you.
|
|
|
|
masterkrueger Wanderer
Joined: 24 Jan 2010 Posts: 65 Location: Hamburg
|
Posted: Thu Jun 24, 2010 6:44 pm |
I think this is a bit too much code and maybe its not all selfexplanational.
If you WANT to look at it, give it a try, otherwise ill build a workaround which
disables the trigger and reactivates it.
I know its my biggest coding project in CMUD for now and there are many glitches and edges
where i could improve my code. The debugging info messes the whole thing up, sorry that i did not
give you clean code to look at, so if you dont wanna puzzle, play mud and dont waste your time
on this. I thought it would be an easy thing :) |
|
|
|
masterkrueger Wanderer
Joined: 24 Jan 2010 Posts: 65 Location: Hamburg
|
Posted: Thu Jun 24, 2010 7:47 pm |
In the end, the problem when fires what is not the real problem ;)
I recognized that i tried to build a workaround for a workaround.
Because my mud did not like the automapper, i had to fetch all info by myself.
This part works now Yehaaaaa :) but the whole thing only works if it is a complete new room.
I used my old map with currently 5000 rooms and i dont wanted to delete one room and reenter it
(but maybe i can write a script for that...) anyway i wanted to "mark time" (i dont know what its called in englisch but i mean i stay in the same room and trigger the walk command).
I even called the onRoomCreate event but i only get empty variables and then the script put these info in the room :(
maybe i should really write a script that deletes the room in the direction i am walking in and recreates it?
the part with disabling the trigger first when the alias starts and then opening the alias again did not work, i dont know why the variables are filles after the first run and the trigger should be disabled, i can see it in the editor but after the second run the variables are empty again :(
the script works if i disable the trigger manually after the first run?!
Ok too much text and maybe too bad englisch ;) sorry for that |
|
|
|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Fri Jun 25, 2010 12:39 am |
To fix the rooms that already exist, I suggest writing a script that loops through all the rooms and does the changes you want. Use the %mapquery() function to create a list of all the room numbers, #forall to loop through them, and %roomXXX() functions to grab and modify the stuff you want. Once it's all done, you won't have to worry about it again.
|
|
|
|
masterkrueger Wanderer
Joined: 24 Jan 2010 Posts: 65 Location: Hamburg
|
Posted: Sat Jun 26, 2010 8:39 am |
that would be the best thing to do really. But if i loop through the rooms i have the same problem. i don't know to use my current #TAG model to get to work because the whole script works linear.
1. movecommand recognized
2. grabbing each row for markers like exits etc.
3. putting all info in the rooms
4. adding all items to the database !!!
(and thats the difficult part, because i hab problems that items got added twice
or have been taken over to the next room...)
Ok, ill work on it :) i know i can make it ;)) |
|
|
|
masterkrueger Wanderer
Joined: 24 Jan 2010 Posts: 65 Location: Hamburg
|
Posted: Sat Jun 26, 2010 11:07 am |
And btw. the information i recorded earlyer in the map is "incorrect".
All informations are in the description hmm looping through the map
is'nt really entering the real room and collection the new data.
I really need to rewrite the roominfo if i am standing in the current room. |
|
|
|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Sun Jun 27, 2010 6:35 pm |
Ah, if you can't simply loop through the rooms to fix the problem, then yeah, you'll need to reload room descriptions one by one, by visiting each one.
If the problem is that you need to reload the room description, why aren't you simply using the #LOOK command? Then you don't have to write any script at all. |
|
|
|
masterkrueger Wanderer
Joined: 24 Jan 2010 Posts: 65 Location: Hamburg
|
Posted: Mon Jun 28, 2010 9:37 am |
The #LOOK command does not work. I think it results in the selfmade automapper-scripts?
#FIND did not work too and the first problem all began with was the automapper that did not
recognize roomnames.
:) |
|
|
|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Mon Jun 28, 2010 5:58 pm |
Well, then the problem is to get #LOOK to work. If #LOOK doesn't work, then #FIND won't work either, because it's based on exactly the same things. Exactly what is the problem with #LOOK? Can you post a few examples of the mud output for the rooms?
|
|
|
|
masterkrueger Wanderer
Joined: 24 Jan 2010 Posts: 65 Location: Hamburg
|
Posted: Mon Jun 28, 2010 7:19 pm |
If i use the #LOOK command the script debugger shows this:
Code: |
0.0018 | c MorgenGr | [1] MorgenGrauen.mud Comline : start :
0.0019 | d MorgenGr | [1] MorgenGrauen.mud Comline : stopped
0.0000 | |
and the #FIND this:
Code: |
0.0023 | c MorgenGr | [1] MorgenGrauen.mud Comline : start :
0.0022 | ---
0.0020 | a MorgenGr |schaue
0.0016 | h MorgenGr |<ESC>[2Sschaue<ESC>[0m
0.0029 | i MorgenGr >schaue<CR><LF>
0.0023 | d MorgenGr | [1] MorgenGrauen.mud Comline : stopped
0.0271 | i MorgenGr <Du bist nun in der Eingangshalle der Gefaengnisinsel. Dunkle, kalte Waende<CR><LF>
0.0000 | ragen um Dich herum empor. Hinter einer Glasscheibe sitzt eine Wache. Durch<CR><LF>
0.0000 | das Tor im Norden kannst Du diesen trostlosen Ort wieder verlassen.<CR><LF>
0.0000 | Es gibt drei sichtbare Ausgaenge: suedosten, suedwesten und norden.<CR><LF>
0.0000 | Eine Wache. <CR><LF>
0.0095 | a MorgenGr |Du bist nun in der Eingangshalle der Gefaengnisinsel. Dunkle, kalte Waende
0.0125 | a MorgenGr |ragen um Dich herum empor. Hinter einer Glasscheibe sitzt eine Wache. Durch
0.0111 | a MorgenGr |das Tor im Norden kannst Du diesen trostlosen Ort wieder verlassen.
0.0093 | a MorgenGr |Es gibt drei sichtbare Ausgaenge: suedosten, suedwesten und norden.
0.0100 | f MorgenGr | Pattern: %q{@moveshortkeywords}
0.0018 | c MorgenGr | exec : Pattern "ColoredExits" : #CW white
0.0015 | n MorgenGr | Exec Trigger "ColoredExits"
0.0014 | g MorgenGr =Es gibt drei sichtbare Ausgaenge: [57msuedosten[0m, [57msuedwesten[0m und [57mnorden[0m.
0.0029 | a MorgenGr |Eine Wache.
0.1662 | i MorgenGr <> <IAC><EOR>
0.0021 | a MorgenGr ]>
0.0000 | | | |
"schaue" is my look in german and the room is displayed correctly.
But as i said, nothing worked for me autodetecting the mapper settings :(
#FIND did not position me on the map either.
I rewrited nearly everything for the mapper on my own (with all you help in here :) |
|
|
|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Tue Jun 29, 2010 1:03 am |
When you rewrite stuff for the mapper, the goal should be to make #LOOK work. If #LOOK isn't working, then almost none of the mapper functions dependent on room names and descriptions will work.
One thing I can already see that you need is a customized set of Directions. The default English Directions and English Keypad packages obviously won't work for you. Making a new custom German Directions package should be one of the first things you do, if you haven't aready. Then we can look at your #TAG triggers and see if we can get the #LOOK to work. |
|
|
|
masterkrueger Wanderer
Joined: 24 Jan 2010 Posts: 65 Location: Hamburg
|
Posted: Tue Jun 29, 2010 5:30 pm |
Hi Rahab, if you really wanna go through all this with me to fix it here we go :) where should we start.
I have inserted my german directions and disabled the englisch ones. Is it possible to send you the complete
Package instead of posting every single script? Maybe its easier to look at the complete system.
btw. it all started with this post after switching from zMUD to CMUD ;)
http://forums.zuggsoft.com/forums/viewtopic.php?t=35098
and i must tell you that i found a way to update my roominfo using 3 different scripts
1. load the current room info line by line into variables
2. lock my position on the map
3. insert infos into room
but I was'nt able to put all parts together to one script because the position on the map got lost and I ended up in
room 0 everytime. But if you say the LOOK command should work otherwise ill get into much more trouble.
Maybe you can make something out :D |
|
|
|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Wed Jun 30, 2010 12:29 pm |
Basically, that whole thread was trying to help you get the #LOOK to work. The #TAG command helps the mapper figure out what the exits, room name, and description are when creating new rooms. #LOOK is simply a command to tell the mapper to regenerate the room name, description, and exits. So if #LOOK isn't working, then your work is not finished. Unless you are trying to do something else with it, your goal should not be to get the room information into a database, but to get the mapper to recognize it.
Have you solved the problem a crlf in the middle of your exits?
I'll take a closer look to see your code today. |
|
|
|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Wed Jun 30, 2010 4:51 pm |
Can you post the actual text from a few room descriptions, so I can test your code? Be sure to include the prompt at the beginning and end.
|
|
|
|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Wed Jun 30, 2010 5:12 pm |
Oh, here's another question. After you wrote your triggers that used the #TAG commands, did you reconfigure the mapper? If you change any code that would affect how the mapper recognizes rooms, you need to reconfigure the mapper so that it knows about the changes.
|
|
|
|
masterkrueger Wanderer
Joined: 24 Jan 2010 Posts: 65 Location: Hamburg
|
Posted: Fri Jul 02, 2010 8:43 pm |
Hi sorry for my late answer, but i had to work :(
Ok here are some rooms ;) (btw. i reconfigured after every change)
Quote: |
Du bist nun in der Eingangshalle der Gefaengnisinsel. Dunkle, kalte Waende
ragen um Dich herum empor. Hinter einer Glasscheibe sitzt eine Wache. Durch
das Tor im Norden kannst Du diesen trostlosen Ort wieder verlassen.
Es gibt drei sichtbare Ausgaenge: suedosten, suedwesten und norden.
Eine Wache. |
Quote: |
Du befindest dich in dem Bereich, wo die im Wald gefaellten Baeume gelagert
werden, bevor sie verschifft werden. Die Baeume sind hier zu Stapeln
aufgetuermt worden, die so hoch sind, dass Du nicht ueber sie hinwegsehen
kannst. Zwischen den Stapelreihen ist immer ein, wenn auch nicht besonders
breiter Weg gelassen worden, damit man sich auch zwischen den Stapeln bewegen
kann. Im Osten kannst Du den freien Platz zwischen Anleger und Lager erkennen.
Nach Westen und Sueden kannst Du zwischen den Stapeln weiter durch das
Holzlager gehen.
Es gibt drei sichtbare Ausgaenge: osten, sueden und westen.
Ein Holzfaeller.
Ein Holzfaeller.
Ein Holzfaeller. |
Quote: |
Du befindest dich auf einem kleinen Platz vor dem Holzfaellerlager, welches
sich im Suedosten befindet.Im Westen befindet sich ein recht grosser Platz,
auf dem Unmengen an Baumstaemmen gelagert werden. Im Norden befindet sich
scheinbar der Anleger, von dem aus die Baumstaemme verschifft werden. Im
Nordosten und Nordwesten kannst du ueber einen kleinen Weg zu einem Sandstrand
gelangen.
Es gibt fuenf sichtbare Ausgaenge: westen, norden, nordosten, suedosten und
nordwesten.
|
Ok that should be enough, with more items and one with two exit lines :)
And please help me only if you have fun and enough time ok :)) i can play with my current
config, exept of the #look command.
But thank you very much for helping me!!! |
|
|
|
|
|