 |
charneus Wizard

Joined: 19 Jun 2005 Posts: 1876 Location: California
|
Posted: Sat Nov 29, 2008 5:39 am
Assistance required... |
I have the following script. Right now, it works pretty well for my needs. However, there are times when I need it to process faster, though I'm not sure if it can/will. The script is:
| Code: |
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
<class name="IdentScript" copy="yes">
<trigger type="Command Input" priority="9590" trigontrig="false" regex="true" copy="yes">
<pattern>^((?:c\w{0,3} )?id\w{0,6} .*)</pattern>
<value>IDLevel=%null
IDName=%null
IDStats=%null
IDWear=%null
IDType=%null
#T+ "IdentTrigs"
#EXEC %1</value>
</trigger>
<class name="IdentTrigs" copy="yes">
<trigger name="NameTrigs" priority="9610" copy="yes">
<pattern>^~| Name%s: (*)%s~|$</pattern>
<value>#VAR IDName %trim(%1)</value>
<trigger>
<pattern>^~| Type%s: (*)%sLevel%s:%s(%d)%s~|$</pattern>
<value>#VAR IDType %trim(%1)
#VAR IDLevel %trim(%2)</value>
</trigger>
<trigger>
<pattern>^~| Wearable%s: (*)%s~|</pattern>
<value>#VAR IDWear %trim(%1)</value>
</trigger>
</trigger>
<trigger priority="9780" repeat="true" regex="true" copy="yes">
<pattern>(?:(@ItemStats))\s+: ([-+0-9]+)</pattern>
<value>#ADDKEY IDStats %1 %2</value>
</trigger>
<trigger priority="9820" copy="yes">
<pattern>+[-]+</pattern>
<trigger param="1" regex="true" prompt="true">
<pattern>^(?:A full appraisal will reveal further information on this item.|$)</pattern>
<value>#LOCAL $StatString $IdentString $StatTotal
#LOOPDB @IDStats {#IF (%val>0 AND !%ismember( %left( %key, 3), "Man|Hit|Dam|Mov")) {
$StatString=%concat( $StatString, "@C",%val,"@c"%left( %key, 3))
#ADD $StatTotal %subchar( %val, "+")
}}
$IdentString=%concat("@YItem: @G", @IDName," @YType: @G",@IDType," @YLevel: @G",@IDLevel," @YWear: @G",@IDWear, %if($StatTotal>0,%concat(" @YTotal Stats: @G",$StatTotal," @R[", %subchar( $StatString, "+"), "@R]")))
gt $IdentString
#T- "IdentTrigs"</value>
</trigger>
</trigger>
</class>
<class name="IdentVars" copy="yes">
<var name="IDName" copy="yes">An Ear Trumpet</var>
<var name="IDType" copy="yes">Armor</var>
<var name="IDWear" copy="yes">ear</var>
<var name="IDLevel" copy="yes">131</var>
<var name="IDStats" type="Record" copy="yes">Intelligence=+2|Luck=+2|Dexterity=+9</var>
<var name="ItemStats" type="StringList" copy="yes">Strength|Dexterity|Wisdom|Constitution|Intelligence|Luck</var>
<var name="ItemResists" type="StringList" copy="yes">All physical|All magic|Bash|Pierce|Slash|Acid|Air|Cold|Disease|Earth|Energy|Fire|Holy|Light|Electric|Magic|Mental|Negative|Poison|Shadow|Sonic|Water</var>
</class>
</class>
</cmud> |
What it goes off is the below:
| Code: |
+-----------------------------------------------------------------+
| Keywords : ear trumpet gaardian131 |
| Name : An Ear Trumpet |
| Type : Armor Level : 131 |
| Worth : 18,860 Weight : 22 |
| Wearable : ear |
| Flags : unique, glow, hum, magic, held, burn-proof, |
| : solidified, resonated, V3 |
| Notes : This item is from a clan hall. |
| Notes : Item has 2 resistance affects. |
+-----------------------------------------------------------------+
| Stat Mods : Moves : -60 Mana : +30 |
| Damage roll : +12 Dexterity : +9 |
| Luck : +2 Intelligence : +2 |
+-----------------------------------------------------------------+
A full appraisal will reveal further information on this item. |
However, sometimes two of them can appear in a row, such as
| Code: |
+-----------------------------------------------------------------+
| Keywords : ear trumpet gaardian131 |
| Name : An Ear Trumpet |
| Type : Armor Level : 131 |
| Worth : 18,860 Weight : 22 |
| Wearable : ear |
| Flags : unique, glow, hum, magic, held, burn-proof, |
| : solidified, resonated, V3 |
| Notes : This item is from a clan hall. |
| Notes : Item has 2 resistance affects. |
+-----------------------------------------------------------------+
| Stat Mods : Moves : -60 Mana : +30 |
| Damage roll : +12 Dexterity : +9 |
| Luck : +2 Intelligence : +2 |
+-----------------------------------------------------------------+
A full appraisal will reveal further information on this item.
+-----------------------------------------------------------------+
| Keywords : plain leather leggings freerider |
| Name : a pair of plain leather leggings |
| Type : Armor Level : 151 |
| Worth : 1,000 Weight : 15 |
| Wearable : legs |
| Flags : V3 |
| Notes : Item has 4 resistance affects. |
+-----------------------------------------------------------------+
A full appraisal will reveal further information on this item. |
(Note: This is pertaining to identify, which I can control the speed over, but I was using a similar script for the auction (which is up in the package library right now) and it produces the same 'problem.')
When the above happens, I only get one output instead of two, as noted below:
| Code: |
| (Group) Charneus: 'Item: An Ear Trumpet Type: Armor Level: 131 Wear: ear Total Stats: 13 [2Int2Luc9Dex]' |
So, is there a way to make the script run twice in a row like that and output both times? I really don't want to have to go through using a bunch of variables/temp variables to get this to work, and I'm not sure it would even process correctly then, either. Am I just out of luck on this one? Hopefully someone will have an answer, though. Greatly appreciate it!
Charneus |
|
|
|
 |
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Mon Dec 01, 2008 2:46 pm |
I don't see an easy way to make it work twice in quick succession like that, as an oninput trigger. However, perhaps you could get rid of the oninput trigger, and instead trigger on '+-----------------------------------------------------------------+" to activate the IdentTrigs trigger. And initialize the variables to null when you print your output string, rather than when you activate the trigger.
|
|
|
|
 |
charneus Wizard

Joined: 19 Jun 2005 Posts: 1876 Location: California
|
Posted: Mon Dec 01, 2008 4:47 pm |
I'll take the second suggestion into consideration. Actually, that didn't even cross my mind. However, triggering on that specific pattern is a problem because there are several places that line is used, and it would enable the triggers at the wrong times. Thanks. I'll see if I can negotiate a way to make it work. Wonder if by putting the entire thing into a variable (the entire output, not just items) and doing a loop through will produce better results. Hmmm...
Charneus |
|
|
|
 |
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Mon Dec 01, 2008 9:22 pm |
Do you mean that the line of hyphens is used in other mud output besides this identify output? If so, that would indeed pose a problem. If you only mean that it occurs several times within the identify output, that doesn't matter.
|
|
|
|
 |
cazador Apprentice
Joined: 08 Dec 2005 Posts: 108
|
Posted: Mon Dec 01, 2008 10:50 pm |
| charneus wrote: |
I'll take the second suggestion into consideration. Actually, that didn't even cross my mind. However, triggering on that specific pattern is a problem because there are several places that line is used, and it would enable the triggers at the wrong times. Thanks. I'll see if I can negotiate a way to make it work. Wonder if by putting the entire thing into a variable (the entire output, not just items) and doing a loop through will produce better results. Hmmm...
Charneus |
What I had done in times like this, is enable the trigger by using an aliases that will call the ident, and when the ident has processed and a prompt is recieved then you can disable the alias. If that is the case then you can do a initial trigger on Keyword, instead of +--------------------------
Cazador |
|
|
|
 |
charneus Wizard

Joined: 19 Jun 2005 Posts: 1876 Location: California
|
Posted: Mon Dec 01, 2008 11:58 pm |
Right. My oninput does that. It initializes the script. It's the processing speed that it is having trouble.
Rahab, yes. Throughout the entire MUD output, such as score and other things.
Charneus |
|
|
|
 |
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Tue Dec 02, 2008 2:30 pm |
Actually, the problem is not really the processing speed. The problem is that you are executing the second identify command before the output of the first identify is displayed. The delay between sending the command and the display of the output is a combination of processing within Cmud, processing on the mud server, tick timing on the mud server, and transmission lag. So it is not fair to call it a problem with processing speed, and cannot be properly solved by attacking it from a speed angle. Network lag will cause the same problem.
I think the best solution is to somehow activate the IdentTrigs class based on the mud output. But if it is impossible to distinguish the output sufficiently, as it may be in this case, here is an awkward alternative. In the oninput trigger, replace '#T+ "IdentTrigs"' with:
| Code: |
| #if (@IdentNum) {#add IdentNum 1} {#T+ "IdentTrigs"} |
And in the IdentTrigs trigger replace '#T- "IdentTrigs"' with:
| Code: |
| #if (@IdentNum > 1) {#add IdentNum -1} {#var IdentNum 0;#T- "IdentTrigs} |
And finally, line you make the variable @IdentNum. On the command line, this would be:
| Code: |
| #var IdentNum 0 0 IdentScript |
|
|
|
|
 |
charneus Wizard

Joined: 19 Jun 2005 Posts: 1876 Location: California
|
Posted: Tue Dec 02, 2008 3:45 pm |
Ha! I should have thought of that myself. Works perfectly now. Thanks, Rahab. I owe you one. :)
Charneus |
|
|
|
 |
charneus Wizard

Joined: 19 Jun 2005 Posts: 1876 Location: California
|
Posted: Wed Dec 03, 2008 2:45 am |
Heh. I wrote a quick note, then looked at what you provided and realized my own answer.. You neglected a couple of things, Rahab, like the #ADD IdentNum 1 with the #T+ "IdentTrigs" and the closing " on the #T- "IdentTrigs" :P
Charneus |
|
|
|
 |
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Wed Dec 03, 2008 2:16 pm |
Heh, yeah, a couple of bugs in my suggestion. Glad you got it worked out. 
|
|
|
|
 |
|
|
|
|
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
|
|