 |
shaun.murray Magician

Joined: 23 Jul 2005 Posts: 334 Location: Chicago
|
Posted: Mon May 26, 2008 9:17 pm
busting my head over this, it won't work... =[ |
Well... Ok, I have NO idea what the difference between these two settings are. When I run 'telgoran' things work like a champ! However... Any other area, and its not picking up the mobs for some reason. Here are the main parts. I can give you any more information ya need. Just ask. But for the life of me, I cannto figure out why telgoran works, and everything else doesn't. I've tried changing the id's to all be the same (only one area will be active at a time) but it won't let me make any changes in xml, and save them. =[ TIA!!
As you can see... The only difference is the area_<areaname> and the mobs that are saved therein. The triggers are exactly the same (well, short of whats stored in each variable) but... Like I stated, the area telgoran mobs are seen, but none of the other ones are seen. Very odd....
| Code: |
<class name="area_telgoran" enabled="false" id="285">
<alias name="resetmobs" id="286">
<value>#addkey mob_list {meditating=0|shaman=0|native=0|seasoned=0|guard=0|wary=0|cavalryman=0|reading=0|strong=0|zealous=0|worker=0|foreman=0|builder=0|woman=0|missionary=0|sleeping=0|instructor=0|builder=0}</value>
</alias>
<var name="gob_list" type="Record" id="287">female spirits smile at you and whisper to each other.=female|ancient spirits take you in with a glance.=old|spirits are cursed to walk this world forever.=tormented|servants still desire to serve Telgoran.=servant|priests traverse this plane, and others above.=priest</var>
<var name="sob_list" type="Record" id="288">A phantom wears the ragged remains of its worship robe.=tormented|As ancient as time itself, this spirit stares at your soul.=old|Somehow, this female spirit still holds the beauty of her past life.=female|This spirit was once a slave to the god of Telgoran.=servant|A spirit, in the form of a regal priest, no longer leads others to his god.=priest</var>
<var name="mob_list" type="Record" id="289">servant=0|servent=0|female=0|tormented=0|priest=0|old=3</var>
</class>
<class name="area_wlc" enabled="false" id="574">
<var name="sob_list" type="Record" id="576">This paladin sits quietly, completely enveloped in meditation.=meditating|This shaman is heavily painted and tattooed, he casts a spell showing the camp.=shaman|This native peers about the hills, looking for a sign of the enemy.=native|This seasoned warrior supervises the training of the newer paladins.=seasoned|This guard silently walks his post, patrolling the edges of the camp.=guard|Looking everywhere at once, this native quietly observes the camp.=wary|This cavalryman on a giant horse causes a small rumble with its hooves.=cavalryman|This soldier sits quietly in his tent, reading about spiritual enlightenment.=reading|This strong paladin practices his sword fighting form.=strong|This zealous warrior paces, furious with the natives at the camp.=zealous|This native quietly listens to the instructions of the foreman.=worker|This foreman roars instructions at the native workers.=foreman|This paladin points to the half built temple, giving instructions to workers.=builder|A native woman stalks through the hills, searching for food.=woman|This missionary is trying to spread their religion to the natives.=missionary|Just getting off shift, this soldier is laying in his cot, totally asleep.=sleeping|This combat instructor roars at his troops as they go through their paces.=instructor|This native is helping to build the new temple by carrying his load of stone.=builder</var>
<var name="gob_list" type="Record" id="577">natives are carrying building supplies to the temple site.=builder|foremen make the workers into a smoothly flowing machine.=foreman|strong paladins throw off sparks as they duel.=strong|missionaries travel among the natives trying to teach their religion.=missionary|soldiers are quietly reading and conversing about their religious beliefs.=reading|natives discuss with much fervor, the despicable traitorous natives.=zealous|guards are completely silent as their eyes rove across the scenery.=guard|cavalrymen cause a small earthquake with their horses.=cavalryman|seasoned warriors carefully inspect the fighters around them.=seasoned|shaman are quietly casting spells, attempting to thwart the invaders.=shaman|native women gather roots and berries.=woman|instructors give a class on sword fighting techniques.=instructor|builders pour over the building plans of the new temple.=builder|natives listen to the foreman, with complete bewilderment.=worker|native warriors move with the ease born through years of battle.=native|paladins sit with their legs crossed, completely deep in meditation.=meditating|natives are watchful for their zealous brothers.=wary</var>
<var name="mob_list" type="Record" id="578">strong=0|native=0|builder=0|cavalryman=0|seasoned=0|guard=0|sleeping=0|instructor=0|woman=0|meditating=0|shaman=0|reading=0|worker=0|wary=0|zealous=0|foreman=0|missionary=0</var>
<alias name="resetmobs" id="579">
<value>#addkey mob_list {meditating=0|shaman=0|native=0|seasoned=0|guard=0|wary=0|cavalryman=0|reading=0|strong=0|zealous=0|worker=0|foreman=0|builder=0|woman=0|missionary=0|sleeping=0|instructor=0|builder=0}</value>
</alias>
</class>
<class name="detect" id="49">
<trigger priority="500" trigontrig="false" id="50">
<pattern>~[ (%d) ~] ({@gob_list})</pattern>
<value>#addkey mob_list %db(@gob_list,%2) %1;#var bdetect 0</value>
</trigger>
<trigger priority="510" trigontrig="false" id="51">
<pattern>({@sob_list})</pattern>
<value>#addkey mob_list %db(@sob_list,%1) 1;#var bdetect 0</value>
</trigger>
</class> |
|
|
|
|
 |
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Tue May 27, 2008 2:23 pm |
When you are in area wlc, are you certain that area_wlc is enabled and area_telgoran is not??
|
|
|
|
 |
shaun.murray Magician

Joined: 23 Jul 2005 Posts: 334 Location: Chicago
|
Posted: Sat May 31, 2008 11:58 pm |
yip, i'm certain... for the life of me, i can't see what the issue is... this is really bugging me too... =[
|
|
|
|
 |
Zhiroc Adept
Joined: 04 Feb 2005 Posts: 246
|
Posted: Sun Jun 01, 2008 4:44 am |
Well, first, to be honest, I hadn't known that "{@var}" works like you think for db variables. It's not documented that I know of.
So I made a test, with a trigger on "^test: (@dbtest)" and an action of "#SH saw it %1 - %db(@dbtest, %1)"
It works if I put "aaa" in the variable as the key, but with no value. However, it doesn't match if there's a value.
If I put in the key/value "aaa=foo", it does work if I do "#SH test: aaa=foo". This makes sense, since if you do "#sh @dbtest", it shows "aaa=foo"
I tried it in zMUD, and didn't have a problem. It could be a bug, but then again, I don't know it was ever supposed to work.
It might make good sense, though, to use the keys of a db variable in this way in a pattern expresssion. |
|
|
|
 |
shaun.murray Magician

Joined: 23 Jul 2005 Posts: 334 Location: Chicago
|
Posted: Sun Jun 01, 2008 3:05 pm |
so... um, lol! do you think its a bug, in that using a db variable as the trigger? and its supposed to? or am i using the db variable as a trigger wrong? and its a bug cuz its working, kinda... that makes sense? tia!
|
|
|
|
 |
Toxic Adept
Joined: 27 May 2008 Posts: 299
|
Posted: Sun Jun 01, 2008 5:21 pm |
Try using ^({%%dbkeys(@dbvar)})$ as your pattern.
A rewrite of the entire code would be
| Code: |
<class name="area_telgoran" enabled="false" id="285">
<alias name="resetmobs" id="286">
<value>#addkey mob_list {meditating=0|shaman=0|native=0|seasoned=0|guard=0|wary=0|cavalryman=0|reading=0|strong=0|zealous=0|worker=0|foreman=0|builder=0|woman=0|missionary=0|sleeping=0|instructor=0|builder=0}</value>
</alias>
<var name="gob_list" type="Record" id="287">female spirits smile at you and whisper to each other.=female|ancient spirits take you in with a glance.=old|spirits are cursed to walk this world forever.=tormented|servants still desire to serve Telgoran.=servant|priests traverse this plane, and others above.=priest</var>
<var name="sob_list" type="Record" id="288">A phantom wears the ragged remains of its worship robe.=tormented|As ancient as time itself, this spirit stares at your soul.=old|Somehow, this female spirit still holds the beauty of her past life.=female|This spirit was once a slave to the god of Telgoran.=servant|A spirit, in the form of a regal priest, no longer leads others to his god.=priest</var>
<var name="mob_list" type="Record" id="289">servant=0|servent=0|female=0|tormented=0|priest=0|old=3</var>
</class>
<class name="area_wlc" enabled="false" id="574">
<var name="sob_list" type="Record" id="576">This paladin sits quietly, completely enveloped in meditation.=meditating|This shaman is heavily painted and tattooed, he casts a spell showing the camp.=shaman|This native peers about the hills, looking for a sign of the enemy.=native|This seasoned warrior supervises the training of the newer paladins.=seasoned|This guard silently walks his post, patrolling the edges of the camp.=guard|Looking everywhere at once, this native quietly observes the camp.=wary|This cavalryman on a giant horse causes a small rumble with its hooves.=cavalryman|This soldier sits quietly in his tent, reading about spiritual enlightenment.=reading|This strong paladin practices his sword fighting form.=strong|This zealous warrior paces, furious with the natives at the camp.=zealous|This native quietly listens to the instructions of the foreman.=worker|This foreman roars instructions at the native workers.=foreman|This paladin points to the half built temple, giving instructions to workers.=builder|A native woman stalks through the hills, searching for food.=woman|This missionary is trying to spread their religion to the natives.=missionary|Just getting off shift, this soldier is laying in his cot, totally asleep.=sleeping|This combat instructor roars at his troops as they go through their paces.=instructor|This native is helping to build the new temple by carrying his load of stone.=builder</var>
<var name="gob_list" type="Record" id="577">natives are carrying building supplies to the temple site.=builder|foremen make the workers into a smoothly flowing machine.=foreman|strong paladins throw off sparks as they duel.=strong|missionaries travel among the natives trying to teach their religion.=missionary|soldiers are quietly reading and conversing about their religious beliefs.=reading|natives discuss with much fervor, the despicable traitorous natives.=zealous|guards are completely silent as their eyes rove across the scenery.=guard|cavalrymen cause a small earthquake with their horses.=cavalryman|seasoned warriors carefully inspect the fighters around them.=seasoned|shaman are quietly casting spells, attempting to thwart the invaders.=shaman|native women gather roots and berries.=woman|instructors give a class on sword fighting techniques.=instructor|builders pour over the building plans of the new temple.=builder|natives listen to the foreman, with complete bewilderment.=worker|native warriors move with the ease born through years of battle.=native|paladins sit with their legs crossed, completely deep in meditation.=meditating|natives are watchful for their zealous brothers.=wary</var>
<var name="mob_list" type="Record" id="578">strong=0|native=0|builder=0|cavalryman=0|seasoned=0|guard=0|sleeping=0|instructor=0|woman=0|meditating=0|shaman=0|reading=0|worker=0|wary=0|zealous=0|foreman=0|missionary=0</var>
<alias name="resetmobs" id="579">
<value>#addkey mob_list {meditating=0|shaman=0|native=0|seasoned=0|guard=0|wary=0|cavalryman=0|reading=0|strong=0|zealous=0|worker=0|foreman=0|builder=0|woman=0|missionary=0|sleeping=0|instructor=0|builder=0}</value>
</alias>
</class>
<class name="detect" id="49">
<trigger priority="500" trigontrig="false" id="50">
<pattern>~[ (%d) ~] ({%%dbkeys(@gob_list)})</pattern>
<value>#addkey mob_list %db(@gob_list,%2) %1;#var bdetect 0</value>
</trigger>
<trigger priority="510" trigontrig="false" id="51">
<pattern>({%%dbkeys(@sob_list)})</pattern>
<value>#addkey mob_list %db(@sob_list,%1) 1;#var bdetect 0</value>
</trigger>
</class>
|
This should work, untested officially though. |
|
|
|
 |
Zhiroc Adept
Joined: 04 Feb 2005 Posts: 246
|
Posted: Sun Jun 01, 2008 6:23 pm |
I wasn't aware you could put an expression into a trigger pattern. Additionally, I wonder about performance, because it would seem that it would have to recompile the pattern for every line, unless it is smart enough to tell if the result hasn't changed. This is pretty difficult for expressions unless it has metadata about its dependencies.
|
|
|
|
 |
Vijilante SubAdmin

Joined: 18 Nov 2001 Posts: 5187
|
Posted: Sun Jun 01, 2008 9:26 pm |
You could use %dbkeys as Toxic suggested to force the contents of the variable to be interpretted as a record. If you just set the type of the variable to a record then the regular {@variable} should use the keys properly and automatically.
Zhiroc, yes you can use functions and some expressions like that. CMud does a 2 step compile process for the patterns. The first step is to examine the pattern for function and variable references. During this step variable dependencies are recorded. This step only has to be done once when the trigger is loaded, or if the trigger itself is changed. The next step interprets all the information compiled in the first step into the actual regex, this includes converting things like \a into a class of letters, as well as any other expansions and evaluations required. This second step gets done following the first step and when any of the noted variables changes. The full string produced by the second step is what gets put into the regex engine for the pattern. Because the entire first step is done before actual expansion and evaluation of the references only those variables that are directly referenced are noted as being important. |
|
_________________ The only good questions are the ones we have never answered before.
Search the Forums |
|
|
 |
Zhiroc Adept
Joined: 04 Feb 2005 Posts: 246
|
Posted: Sun Jun 01, 2008 11:35 pm |
I haven't checked the docs recently, but I don't remember this being in the old zMUD docs, so if its not in the CMUD doc explicitly, it should probably get added.
I guess the built-in functions are simple enough so that it can figure out variable dependencies. User-defined functions are trickier, though, as there could be variable reference buried into the definitions. However, one thing about DB variables is that they can often have their values updated rather than having keys added. The latter is the only thing that should need to have the pattern recompiled. I'd guess that using %dbkeys in a pattern would not be smart enough to consider this. If CMUD implicitly knew how to use a DB var in a pattern, it might be able to tell the difference between a key change, and a value change. |
|
|
|
 |
Anaristos Sorcerer
Joined: 17 Jul 2007 Posts: 821 Location: California
|
Posted: Mon Jun 02, 2008 12:16 am |
I don't see the point, Zhiroc. DB variables are structurally static as far as the compiler is concerned. The value is fetched each time by the compiled code, not substituted as a constant. Though, I've known compilers that have made that mistake during optimization. I am sure that if the DB variable changes, all code making reference to it is also recompiled. That is, if the variable gains or loses keys, then recompilation is necessary otherwise it is not. Of course, you could be right if it turns out that CMUD compiles each setting in a vacuum.
|
|
_________________ Sic itur ad astra. |
|
|
 |
Zhiroc Adept
Joined: 04 Feb 2005 Posts: 246
|
Posted: Mon Jun 02, 2008 4:05 am |
I'm just saying that you only need to recompile the pattern when keys are added or removed to a DB var. But often, DB variables are modified frequently, where only the values of existing keys are updated, though no keys are added or removed. While the above example doesn't do it, perhaps the idea is to count how many mobs of a given type are seen. So, you might trigger on keys, like "orc", then increment the value of that key. This will force a useless recompilation of the pattern, as the variable has changed, but the result of %dbkeys hasn't.
Unless, of course, the compiler can "know" that %dbkeys only changes when keys change. |
|
|
|
 |
Zhiroc Adept
Joined: 04 Feb 2005 Posts: 246
|
Posted: Wed Jun 11, 2008 1:53 pm |
I never saw Zugg give a thumbs up or down on this as a bug (since zMUD handles it fine) or as an unsupported feature, so I thought I'd bump it.
|
|
|
|
 |
Zugg MASTER

Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Wed Jun 11, 2008 6:40 pm |
There is no way to change this in CMUD, sorry. Whenever you change any part of a database variable, any trigger pattern that depends upon it is going to get recompiled. CMUD can't tell the difference between just a value changing vs the key changing. The compiler isn't smart enough for that, sorry.
|
|
|
|
 |
Arminas Wizard
Joined: 11 Jul 2002 Posts: 1265 Location: USA
|
Posted: Wed Jun 11, 2008 11:54 pm |
You could create a function for adding new creatures to your database variable. This function could then also add a creature to a string list.
Then use the string list in your trigger instead of using %dbkeys. Yes you would have two variables where you would have had just one, but in this case it appears to be worth it. |
|
_________________ Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram |
|
|
 |
shaun.murray Magician

Joined: 23 Jul 2005 Posts: 334 Location: Chicago
|
Posted: Thu Jun 12, 2008 3:34 am |
well, I've pretty much abandoned triggering off of the variables, and have switched to individual triggers for each mob. I think that in the long run, it will give me a bit more control over enabling triggers for certain mobs, and specify a different lead attack for specific mobs. that and using ^ and $ will give me more solid triggers. I think that I've almost got the core perfected. I'm prolly going to post the just of how I'm accomplishing this whole ordeal. Only thing that I need to iron out is when I get aggro'd and trying to move to the next room, and fixing that dibacle. =)
thanks for everyone's help in all this... and my ramblings... |
|
|
|
 |
Zhiroc Adept
Joined: 04 Feb 2005 Posts: 246
|
Posted: Thu Jun 12, 2008 3:56 am |
It wasn't the performance that was the major question about being a possible bug:
In zMUD, if you put a db variable into a pattern, only the keys are used
In CMUD, if you do the same, the whole "key=value" string is used |
|
|
|
 |
Toxic Adept
Joined: 27 May 2008 Posts: 299
|
Posted: Thu Jun 12, 2008 12:56 pm |
I believe it was explained Zhiroc that it would work if you make sure the variable type is set to record, instead of string list.
|
|
|
|
 |
|
|
|
|
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
|
|