Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
Sutex-Kindred
Apprentice


Joined: 26 Aug 2009
Posts: 141

PostPosted: Fri May 20, 2011 6:12 am   

Auto prac
 
This just won't run. Anyone know why it won't work. Was posted on my mud so should work ok for my mud
I think , that Cmud might have a problem with it.

#CLASS {autoprac}
#ALIAS aprac {#class casting %1;#class manaing %1;#var listposition 1}
#VAR spelllist {bless|armor}
#VAR praclist {90|90}
#VAR targetlist {self|self}
#VAR listposition {1} {1}
#TRIGGER {^ Mana~: ~[(%d)%s~/%s(%d)~]} {#var maxmana %2}
#CLASS 0
#CLASS {autoprac|manaing}
#TRIGGER {(%n)hp (%n)m (%n)mv>} {#if ((%2=@maxmana) AND (%3=@maxmove)) {#t- manaing;#t+ casting;w;#show casting;prac %item( @spelllist, @listposition)}} "" {nocr|prompt}
#CLASS 0
#CLASS {autoprac|casting}
#REGEX {(@spelllist)\s+(\d+)} {#if (%1=%item( @spelllist, @listposition)) {#show casting;#if (%2=%item( @praclist, @listposition)) {#add listposition 1};c '%item( @spelllist, @listposition)' %item( @targetlist, @listposition);prac %item( @spelllist, @listposition)}}
#TRIGGER {You haven't the energy to cast that spell!} {e}
#TRIGGER {No way! You're fighting for your life!} {flee}
#TRIGGER {PANIC! You couldn't escape!} {flee}
#TRIGGER {Down - Entry Room to Algeroth } {#t- casting;#t+ manaing}
#TRIGGER {I do not know that one.} {#var listposition 1}
#CLASS 0
_________________
Entropy rules
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Fri May 20, 2011 1:59 pm   
 
You'll need to be much more specific than what you've given us... such as WHAT isn't working about it...

Also, what is the #CLASS casting %1 stuff about?
Reply with quote
Sutex-Kindred
Apprentice


Joined: 26 Aug 2009
Posts: 141

PostPosted: Fri May 20, 2011 2:16 pm   
 
charneus wrote:
You'll need to be much more specific than what you've given us... such as WHAT isn't working about it...

Also, what is the #CLASS casting %1 stuff about?


The script wont run. nothing happens , I have noidea why, I just copy the script from the mud. I don't know what the class casting %1 means.
I don't know how to script, only really basic stuff , that's it. I don't know what else to tell you.
_________________
Entropy rules
Reply with quote
oldguy2
Wizard


Joined: 17 Jun 2006
Posts: 1201

PostPosted: Fri May 20, 2011 5:12 pm   
 
Well by looking at it, whoever made it is using the "aprac" alias to enable and disable those two classes so I guess they are entering "aprac 1" or "aprac 0" and set listposition to 1 on both enable and disable. One reason the script won't work for you probably is that you need to create the maxmana and maxmove variables yourself. They are not provided, but they are referenced in the script.

I would definitely clean up that script though.

Edit: Also your prompt trigger may not be matching either. They have %n instead of %d. The Help file states "%n match a number that starts with a + or - sign" so you may need to change %n to %d.

I created the maxMana and maxMove variables and tried the following script and entered #showp {100hp 100m 4mv>} and it worked how the script is set up to work.

Code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
  <class name="AutoPrac" copy="yes">
    <alias name="aprac" copy="yes">
      <value>#switch (%lower($state))
  ("on") {
  #T+ Casting
  #T+ Manaing
  #print "Casting and Manaing Enabled"
  }
  ("off") {
  #T- Casting
  #T- Manaing
  #print "Casting and Manaing Disabled"
  }
listPosition = 1</value>
      <arglist>$state</arglist>
      <notes>Enter "aprac on" or "aprac off" on command line to toggle.</notes>
    </alias>
    <var name="spellList" type="StringList" copy="yes">
      <value>bless|armor</value>
      <json>["bless","armor"]</json>
    </var>
    <var name="pracList" type="StringList" copy="yes">
      <value>90|90</value>
      <json>[90,90]</json>
    </var>
    <var name="targetList" type="StringList" copy="yes">
      <value>self|self</value>
      <json>["self","self"]</json>
    </var>
    <var name="listPosition" usedef="true" copy="yes">
      <value>1</value>
      <default>1</default>
    </var>
    <trigger priority="70" copy="yes">
      <pattern>^ Mana~: ~[(%d)%s~/%s(%d)~]</pattern>
      <value>maxMana = %2</value>
    </trigger>
    <class name="Manaing" copy="yes">
      <trigger priority="90" newline="false" prompt="true" copy="yes">
        <pattern>(%d)hp (%d)m (%d)mv></pattern>
        <value>#if ((%2 == @maxMana) AND (%3 == @maxMove)) {
  #t- Manaing
  #t+ Casting
  #sendraw "w"
  #print %concat("Casting ",%item( @spellList, @listPosition))
  #sendraw %concat("prac ",%item( @spellList, @listPosition))
  }</value>
      </trigger>
    </class>
    <class name="Casting" copy="yes">
      <trigger priority="110" regex="true" copy="yes">
        <pattern>(@spellList)\s+(\d+)</pattern>
        <value>#if (%1 == %item( @spellList, @listPosition)) {
  #if (%2 == %item( @pracList, @listPosition)) {listPosition = @listPosition + 1}
  #print %concat("Casting ",%item( @spellList, @listPosition))
  #sendraw %concat("c '",%item( @spellList, @listPosition),"' ",%item( @targetList, @listPosition))
  #sendraw %concat("prac ",%item( @spellList, @listPosition))
  }</value>
      </trigger>
      <trigger priority="120" copy="yes">
        <pattern>You haven't the energy to cast that spell!</pattern>
        <value>#sendraw "e"</value>
      </trigger>
      <trigger priority="130" copy="yes">
        <pattern>No way! You're fighting for your life!</pattern>
        <value>#sendraw "flee"</value>
      </trigger>
      <trigger priority="140" copy="yes">
        <pattern>PANIC! You couldn't escape!</pattern>
        <value>#sendraw "flee"</value>
      </trigger>
      <trigger priority="150" copy="yes">
        <pattern>Down - Entry Room to Algeroth </pattern>
        <value>#t- Casting
#t+ Manaing</value>
      </trigger>
      <trigger priority="160" copy="yes">
        <pattern>I do not know that one.</pattern>
        <value>listPosition = 1</value>
      </trigger>
    </class>
    <var name="maxMana" copy="yes">100</var>
    <var name="maxMove" copy="yes">4</var>
  </class>
</cmud>
Reply with quote
Sutex-Kindred
Apprentice


Joined: 26 Aug 2009
Posts: 141

PostPosted: Fri May 20, 2011 6:10 pm   
 
Thanks for that.. I would have been there forever. I assumed he ,the person who first made the script, knew what he was doing, and all was there. I did wonder
about the variable.
Imported fine , shall test it later .0330 here.
_________________
Entropy rules
Reply with quote
Sutex-Kindred
Apprentice


Joined: 26 Aug 2009
Posts: 141

PostPosted: Sat May 21, 2011 5:44 am   
 
Ok have tried this on my mud and , it's not working. I type aprac on , and nothing happening expect the message to screen say the classes are on.
I 'm lost


Edit I delete it then put it back, and now it's working a bit,. It cast the one spell but won't leave and recharged mana , just goes around in a loop but maybe the code really has to be a total Cmud , so it's not so fussy, basically this script, should be allowed to run overnight , and go through the list, I hope.
_________________
Entropy rules
Reply with quote
oldguy2
Wizard


Joined: 17 Jun 2006
Posts: 1201

PostPosted: Thu May 26, 2011 3:38 am   
 
I have no idea what you mean by it has to be a total Cmud? Yes this is a Cmud script. As I said you have to make sure your prompt actually matches the trigger. Perhaps paste what your prompt actually looks like. The script is doing exactly what it is written to do. If you want it to do something else, then you'll have to change it. I'd say your prompt isn't matching though if it isn't working.
Reply with quote
Sutex-Kindred
Apprentice


Joined: 26 Aug 2009
Posts: 141

PostPosted: Thu May 26, 2011 8:08 am   Thanks it does work, BUT!
 
It works , but it mess up the flee command, I flee to another room , so 9 times out of ten it's fine. Then, that one time the scripts stops because it has gone to another room where there is no healers so no triggers and then of course , the script stops working. This is a problem if I'm leaving the script to run over night, which is what I want , prac scripts like this are allowed on my mud.
Answer to your ? I just thought that the conversion to Cmud might have done something to the original script. , This assume the original script worked in the client it was made for in the first place. It may not have.
But thanks again oldguy2 for fixing it up to this point, to work in Cmud.
My question is... by looking at the above script, is there a way of making it have error check so it does not flee to far.
If the owner of the script ever comes back on-line, I will asked him, but people come and go. So no luck there.
_________________
Entropy rules
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4672
Location: Pensacola, FL, USA

PostPosted: Thu May 26, 2011 9:53 am   
 
inside the settings editor under file is the compatability report... that should show you any key errors
_________________
Discord: Shalimarwildcat
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Thu May 26, 2011 3:52 pm   
 
We don't know your mud, and we don't know what you want the script to do in the 1 time out of 10 that you end up in a room where there are no healers. You need to figure out what you want to happen, and what cues the script might use to realize that it needs to do something. Bot scripts like this require a lot of work to account for every possible situation that it might face, and unless you can tell us exactly what the situation is that it doesn't work for and what you want to happen, you'll have to figure that out yourself.
Reply with quote
oldguy2
Wizard


Joined: 17 Jun 2006
Posts: 1201

PostPosted: Fri May 27, 2011 4:30 am   
 
Rahab wrote:
We don't know your mud, and we don't know what you want the script to do in the 1 time out of 10 that you end up in a room where there are no healers. You need to figure out what you want to happen, and what cues the script might use to realize that it needs to do something. Bot scripts like this require a lot of work to account for every possible situation that it might face, and unless you can tell us exactly what the situation is that it doesn't work for and what you want to happen, you'll have to figure that out yourself.


Exactly. What is provided in the script is seriously limited. I'm not sure how he left it running as you say. Perhaps you don't have all of the script? Either way what Rahab said here is the case. You'll have to figure out what you want it to do and add it to the script. The code will only do what it is written to do and right now it will only do what it does...if that makes any sense. Razz
Reply with quote
Sutex-Kindred
Apprentice


Joined: 26 Aug 2009
Posts: 141

PostPosted: Tue Nov 13, 2012 12:44 am   Been a while !
 
The Targetlist in this string is not been picked up, this whole practice script , needs an overhaul. The "You don't have enough to cast" that spell , has me moving "e" depending how many times the triggers fires.

#sendraw %concat("c '",%item( @spellList, @listPosition),"' ",%item( @targetList, @listPosition))
_________________
Entropy rules
Reply with quote
Sutex-Kindred
Apprentice


Joined: 26 Aug 2009
Posts: 141

PostPosted: Thu Nov 15, 2012 4:41 am   RE-DO Prac Scripts. 2012
 
Code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
  <class name="AutoPrac" copy="yes">
    <alias name="aprac" copy="yes">
      <value>#switch (%lower($state))
  ("on") {
  #T+ Casting
  #T+ Manaing
  #print "Casting and Manaing Enabled"
  }
  ("off") {
  #T- Casting
  #T- Manaing
  #print "Casting and Manaing Disabled"
  }
listPosition = 1</value>
      <arglist>$state</arglist>
      <notes>Enter "aprac on" or "aprac off" on command line to toggle.</notes>
    </alias>
    <var name="pracList" type="StringList" copy="yes">
      <value>90|90</value>
      <json>[90,90]</json>
    </var>
    <var name="targetList" type="StringList" copy="yes">
      <value>dummy|self</value>
      <json>["dummy","self"]</json>
    </var>
    <var name="listPosition" usedef="true" copy="yes">
      <value>1</value>
      <default>1</default>
    </var>
    <trigger priority="70" copy="yes">
      <pattern>^(%d)hp (%d)m (%d)</pattern>
      <value>maxMana = %2</value>
    </trigger>
    <class name="Manaing" enabled="false" copy="yes">
      <trigger priority="90" newline="false" prompt="true" copy="yes">
        <pattern>^(%d)hp (%d)m (%d)mv></pattern>
        <value>#if ((%2 == @maxMana) AND (%3 == @maxMove)) {
  #t- Manaing
  #t+ Casting
  #sendraw "w"
  #print %concat("Casting ",%item( @spellList, @listPosition))
  #sendraw %concat("prac ",%item( @spellList, @listPosition))
  }</value>
      </trigger>
    </class>
    <class name="Casting" copy="yes">
      <trigger priority="110" regex="true" copy="yes">
        <pattern>(@spellList)\s+(\d+)</pattern>
        <value>#if (%1 == %item( @spellList, @listPosition)) {
  #if (%2 == %item( @pracList, @listPosition)) {listPosition = @listPosition + 1}
  #print %concat("Casting ",%item( @spellList, @listPosition))
  #sendraw %concat("c '",%item( @spellList, @listPosition)," '",%item( @targetList, @listPosition))
  #sendraw %concat("prac ",%item( @spellList, @listPosition))
  }</value>
      </trigger>
      <trigger priority="120" copy="yes">
        <pattern>You haven't the energy to cast that spell!</pattern>
        <value>e

</value>
      </trigger>
      <trigger priority="130" copy="yes">
        <pattern>No way! You're fighting for your life!</pattern>
        <value>#sendraw "flee"</value>
      </trigger>
      <trigger priority="140" copy="yes">
        <pattern>PANIC! You couldn't escape!</pattern>
        <value>#sendraw "flee"</value>
      </trigger>
      <trigger priority="150" copy="yes">
        <pattern>Down - Entry Room to Algeroth</pattern>
        <value>#t- Casting
#t+ Manaing</value>
      </trigger>
      <trigger priority="160" copy="yes">
        <pattern>I do not know that one.</pattern>
        <value>listPosition = 1</value>
      </trigger>
      <trigger priority="4980" copy="yes">
        <pattern>You lost your concentration trying to cast (*)!$</pattern>
        <value>cast '%1'</value>
      </trigger>
      <trigger priority="9390" copy="yes">
        <pattern>The Clan Training Dummy is standing here.</pattern>
        <value>cast,%item(' @spellList ', @listPosition)
</value>
      </trigger>
      <trigger priority="9400" copy="yes">
        <pattern>You have gotten better at (*)!$</pattern>
        <value>cast,%item(' @spellList ', @listPosition)</value>
      <trigger priority="9430" copy="yes">
        <pattern>A clan fountain sits here providing water to the clan.</pattern>
        <value>#wait 90000
w</value>
      </trigger>
      <trigger priority="9450" copy="yes">
        <pattern>The Clan Training Dummy has a few scratches.</pattern>
        <value>cast,%item(' @spellList ', @listPosition)</value>
       <trigger priority="9710" copy="yes">
        <pattern>The clan board is standing here.</pattern>
        <value>#wait 7000
w</value>
      </trigger>
    </class>
    <var name="maxMana" copy="yes">2024</var>
    <var name="maxMove" copy="yes">875</var>
    <var name="spellList" type="StringList" copy="yes">
      <value>armor|fort|invulnerability|word of recall|heal|power heal</value>
      <json>["armor","fort","invulnerability","word of recall","heal","power heal"]</json>
    </var>
  </class>
</cmud>


The above Prac script does not work well. Hence extra the "triggers". This script is supposed to be able to read @spelllist , Target the Dummy with @targetList if the skill/spell needs it. Run the " prac" command determine the spell/skill level. If its the same level in the variable @pracList ( which I set) . It moves on to the next spell/skill, practices that spell/skill to @pracList level. "Repeat & Rinse"
At the moment it only reads the @spelllist, sometimes the prac commands runs, and the @targetList does not work at all. It also has me fleeing all over the mud, sometimes !, so random.
I think some of this a prompt issue. Is this a problem ? (@spellList)\s+(\d+) as it's controls the reading of @maxMana AND @maxMove, I do set these myself, as I changed the old trigger prompt ( see in the top most script ) Mana~: ~[(%d)%s~/%s(%d)~] to match this 4689hp 2709m 740mv> It's now ^(%d)hp (%d)m (%d) maxMana = %2

If you type Prac armor on my mud you will get this:

4689hp 2709m 740mv> This You have 358 practice sessions remaining. There can be a space after the >or not
armor 87



Any help would be great, cheers.
_________________
Entropy rules
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
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

© 2009 Zugg Software. Hosted by Wolfpaw.net