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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » Finished MUD Scripts
Leitia
Adept


Joined: 04 May 2007
Posts: 292
Location: Boston

PostPosted: Mon Feb 09, 2009 3:42 pm   

MUME spell model
 
This code is a spell model for casting on group members but you may use it in other ways, including bash on an 8.orc

It follows where CT is the name of the Cure Critic alias:


CT %1 (%1 = a target)
casts 'CT spell' at default speed on target
assigns target %1

CT %1 (%1 = q f n c t)
casts with that as temp speed at previously assigned target

CT q f n c t and %2
casts temp speed q f n c Or t at %2
assigns target %2

CT q q [%3]
set new default speed quick [cast CT at %3 (new target) right now]
inputs CT highlighted, this will fire on target with default speed changed, just hit ENTER

CT CT
casts in combat with no target at MUME set speed

CT 4
casts default speed 'spell' at 4.target
assigns current target at 4.target

CT w %2
does not cast
assigns switch to %2

CT w 4
does not cast
assigns switch of target as 4.target

CT w
casts default speed 'spell' at switch (keep switched)

CT q w
casts temp speed quick 'spell' at switch (keep switched)


[EDITED] Concerns:

1. When making an new alias you must replace CT with the new alias name IN the script too. Easy to do with notepad, but use UPPER CASE. eg. for an alias named 'bob' replace CT with BOB.

2. Attack spells can use @target and @w_target vs. @ffocus and @w_ffocus. These go into the 'Shared' class and if you have @target elsewhere, this script may fail. Replace 'ffocus' not '@ffocus' to update the #var ffocus refs too.

3. There is an if statement to lose focus at the end, you would need to enable that for self casting with no player parameter. You can use "me' as a parameter, although in my player alias group I have the tilde key macro set to cast with no player parameter.

4. This script works as well for bash, bash disengage, and rescue. Useful for the switches and numeric concatenation, eg. 4.orc You need to replace the entire small spaced 'c ' statement with say, rescue @ffocus

5. For those no parameter spell like BOB, search for a small spaced 'c ' for the cast. remove @ffocus which follow that code string for a clean look.

6. Default speed is not sent to MUME, there is an odd convention there to CT CT which omits speed entirely, that could be changed to a 'd' switch. I don't think its important.

7. Further, default speed is assigned to @aknysp, if you change this variable name you would always cast 'cure critic' at the speed set by this spell. Then a 'd' switch might be useful for fast casting.

Finally, I'm sure this seems overly complicated. The conventions are the same ones you must use anyway, only combined into spell operation. You needn't use any options, as CT Frodo will always cure Frodo till you CT Bilbo. Just felt to share my system.

recap:

A. Batch replace upper case CT in script with your upper case alias name
B. Replace, 'cure critic' with whatever spell. eg. 'heal' (mind the mystical symbols)
C. For attack spells, make sure you don't have @target assigned elsewhere.

Code:
#class shared
#if (%null( @aknysp)) {#var aknysp normal}
#if (%2) {
  #if (@cspd(%1) and @cspd(%2)) {
    #var aknysp %case( %ismember( %lower( %1), "q|f|n|c|t"), "quick", "fast", "normal", "careful", "thorough")
    #if (%3) {
      #var ffocus %3
      #if (%isnumber( %left( %3, 1))) {#var ffocus %3} {#var ffocus %proper( %3)}
      c @aknysp 'cure critic' @ffocus
      }
    #sh i speed %upper( @aknysp)
    #hi
    #input "CT" 1
    #gauge c_gauge @aknysp" at "%upper( @target)" - wwww - "%upper( @w_target) %eval( (%ismember( %left( @aknysp, 1), "q|f|n|c|t") * 100) - 100) 400 10 "" green red black
    } {
    #if (%isnumber( %2)) {#if (%pos( ".", @ffocus)) {#if (%lower( %1) == "w") {
          #var w_ffocus %subregex( @ffocus, "\d+", "%2")
          #sh ready SWITCH to @w_ffocus
          #hi
          #input "CT W" 1
          } {#var ffocus %subregex( @ffocus, "\d+", "%2")}} {#if (%lower( %1) == "w") {
          #var w_ffocus %concat( %2, ".", @ffocus)
          #sh ready SWITCH to @w_ffocus
          #hi
          #input "CT W" 1
          } {#var ffocus %concat( %2, ".", @ffocus)}}} {#if (%lower( %1) == "w") {
        #if (%isnumber( %left( %2, 1))) {#var w_ffocus %2} {#var w_ffocus %proper( %2)}
        #if (%isnumber( %left( @w_ffocus, 1))) {#sh ready SWITCH to @w_ffocus} {#sh ready SWITCH to %proper( @w_ffocus)}
        #hi
        #input "CT W" 1
        } {#if (%lower( %2) == "w") {
          #var s_ffocus @ffocus
          #var ffocus @w_ffocus
          #var w_ffocus @s_ffocus
          #unvar s_ffocus
          #if (%isnumber( %left( @ffocus, 1))) {#sh SWITCH @ffocus} {#sh SWITCH %proper( @ffocus)}
          #hi
          } {#if (%isnumber( %left( %2, 1))) {#var ffocus %2} {#var ffocus %proper( %2)}}}}
    #gauge c_gauge @aknysp" at "%upper( @target)" - wwww - "%upper( @w_target) %eval( (%ismember( %left( @aknysp, 1), "q|f|n|c|t") * 100) - 100) 400 10 "" green red black
    #if (@cspd(%1)) {c %case( %ismember( %lower( %1), "q|f|n|c|t"), "quick", "fast", "normal", "careful", "thorough") 'cure critic' @ffocus} {#if (%lower( %1) != "w") {c @aknysp 'cure critic' @ffocus}}
    }
  } {#if (%1) {
    #if (%upper( %1) == "CT") {c 'cure critic'} {
      #if (%isnumber( %1)) {
        #if (%pos( ".", @ffocus)) {#var ffocus %subregex( @ffocus, "\d+", "%1")} {#var ffocus %concat( %1, ".", @ffocus)}
        #gauge c_gauge @aknysp" at "%upper( @target)" - wwww - "%upper( @w_target) %eval( (%ismember( %left( @aknysp, 1), "q|f|n|c|t") * 100) - 100) 400 10 "" green red black
        c @aknysp 'cure critic' @ffocus
        } {
        #if (@cspd(%1)) {c %case( %ismember( %lower( %1), "q|f|n|c|t"), "quick", "fast", "normal", "careful", "thorough") 'cure critic' @ffocus} {
          #if (%lower( %1) == "w") {
            #var s_ffocus @ffocus
            #var ffocus @w_ffocus
            #var w_ffocus @s_ffocus
            #unvar s_ffocus
            #if (%isnumber( %left( @ffocus, 1))) {#sh SWITCH @ffocus} {#sh SWITCH %proper( @ffocus)}
            #hi
            } {#if (%isnumber( %left( %1, 1))) {#var ffocus %1} {#var ffocus %proper( %1)}}
          c @aknysp 'cure critic' @ffocus
          #gauge c_gauge @aknysp" at "%upper( @target)" - wwww - "%upper( @w_target) %eval( (%ismember( %left( @aknysp, 1), "q|f|n|c|t") * 100) - 100) 400 10 "" green red black
          }
        }
      }
    } {c @aknysp 'cure critic' @ffocus}}
#if (@akapref.losefocus == 1) {#var ffocus ""}
#class 0


function cspd:

Code:
%if( %lower( %1) = "q" or %lower( %1) = "f" or %lower( %1) = "n" or %lower( %1) = "c" or %lower( %1) = "t", 1, 0)


Code:
#ALIAS CT {#class shared;#if (%null( @aknysp)) {#var aknysp normal};#if (%2) {#if (@cspd(%1) and @cspd(%2)) {#var aknysp %case( %ismember( %lower( %1), "q|f|n|c|t"), "quick", "fast", "normal", "careful", "thorough");#if (%3) {#var ffocus %3;#if (%isnumber( %left( %3, 1))) {#var ffocus %3} {#var ffocus %proper( %3)};c @aknysp 'cure critic' @ffocus};#sh i speed %upper( @aknysp);#hi;#input "CT" 1;#gauge c_gauge @aknysp" at "%upper( @target)" - wwww - "%upper( @w_target) %eval( (%ismember( %left( @aknysp, 1), "q|f|n|c|t") * 100) - 100) 400 10 "" green red black} {#if (%isnumber( %2)) {#if (%pos( ".", @ffocus)) {#if (%lower( %1) == "w") {#var w_ffocus %subregex( @ffocus, "\d+", "%2");#sh ready SWITCH to @w_ffocus;#hi;#input "CT W" 1} {#var ffocus %subregex( @ffocus, "\d+", "%2")}} {#if (%lower( %1) == "w") {#var w_ffocus %concat( %2, ".", @ffocus);#sh ready SWITCH to @w_ffocus;#hi;#input "CT W" 1} {#var ffocus %concat( %2, ".", @ffocus)}}} {#if (%lower( %1) == "w") {#if (%isnumber( %left( %2, 1))) {#var w_ffocus %2} {#var w_ffocus %proper( %2)};#if (%isnumber( %left( @w_ffocus, 1))) {#sh ready SWITCH to @w_ffocus} {#sh ready SWITCH to %proper( @w_ffocus)};#hi;#input "CT W" 1} {#if (%lower( %2) == "w") {#var s_ffocus @ffocus;#var ffocus @w_ffocus;#var w_ffocus @s_ffocus;#unvar s_ffocus;#if (%isnumber( %left( @ffocus, 1))) {#sh SWITCH @ffocus} {#sh SWITCH %proper( @ffocus)};#hi} {#if (%isnumber( %left( %2, 1))) {#var ffocus %2} {#var ffocus %proper( %2)}}}};#gauge c_gauge @aknysp" at "%upper( @target)" - wwww - "%upper( @w_target) %eval( (%ismember( %left( @aknysp, 1), "q|f|n|c|t") * 100) - 100) 400 10 "" green red black;#if (@cspd(%1)) {c %case( %ismember( %lower( %1), "q|f|n|c|t"), "quick", "fast", "normal", "careful", "thorough") 'cure critic' @ffocus} {#if (%lower( %1) != "w") {c @aknysp 'cure critic' @ffocus}}}} {#if (%1) {#if (%upper( %1) == "CT") {c 'cure critic'} {#if (%isnumber( %1)) {#if (%pos( ".", @ffocus)) {#var ffocus %subregex( @ffocus, "\d+", "%1")} {#var ffocus %concat( %1, ".", @ffocus)};#gauge c_gauge @aknysp" at "%upper( @target)" - wwww - "%upper( @w_target) %eval( (%ismember( %left( @aknysp, 1), "q|f|n|c|t") * 100) - 100) 400 10 "" green red black;c @aknysp 'cure critic' @ffocus} {#if (@cspd(%1)) {c %case( %ismember( %lower( %1), "q|f|n|c|t"), "quick", "fast", "normal", "careful", "thorough") 'cure critic' @ffocus} {#if (%lower( %1) == "w") {#var s_ffocus @ffocus;#var ffocus @w_ffocus;#var w_ffocus @s_ffocus;#unvar s_ffocus;#if (%isnumber( %left( @ffocus, 1))) {#sh SWITCH @ffocus} {#sh SWITCH %proper( @ffocus)};#hi} {#if (%isnumber( %left( %1, 1))) {#var ffocus %1} {#var ffocus %proper( %1)}};c @aknysp 'cure critic' @ffocus;#gauge c_gauge @aknysp" at "%upper( @target)" - wwww - "%upper( @w_target) %eval( (%ismember( %left( @aknysp, 1), "q|f|n|c|t") * 100) - 100) 400 10 "" green red black}}}} {c @aknysp 'cure critic' @ffocus}};#if (@akapref.losefocus == 1) {#var ffocus ""};#class 0} "Spells"
#ALIAS SPELLHELP {#sh " ";#forall @loadhelp1 {#sh %ansi( white) %i};#sh " "} "Spells"
#VAR cspd {%if( %lower( %1) = "q" or %lower( %1) = "f" or %lower( %1) = "n" or %lower( %1) = "c" or %lower( %1) = "t", 1, 0)} {_nodef} "Spells"
#VAR loadhelp1 {BB %1 (%1 = a target)| casts default speed on target| assigns target %1|%cr| BB %1 (%1 = q f n c t)| casts with that temp speed at assigned target|%cr| BB q f n c t and %2| casts 'BB spell' at temp speed q f n c Or t at %2| assigns target %2|%cr| BB q q [%3]| set new default speed quick [cast BB at %3 (new target) right now]| inputs BB highlighted, this will fire on target with default speed changed|%cr| BB BB| casts in combat with no target at MUME set speed|%cr| BB 4| casts default speed 'spell' at 4.target| assigns current target at 4.target|%cr| BB w %2| does not cast| assigns switch to %2|%cr| BB w 4| does not cast| assigns switch of target as 4.target|%cr| BB w| casts default speed 'spell' at switch (keep switched)|%cr| BB q w| casts temp speed quick 'spell' at switch (keep switched)|} {_nodef} "Spells"


Revised to use proper case in all circumstances, and added spellhelp.


Last edited by Leitia on Fri Feb 27, 2009 5:19 pm; edited 5 times in total
Reply with quote
Leitia
Adept


Joined: 04 May 2007
Posts: 292
Location: Boston

PostPosted: Mon Feb 09, 2009 6:07 pm   
 
I discovered that gauge was teeny tiny. I did not really work on it's definition. This is mine during testing:

Code:
#BUTTON 1 {fast at FROG - wwww - 2.TROLL} {} {} {} {%eval( (%ismember( %left( @aknysp, 1), "q|f|n|c|t") * 100) - 100)} {} {} {Size} {600} {11} {Pos} {1} {15} {47} {} {Gauge||4|400|10|0} {} "Spells" {Explore|Inset} {} {c_gauge}
Reply with quote
Leitia
Adept


Joined: 04 May 2007
Posts: 292
Location: Boston

PostPosted: Fri Feb 27, 2009 5:17 pm   Revised the above post to use proper case for all circumstances
 
Here is all of the above. Included in the revision is a help alias with the conventions.

What follows is identical to the above post except here included is my alias for HARM which will mess you over with it's target being in the shared folder if you have a target in, say, the none folder.


Code:
#ALIAS CT {#class shared;#if (%null( @aknysp)) {#var aknysp normal};#if (%2) {#if (@cspd(%1) and @cspd(%2)) {#var aknysp %case( %ismember( %lower( %1), "q|f|n|c|t"), "quick", "fast", "normal", "careful", "thorough");#if (%3) {#var ffocus %3;#if (%isnumber( %left( %3, 1))) {#var ffocus %3} {#var ffocus %proper( %3)};c @aknysp 'cure critic' @ffocus};#sh i speed %upper( @aknysp);#hi;#input "CT" 1;#gauge c_gauge @aknysp" at "%upper( @target)" - wwww - "%upper( @w_target) %eval( (%ismember( %left( @aknysp, 1), "q|f|n|c|t") * 100) - 100) 400 10 "" green red black} {#if (%isnumber( %2)) {#if (%pos( ".", @ffocus)) {#if (%lower( %1) == "w") {#var w_ffocus %subregex( @ffocus, "\d+", "%2");#sh ready SWITCH to @w_ffocus;#hi;#input "CT W" 1} {#var ffocus %subregex( @ffocus, "\d+", "%2")}} {#if (%lower( %1) == "w") {#var w_ffocus %concat( %2, ".", @ffocus);#sh ready SWITCH to @w_ffocus;#hi;#input "CT W" 1} {#var ffocus %concat( %2, ".", @ffocus)}}} {#if (%lower( %1) == "w") {#if (%isnumber( %left( %2, 1))) {#var w_ffocus %2} {#var w_ffocus %proper( %2)};#if (%isnumber( %left( @w_ffocus, 1))) {#sh ready SWITCH to @w_ffocus} {#sh ready SWITCH to %proper( @w_ffocus)};#hi;#input "CT W" 1} {#if (%lower( %2) == "w") {#var s_ffocus @ffocus;#var ffocus @w_ffocus;#var w_ffocus @s_ffocus;#unvar s_ffocus;#if (%isnumber( %left( @ffocus, 1))) {#sh SWITCH @ffocus} {#sh SWITCH %proper( @ffocus)};#hi} {#if (%isnumber( %left( %2, 1))) {#var ffocus %2} {#var ffocus %proper( %2)}}}};#gauge c_gauge @aknysp" at "%upper( @target)" - wwww - "%upper( @w_target) %eval( (%ismember( %left( @aknysp, 1), "q|f|n|c|t") * 100) - 100) 400 10 "" green red black;#if (@cspd(%1)) {c %case( %ismember( %lower( %1), "q|f|n|c|t"), "quick", "fast", "normal", "careful", "thorough") 'cure critic' @ffocus} {#if (%lower( %1) != "w") {c @aknysp 'cure critic' @ffocus}}}} {#if (%1) {#if (%upper( %1) == "CT") {c 'cure critic'} {#if (%isnumber( %1)) {#if (%pos( ".", @ffocus)) {#var ffocus %subregex( @ffocus, "\d+", "%1")} {#var ffocus %concat( %1, ".", @ffocus)};#gauge c_gauge @aknysp" at "%upper( @target)" - wwww - "%upper( @w_target) %eval( (%ismember( %left( @aknysp, 1), "q|f|n|c|t") * 100) - 100) 400 10 "" green red black;c @aknysp 'cure critic' @ffocus} {#if (@cspd(%1)) {c %case( %ismember( %lower( %1), "q|f|n|c|t"), "quick", "fast", "normal", "careful", "thorough") 'cure critic' @ffocus} {#if (%lower( %1) == "w") {#var s_ffocus @ffocus;#var ffocus @w_ffocus;#var w_ffocus @s_ffocus;#unvar s_ffocus;#if (%isnumber( %left( @ffocus, 1))) {#sh SWITCH @ffocus} {#sh SWITCH %proper( @ffocus)};#hi} {#if (%isnumber( %left( %1, 1))) {#var ffocus %1} {#var ffocus %proper( %1)}};c @aknysp 'cure critic' @ffocus;#gauge c_gauge @aknysp" at "%upper( @target)" - wwww - "%upper( @w_target) %eval( (%ismember( %left( @aknysp, 1), "q|f|n|c|t") * 100) - 100) 400 10 "" green red black}}}} {c @aknysp 'cure critic' @ffocus}};#if (@akapref.losefocus == 1) {#var ffocus ""};#class 0} "Spells"
#ALIAS RR {#class shared;#if (%null( @aknysp)) {#var aknysp normal};#if (%2) {#if (@cspd(%1) and @cspd(%2)) {#var aknysp %case( %ismember( %lower( %1), "q|f|n|c|t"), "quick", "fast", "normal", "careful", "thorough");#if (%3) {#var target %3;#if (%isnumber( %left( %3, 1))) {#var target %3} {#var target %proper( %3)};c @aknysp 'harm' @target};#sh i speed %upper( @aknysp);#hi;#input "RR" 1;#gauge c_gauge @aknysp" at "%upper( @target)" - wwww - "%upper( @w_target) %eval( (%ismember( %left( @aknysp, 1), "q|f|n|c|t") * 100) - 100) 400 10 "" green red black} {#if (%isnumber( %2)) {#if (%pos( ".", @target)) {#if (%lower( %1) == "w") {#var w_target %subregex( @target, "\d+", "%2");#sh ready SWITCH to @w_target;#hi;#input "RR W" 1} {#var target %subregex( @target, "\d+", "%2")}} {#if (%lower( %1) == "w") {#var w_target %concat( %2, ".", @target);#sh ready SWITCH to @w_target;#hi;#input "RR W" 1} {#var target %concat( %2, ".", @target)}}} {#if (%lower( %1) == "w") {#if (%isnumber( %left( %2, 1))) {#var w_target %2} {#var w_target %proper( %2)};#if (%isnumber( %left( @w_target, 1))) {#sh ready SWITCH to @w_target} {#sh ready SWITCH to %proper( @w_target)};#hi;#input "RR W" 1} {#if (%lower( %2) == "w") {#var s_target @target;#var target @w_target;#var w_target @s_target;#unvar s_target;#if (%isnumber( %left( @target, 1))) {#sh SWITCH @target} {#sh SWITCH %proper( @target)};#hi} {#if (%isnumber( %left( %2, 1))) {#var target %2} {#var target %proper( %2)}}}};#gauge c_gauge @aknysp" at "%upper( @target)" - wwww - "%upper( @w_target) %eval( (%ismember( %left( @aknysp, 1), "q|f|n|c|t") * 100) - 100) 400 10 "" green red black;#if (@cspd(%1)) {c %case( %ismember( %lower( %1), "q|f|n|c|t"), "quick", "fast", "normal", "careful", "thorough") 'harm' @target} {#if (%lower( %1) != "w") {c @aknysp 'harm' @target}}}} {#if (%1) {#if (%upper( %1) == "RR") {c 'harm'} {#if (%isnumber( %1)) {#if (%pos( ".", @target)) {#var target %subregex( @target, "\d+", "%1")} {#var target %concat( %1, ".", @target)};#gauge c_gauge @aknysp" at "%upper( @target)" - wwww - "%upper( @w_target) %eval( (%ismember( %left( @aknysp, 1), "q|f|n|c|t") * 100) - 100) 400 10 "" green red black;c @aknysp 'harm' @target} {#if (@cspd(%1)) {c %case( %ismember( %lower( %1), "q|f|n|c|t"), "quick", "fast", "normal", "careful", "thorough") 'harm' @target} {#if (%lower( %1) == "w") {#var s_target @target;#var target @w_target;#var w_target @s_target;#unvar s_target;#if (%isnumber( %left( @target, 1))) {#sh SWITCH @target} {#sh SWITCH %proper( @target)};#hi} {#if (%isnumber( %left( %1, 1))) {#var target %1} {#var target %proper( %1)}};c @aknysp 'harm' @target;#gauge c_gauge @aknysp" at "%upper( @target)" - wwww - "%upper( @w_target) %eval( (%ismember( %left( @aknysp, 1), "q|f|n|c|t") * 100) - 100) 400 10 "" green red black}}}} {c @aknysp 'harm' @target}};#if (@akapref.losefocus == 1) {#var target ""};#class 0} "Spells"
#ALIAS SPELLHELP {#sh " ";#forall @loadhelp1 {#sh %ansi( white) %i};#sh " "} "Spells"
#VAR loadhelp1 {BB %1 (%1 = a target)| casts default speed on target| assigns target %1|%cr| BB %1 (%1 = q f n c t)| casts with that temp speed at assigned target|%cr| BB q f n c t and %2| casts 'BB spell' at temp speed q f n c Or t at %2| assigns target %2|%cr| BB q q [%3]| set new default speed quick [cast BB at %3 (new target) right now]| inputs BB highlighted, this will fire on target with default speed changed|%cr| BB BB| casts in combat with no target at MUME set speed|%cr| BB 4| casts default speed 'spell' at 4.target| assigns current target at 4.target|%cr| BB w %2| does not cast| assigns switch to %2|%cr| BB w 4| does not cast| assigns switch of target as 4.target|%cr| BB w| casts default speed 'spell' at switch (keep switched)|%cr| BB q w| casts temp speed quick 'spell' at switch (keep switched)|} {_nodef} "Spells"
Reply with quote
Leitia
Adept


Joined: 04 May 2007
Posts: 292
Location: Boston

PostPosted: Thu Mar 05, 2009 9:28 pm   
 
this regex code can be used with the freeware NOTEPAD++

http://notepad-plus.sourceforge.net/uk/site.htm

NOTEPAD++ just stripped my spell model format to alias name & spell name. Useful to me just now when I went to list what spells I had.

check regex in the replace dialog.

replace:

Code:
#ALIAS (\w+) .+ '([A-Za-z ]+)'.+


with:

Code:
 \1 \2


Very Happy

(ya, missed remp)
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » Finished MUD Scripts 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