|
ralgith Sorcerer
Joined: 13 Jan 2006 Posts: 715
|
Posted: Tue Nov 11, 2008 5:57 pm
Looking to improve upon my scan trigger... |
I have a scan trigger, and I'm wanting to improve it. Right now it works as it is, however it isn't the best way. I'm just not sure HOW to improve it. The trigger is to scan nearby rooms for the purposes of ranged combat.
Here is the what I have now:
Code: |
#CLASS {Scan}
#VAR odd {to|the|a|an|Carlisle|Pirate|Swab|Tramp|Dog|Parrot|Male|Female|Guardian|First|Second|Third|Fourth|Fifth|Sixth|Seventh|Eighth|Ninth|Feriankian|Dug|Aldov}
#VAR preference {warrior|soul|ghost|angel}
#VAR mobname {lava}
#VAR direction {north}
#TRIGGER {to the (%w).} {#var direction %lower( %1)}
#TRIGGER {You see (%w) (%w)} {
#IF (%ismember( %2, @odd)) {
#var mobname %1
#ABORT 1
}
#IF (%ismember( %1, @odd)) {
#var mobname %2
#ABORT 1
}
}
#TRIGGER {You see (%w), (%w) (%w)} {#var mobname %3}
#KEY ` {scan}
#KEY CTRL-` {gt f @mobname @direction}
#CLASS 0 |
What I want:
1. Ignore anything in the odd variable unless there is nothing else to choose.
2. Choose keywords present in the preference variable, in order of preference. The earlier it appears in the var the higher preference it has. So if two arguments are in pref, and arg3 appears in the var before arg2, I want it to choose arg3.
3. I would prefer it to be a single trigger instead of the multiple I have, and be smarter about reading the lines.
4. I want it to ignore any mobs that are "stationary" and be able to build a database of stationary mobs. For instance: Dwarven stair guard of Mar Nadrak
5. If there ONLY stationary mobs in a direction, to completely ignore that direction as well.
6. Assign a list of mobs, and their direction, which automatically knocks itself off after each kill. This way I don't have to rescan between kills.
7. Ignore case of words in the scanned names (make all words all lowercase).
8. Feel free to make suggestions for other improvements.
Here are sample scans from the MUD showing multiple mob and single mob outputs
You scan the area.
You see the Lair baln to the north.
You see the Foawr and the Bean Sidhe to the east.
You scan the area.
You see Elite Guard of Hrak and Female Nadrakian Dwarf to the east.
You see Dwarven stair guard of Mar Nadrak, Dwarven stair guard of Mar Nadrak, Dwarven stair guard of Mar Nadrak, Dwarven stair guard of Mar Nadrak, Dwarven stair guard of Mar Nadrak, Dwarven stair guard of Mar Nadrak, Dwarven stair guard of Mar Nadrak, Dwarven stair guard of Mar Nadrak, Dwarven stair guard of Mar Nadrak, Dwarven stair guard of Mar Nadrak, Dwarven stair guard of Mar Nadrak, Dwarven stair guard of Mar Nadrak, Dwarven stair guard of Mar Nadrak, Dwarven stair guard of Mar Nadrak and Dwarven stair guard of Mar Nadrak to the west.
You scan the area.
You see Aldov lava troll warrior to the north.
You see Dug demon warrior, Dug devil warrior, Feriankian demon warrior, Dug demon warrior and Feriankian lava troll warrior to the east.
You see Aldov devil warrior and Dug devil warrior to the south.
You see Feriankian lava troll warrior, Feriankian devil warrior, Aldov demon warrior, Dug demon warrior and Feriankian devil warrior to the west.
You scan the area.
You see the Clan Training Dummy to the west.
You see Ashley to the down. |
|
_________________ CrossOver: Windows Compatibility on Mac and Linux CMUD Advocate |
|
|
|
ralgith Sorcerer
Joined: 13 Jan 2006 Posts: 715
|
Posted: Wed Nov 12, 2008 6:00 pm |
Hmm, so no ideas..?
Fang?
Vij?
:P
Hell, and I thought you guys were the best script writers out there (teasing, I have a lot of respect for the skill you both show) |
|
_________________ CrossOver: Windows Compatibility on Mac and Linux CMUD Advocate |
|
|
|
Tech GURU
Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: Thu Nov 13, 2008 9:31 am |
Give it time young Padawan... it's my to-do list, if I can ever find the time.
I would do it now (but I really should be sleeping) |
|
_________________ Asati di tempari! |
|
|
|
ralgith Sorcerer
Joined: 13 Jan 2006 Posts: 715
|
Posted: Thu Nov 13, 2008 4:47 pm |
<--- Impatient ;)
Ok, I'll show a little more patience. Thanks though Tech. |
|
_________________ CrossOver: Windows Compatibility on Mac and Linux CMUD Advocate |
|
|
|
Tech GURU
Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: Mon Dec 15, 2008 5:29 am |
Ok... so this toook really long. I did it twice and both times lost power before I'd finished it all, then I forgot which post it was for.
I finally came across what I recovered. It may have some gaps in it, but it should be a fairly decent starting point.
Code: |
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
<class name="Scan" copy="yes">
<var name="odd" type="StringList" copy="yes">to|the|a|an|Carlisle|Pirate|Swab|Tramp|Dog|Parrot|Male|Female|Guardian|First|Second|Third|Fourth|Fifth|Sixth|Seventh|Eighth|Ninth|Feriankian|Dug|Aldov</var>
<var name="preference" type="StringList" copy="yes">warrior|soul|ghost|angel</var>
<var name="mobname" copy="yes">lava troll warrior</var>
<var name="direction" copy="yes">west</var>
<trigger priority="60" copy="yes">
<pattern>to the (%w).</pattern>
<value>#var direction %lower( %1)</value>
</trigger>
<trigger priority="70" copy="yes">
<pattern>You see (%w) (%w)</pattern>
<value>#IF (%ismember( %2, @odd)) {
#var mobname %1
#ABORT 1
}
#IF (%ismember( %1, @odd)) {
#var mobname %2
#ABORT 1
}</value>
</trigger>
<trigger priority="80" copy="yes">
<pattern>You see (%w), (%w) (%w)</pattern>
<value>#var mobname %3
called b</value>
</trigger>
<macro key="`" copy="yes">
<value>scan</value>
</macro>
<macro key="CTRL-`" copy="yes">
<value>gt f @mobname @direction</value>
</macro>
<var name="testData" copy="yes">You scan the area.
You see the Lair baln to the north.
You see the Foawr and the Bean Sidhe to the east.
You scan the area.
You see Elite Guard of Hrak and Female Nadrakian Dwarf to the east.
You see Dwarven stair guard of Mar Nadrak, Dwarven stair guard of Mar Nadrak, Dwarven stair guard of Mar Nadrak, Dwarven stair guard of Mar Nadrak, Dwarven stair guard of Mar Nadrak, Dwarven stair guard of Mar Nadrak, Dwarven stair guard of Mar Nadrak, Dwarven stair guard of Mar Nadrak, Dwarven stair guard of Mar Nadrak, Dwarven stair guard of Mar Nadrak, Dwarven stair guard of Mar Nadrak, Dwarven stair guard of Mar Nadrak, Dwarven stair guard of Mar Nadrak, Dwarven stair guard of Mar Nadrak and Dwarven stair guard of Mar Nadrak to the west.
You scan the area.
You see Aldov lava troll warrior to the north.
You see Dug demon warrior, Dug devil warrior, Feriankian demon warrior, Dug demon warrior and Feriankian lava troll warrior to the east.
You see Aldov devil warrior and Dug devil warrior to the south.
You see Feriankian lava troll warrior, Feriankian devil warrior, Aldov demon warrior, Dug demon warrior and Feriankian devil warrior to the west.
You scan the area.
You see the Clan Training Dummy to the west.
You see Ashley to the down.</var>
<var name="t1" copy="yes">You scan the area.
You see the Lair baln to the north.
You see the Foawr and the Bean Sidhe to the east.
</var>
<var name="t2" copy="yes">You scan the area.
You see Elite Guard of Hrak and Female Nadrakian Dwarf to the east.
You see Dwarven stair guard of Mar Nadrak, Dwarven stair guard of Mar Nadrak, Dwarven stair guard of Mar Nadrak, Dwarven stair guard of Mar Nadrak, Dwarven stair guard of Mar Nadrak, Dwarven stair guard of Mar Nadrak, Dwarven stair guard of Mar Nadrak, Dwarven stair guard of Mar Nadrak, Dwarven stair guard of Mar Nadrak, Dwarven stair guard of Mar Nadrak, Dwarven stair guard of Mar Nadrak, Dwarven stair guard of Mar Nadrak, Dwarven stair guard of Mar Nadrak, Dwarven stair guard of Mar Nadrak and Dwarven stair guard of Mar Nadrak to the west.
</var>
<var name="t3" copy="yes">You scan the area.
You see Aldov lava troll warrior to the north.
You see Dug demon warrior, Dug devil warrior, Feriankian demon warrior, Dug demon warrior and Feriankian lava troll warrior to the east.
You see Aldov devil warrior and Dug devil warrior to the south.
You see Feriankian lava troll warrior, Feriankian devil warrior, Aldov demon warrior, Dug demon warrior and Feriankian devil warrior to the west.</var>
<var name="t4" copy="yes">You scan the area.
You see the Clan Training Dummy to the west.
You see Ashley to the down.</var>
<trigger priority="160" copy="yes">
<pattern>You see (%w*) to the (%w).</pattern>
<value>// #echo matched %1 -- %2
//#local $list
$list={%replace(%1, " and ", "|")}
$list={%replace($list, ", ", "|")}
//#echo %numitems($list)
//#echo several building list
$db={}
#FORALL $list
{
#IF (%db($db,%i)) {
$db.%i = (%db($db,%i) + 1)
} {
#ADDKEY $db %i 1
}
}
//#SHOWDB $db
$firstMob = %dbkeys($db)
$Mobs = %dbkeys($db)
$firstMob = %pop($Mobs)
$firstMob = %trim(%subregex($firstMob, %concat("\b(",@odd,")\b")),"")
#VAR mobName $firstMob
#var direction %lower( %2)</value>
</trigger>
</class>
</cmud> |
|
|
_________________ Asati di tempari! |
|
|
|
charneus Wizard
Joined: 19 Jun 2005 Posts: 1876 Location: California
|
Posted: Mon Dec 15, 2008 6:20 am |
Only problem, Tech, is that ralgith is using zMUD, not CMUD... :P
Charneus |
|
|
|
ralgith Sorcerer
Joined: 13 Jan 2006 Posts: 715
|
Posted: Mon Dec 15, 2008 1:58 pm |
Ah yes, but it shouldn't be too hard to backdate. :D
Thanks Tech. |
|
_________________ CrossOver: Windows Compatibility on Mac and Linux CMUD Advocate |
|
|
|
Tech GURU
Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: Mon Dec 15, 2008 8:10 pm |
Doh!! I knew there was on I had to convert. If you have problems with it let me know. I had a zMUD but that was lost in the power outage.
|
|
_________________ Asati di tempari! |
|
|
|
ralgith Sorcerer
Joined: 13 Jan 2006 Posts: 715
|
Posted: Wed Dec 17, 2008 12:21 am |
Nah, I'm good. Haven't had time for it yet (won't likely till after the new year), but I can read C-Code as easy as Z-Code ;)
|
|
_________________ CrossOver: Windows Compatibility on Mac and Linux CMUD Advocate |
|
|
|
infimious Beginner
Joined: 24 Jun 2009 Posts: 15
|
Posted: Sun Aug 02, 2009 4:44 am |
could you trasfer this into Z-code
|
|
|
|
Tech GURU
Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: Tue Aug 04, 2009 6:52 am |
Man this was a pain to convert back to zMUD. CMUD has spoiled me because it's soo much easier to work with. i don't think I'll do too many more back conversions.
At great expense to my sleep and work in the morning, here it is.
Code: |
#CLASS {scan}
#VAR direction {west}
#VAR odd {to|the|a|an|Carlisle|Pirate|Swab|Tramp|Dog|Parrot|Male|Female|Guardian|First|Second|Third|Fourth|Fifth|Sixth|Seventh|Eighth|Ninth|Feriankian|Dug|Aldov}
#VAR list {Dwarven stair guard of Mar Nadrak|Dwarven stair guard of Mar Nadrak|Dwarven stair guard of Mar Nadrak|Dwarven stair guard of Mar Nadrak|Dwarven stair guard of Mar Nadrak|Dwarven stair guard of Mar Nadrak|Dwarven stair guard of Mar Nadrak|Dwarven stair guard of Mar Nadrak|Dwarven stair guard of Mar Nadrak|Dwarven stair guard of Mar Nadrak|Dwarven stair guard of Mar Nadrak|Dwarven stair guard of Mar Nadrak|Dwarven stair guard of Mar Nadrak|Dwarven stair guard of Mar Nadrak|Dwarven stair guard of Mar Nadrak}
#VAR db {Dwarven stair guard of Mar Nadrak15}
#VAR Mobs {}
#VAR mobName {Dwarven stair guard of Mar Nadrak}
#TRIGGER {to the (%w).} {#var direction %lower( %1)}
#TRIGGER {You see (%w) (%w)} {
#IF (%ismember( %2, @odd)) {
#var mobname %1
#ABORT 1
}
#IF (%ismember( %1, @odd)) {
#var mobname %2
#ABORT 1
}
}
#TRIGGER {You see (%w), (%w) (%w)} {#var mobname %3}
#TRIGGER {You see (%w*) to the (%w).} {
#pri {
list={%replace( "%1", " and ", "|")}
list={%replace( @list, ", ", "|")}
#echo %numitems( @list) //#echo several building list
db=%null
Mobs=%null
#forall @list {
#IF (%db( @db, "%i")) {#ADDKEY db {"%i"=%eval( %db( @db, "%i") + 1)}} {
#ADDKEY db "%i" 1
#additem Mobs "%i"
}
}
mobName=%pop( Mobs)
mobName={%trim( %subregex( @mobName, %concat( "\b(", @odd, ")\b")), "")}
#var direction %lower( %2)
}
}
#KEY ` {scan}
#KEY CTRL-` {gt f @mobname @direction}
#CLASS 0 |
The main bit took less than 20 mins, the rest was debugging and trying to fight against pretty printing. CMUD I love you. |
|
_________________ Asati di tempari! |
|
|
|
infimious Beginner
Joined: 24 Jun 2009 Posts: 15
|
Posted: Tue Aug 04, 2009 3:37 pm |
Guru, I love you, Ralgrith play(s/ed) dont see him on anymore, but the same MUD i play o this works wonders hehe
|
|
|
|
infimious Beginner
Joined: 24 Jun 2009 Posts: 15
|
Posted: Tue Aug 04, 2009 10:19 pm |
with this scan trigger when i type scan
all it does is display the number 1 afterwards which tells me how many mobs are that direction
so my question is this
when u have a mob named:
a Miner of the Titanium Mines
when i type f a Miner of the Titanium Mines w (even before messing with the scan trigger)
it doesnt fire
when i do this without any trigggers i have to find the certain letter of the mob that is been implemented when creted
for example a/miner/t/o (those would work) not sure why the o would maybe because the word 'of'
in a nut shell
f a Miner of the Titanium Mines
wont fire at anything because it is thinking
fire A (direction - M)
I need it to Fire Miner North/South/East/West
instead of fire a Miner of the Titanium Mines North/South/East/West
So i think it needs to save only the main piece from a mob in the DB possibly? Im actually stumped looking over it for pasted hour, hopefully u know :)
thanks a mill for helping!!! |
|
|
|
Tech GURU
Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: Wed Aug 05, 2009 5:53 am |
The scan trigger sets the variable @mobName to be the name of the mob you want to attack. It doesn't actually do the attack. The number is a left over debug message that tells you how many mobs it found in it's list.
The @odd variable is all the things you want stripped out of the variable @mobName, so if you want to more things removed add it to the @odd string list. |
|
_________________ Asati di tempari! |
|
|
|
|
|
|
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
|
|