Lydin's free zMUD scripts

by lydin

Back to Mechanic's Corner.

lydin2007-01-02 23:26:48
First, something simple.

Script: Potion refills

Purpose: Makes refilling vials from kegs or alembics easier. Finds a list of the empty ones and runs through it. Useful if you have several kinds of vials and REFILL EMPTY FROM HEALING doesn't work, or if you're an Alchemist.

Usage: Use POTIONLIST to populate the list of empty vials. Then just FILL . The script will send FILL # FROM to the mud, where # is your next empty vial and tell you how many empties you have left.
Example: POTIONLIST, MORE, FILL HEALING, FILL HEALING, FILL MANA

CODE

#CLASS {potions}
#ALIAS fill {refill %item(@filllist, 1) from %1}
#VAR filllist {} {}
#TRIGGER {^(%d)%s*%sempty%s%d%s%d$} {#additem filllist %1}
#TRIGGER {^You pay %d gold to refill a %w vial} {#DELN filllist 1;#SHOW %numitems( @filllist) empty vials left}
#CLASS 0


Of course you need the Potionlist ability. If someone wants a version that uses INFO INV and PROBEs because they don't have Potionlist, no problem, let me know. That's what I do for enchantments.
Erylan2007-01-02 23:53:49
Nice.

How about one the counts weevils/rats and how much they're worth?
Kharaen2007-01-03 00:18:35
Here's my rat/weevil counter:

CODE

#CLASS {Vermin}
#VAR attack {jab}
#VAR tg {weevil}
#CLASS 0
#CLASS {Vermin|Weevils}
#ALIAS sa {sell weevils to abeytu;#var fgreens 0;#var greds 0;#var hgreens 0;#var lreds 0;#var lwoods 0;#var totvalue 0;#var totweevils 0;pg}
#VAR lreds {000} {000}
#VAR greds {000} {000}
#VAR lwoods {000} {000}
#VAR fgreens {000} {000}
#VAR totweevils {0000} {0000}
#VAR totvalue {0000} {0000}
#VAR hgreens {000} {000}
#TRIGGER {^A (%w) (%w) weevil skitters in from the shadows of the forest.$} {@attack @tg;@attack @tg}
#TRIGGER {^Covered in wood pulp, a (%w) (%w) weevil scuttles in, its long proboscis} {@attack @tg;@attack @tg}
#TRIGGER {^A hole opens up in a nearby tree as a (%w) (%w) weevil burrows out} {@attack @tg;@attack @tg}
#TRIGGER {^You pick up the corpse of a (%w) (%w) weevil.} {#IF (%1=lumbering & %2=red) {#add lreds 1;#add totvalue 14};#IF (%1=giant & %2=red) {#add greds 1;#add totvalue 21};#IF (%1=large & %2=wood) {#add lwoods 1;#add totvalue 7};#IF (%1=fat & %2=green) {#add fgreens 1;#add totvalue 28};#IF (%1=hulking & %2=green) {#add hgreens 1;#add totvalue 35};#add totweevils 1}
#TRIGGER {^Searching for wood, a (%w) (%w) weevil wanders into view.$} {@attack @tg;@attack @tg}
#CLASS 0
#CLASS {Vermin|Rats}
#VAR brats {000} {000}
#VAR yrats {000} {000}
#VAR rats {000} {000}
#VAR orats {000} {000}
#VAR blrats {000} {000}
#VAR totalrats {0000} {0000}
#VAR ratvalue {0000} {0000}
#TRIGGER {^You pick up the corpse of (a|an) (%w) rat.$} {#IF (%2=baby) {#add brats 1;#add ratvalue 7};#IF (%2=young) {#add yrats 1;#add ratvalue 14};#IF (%2=old) {#add orats 1;#add ratvalue 28};#IF (%2=black) {#add blrats 1;#add ratvalue 35};#ADD totalrats 1}
#TRIGGER {^You pick up the corpse of a rat.$} {#add rats 1;#add totalrats 1;#add ratvalue 21}
#CLASS 0
Erylan2007-01-03 00:24:32
Oh! Thanks.
lydin2007-01-03 03:49:15
CODE
#TRIGGER {^A (%w) (%w) weevil skitters in from the shadows of the forest.$} {@attack @tg;@attack @tg}


Is that legal? Or is it considered like harvesting everything in the room? - ok as long as you don't autowalk too.
Kharaen2007-01-03 03:55:56
I don't autowalk. I'm at the screen 100% of the time, unless I'm in my manse. Then I'm at the screen 10% of the time tongue.gif
Kharaen2007-01-03 05:50:09
What I'd like is a script that shows how much mana/health/ego that is lost/gained.
lydin2007-01-03 06:10:21
QUOTE(Kharaen d'Attai @ Jan 3 2007, 12:50 AM) 368898

What I'd like is a script that shows how much mana/health/ego that is lost/gained.


Displays a line after the prompt showing positive or negative changes in health, mana, and ego when they occur:
CODE

#TRIGGER {^&%d{NewHealth}h,%s&%d{NewMana}m,%s&%d{NewEgo}e,%s%dp,%s%den,%s%dw} {#IF (@NewHealth!=@OldHealth | @NewMana!=@OldMana | @NewEgo!=@OldEgo) {#SHOW Health: %eval( @NewHealth-@OldHealth) Mana: %eval( @NewMana-@OldMana) Ego: %eval( @NewEgo-@OldEgo)};#VAR OldHealth @NewHealth;#VAR OldMana @NewMana;#VAR OldEgo @NewEgo} "" {nocr|prompt}



Is that what you meant? Or did you want something else?

You could also have it display the numbers every time but color them red or green when they increase or decrease, or display them in a status bar or whatever. You get the idea for the basic mechanism.




Oh, and about the legality thing. I just meant was it cool to kill things automatically as soon as they entered the room? My wording was poor.
Kharaen2007-01-03 07:25:45
Now how about a time stamp?
Shorlen2007-01-03 10:29:29
Here is my prompt trigger. It both displays changes in health/mana/ego on the prompt itself (colour-coded for positive/negative/zero), but also can display timestamps when desired. You can modify the timestamp format all you wish. Of course, everything after the #var promptcheck %7 line is system-specific.

CODE
#REGEX {^(\\d+)h, (\\d+)m, (\\d+)e, (\\d+)p, (\\d+)en, (\\d+)w (+)} {
  #var change no
  #if (@health!=%1) {
    change=yes
    healthchange=%eval( %1-@health)
    } {healthchange=0}
  #if (@mana!=%2) {
    change=yes
    manachange=%eval( %2-@mana)
    } {manachange=0}
  #if (@ego!=%3) {
    change=yes
    egochange=%eval( %3-@ego)
    } {egochange=0}
  #if (@change="yes") {#echoprompt %ansi( 11)~}
  #if (@timestamping) {#echoprompt %ansi( 7) %time( "")}
  #var health %1
  #var mana %2
  #var ego %3
  #var endurance %5
  #var willpower %6
  #var promptcheck %7
  #if (@maybereckless) {
    #if (@health=@maxhealth and @mana=@maxmana and @ego=@maxego) {reckless} {#if (@maybehypo) {hypochondria}}
    maybereckless=0
    }
  maybehypo=0
  #var able 1
  #if (%pos( e, @promptcheck)) {#var eq 1} {
    #var eq 0
    #var able 0
    }
  #if (@character.armbals) {
    #if (%pos( l, @promptcheck)) {#var larmbal 1} {
      #var larmbal 0
      #var balance 0
      #var able 0
      }
    }
  #if (%pos( x, @promptcheck)) {#if (@character.armbals) {#if (@larmbal and @rarmbal) {
        balance=1
        #if (@eq and (@afflict.crucified or @afflict.impaled) and (@writhing="false"))
        } {runwr} {balance=0}} {balance=1}} {
    #var balance 0
    #var able 0
    }
  #if (@eq and @balance and (@afflict.crucified or @afflict.impaled) and (@writhing="false")) {runwr}
  #if (%pos( d, @promptcheck)) {#if (@sixthsense="False") {#if (!%ismember( deaf, @herbafflicts)) {deaf}}} {#delitem herbafflicts deaf}
  #if (%pos( b, @promptcheck)) {
    maybeblind=0
    #if (@sixthsense="False") {#if (!%ismember( blind, @herbafflicts)) {blind}}
    } {
    #if (@maybeblind) {
      maybeblind=0
      hypochondria
      }
    #delitem herbafflicts blind
    }
  #if (%pos( p, @promptcheck)) {#var proned 1} {
    standup=0
    #suspend standupa
    #var proned 0
    #var afflict.paralysed 0
    }
  #if ((@able and @proned) and (@standup and !@aeon)) {
    standup=0
    stand
    #alarm standupa +1.5 {standup=1}
    }
  #if (@akafe) {#if (%pos( k, @promptcheck)) {#delitem herbafflicts nokafe} {#if (!%ismember( nokafe, @herbafflicts)) {nokafe}}}
  #if (@balance and @eq and !@proned) {able=1} {able=0}
  sipcheck
  #if (@antiskunk) {
    antiskunk=0
    #t- mscantrig
    #t- mscenttrig
    #t- scenttrig
    #if (%numitems( @scannedpeople)) {
      #echo %null
      #fo @scannedpeople {#echo %ansi( 46) !!! WARNING! %ansi( 47)%i%ansi( 46) is in SKUNKED location !!!}
      }
    }
  } "" {nocr|prompt}
Kharaen2007-01-04 05:41:55
That crashed my ZMUD :/
lydin2007-01-04 05:53:44
Nice. Always wanted a timestamp but never took time to code one. Thanks biggrin.gif .

I did write a simple little timer script that I've found useful for stopwatch type things (usually for an estimation of how long the longer task is going to take), like how long it takes me to empower a guard, or to harvest 50 herbs, or to gain 1% exp, etc. 'course with a time stamp you could just scroll up, look, and subtract.

Just type or trigger the TIMER alias and it displays time elapsed between firings.

CODE

#CLASS {time}
#ALIAS timer {#var oldtime @newtime;#var newtime {%time(n)|%time(s)|%time(z)};#mat elapsed (@newtime.1-@oldtime.1)*60000+(@newtime.2-@oldtime.2)*1000+(@newtime.3-@oldtime.3);#eval @elapsed/1000 . @elapsed\\1000}
#VAR newtime {}
#VAR oldtime {}
#VAR elapsed {}
#CLASS 0


Yeah, not hard, but maybe someone's lazy or a novice wants to time their weevil fights happy.gif
Shorlen2007-01-05 17:04:03
If all you want is the timestamp, this is the line for it in the prompt trigger:

#if (@timestamping) {#echoprompt %ansi( 7) %time( "")}

And then I have aliases to turn timestamping on and off.
Laysus2007-01-05 22:50:00
*hijacks*

I can't be bothered to start a new thread for this, so I thought I'd post it here. If you're going to use it, remember it needs a bit of tweaking to make sure that the sbqueue alias fires whenever you regain balance (the bal_newact and bal_delact bits it has in it add and remove it from the relevant queues to do that in my system)

For all those forestals looking for easy spiritbonding.

CODE

#CLASS {spiritbonding}
#ALIAS spirit {#var totems_list {squirrel|night|skunk|sun|rock|moon|crow|tree|groundhog|trout|wolf|bear|stag|monkey|horse|river|snake};#var totems_temp @totems_list;bal_newact sbqueue;#var totems_waiting ""}
#ALIAS sbqueue {#if (%null( @totems_temp)) {bal_delact sbqueue} {spiritbond %item( @totems_temp, 1)}}
#TRIGGER {^You call upon the spirit of squirrel to provide sustenance for you. You cannot $} {}
#COND {^stifle a giggle as you are tickled by tiny paws running over your skin.$} {#delitem totems_temp squirrel} {within|param=1}
#TRIGGER {^You are already bonded with that totem spirit.$} {spirits}
#TRIGGER {^You call upon the spirit of mother night to hide you. Her dark presence makes $} {}
#COND {^your skin crawl.$} {#delitem totems_temp night;#delitem totems_waiting night} {within|param=1}
#TRIGGER {^You call upon the spirit of skunk. You wrinkle your nose as his musky presence $} {}
#COND {^envelops you.$} {#delitem totems_temp skunk} {within|param=1}
#TRIGGER {^You call upon the spirit of moon and a soft shaft of moonlight beams down upon $} {}
#COND {^you, filling you with power.$} {#delitem totems_temp moon;#delitem totems_waiting moon} {within|param=1}
#TRIGGER {^You call upon the spirit of crow and feel oily black feathers caress your skin, $} {}
#COND {^making you shudder.$} {#delitem totems_temp crow} {within|param=1}
#TRIGGER {^You call upon the spirit of tree to heal you. A gentle breeze carries a rich and$} {}
#COND {^loamy scent which invigorates you.$} {#delitem totems_temp tree} {within|param=1}
#TRIGGER {^You must be in the presence of your commune's mystic tree to bond with tree $} {}
#COND {^spirit.$} {#delitem totems_temp tree} {within|param=1}
#TRIGGER {^You call upon the spirit of groundhog to grant you the gift of burrowing. Your $} {}
#COND {^nostrils fill with the scent of earth and a claw brushes your cheek gently.$} {#delitem totems_temp groundhog} {within|param=1}
#TRIGGER {^You call upon the spirit of rainbow trout, and a fine spray of water cools your $} {}
#COND {^skin.$} {#delitem totems_temp trout} {within|param=1}
#TRIGGER {^You call upon the spirit of bear and feel a powerful rush of strength course $} {}
#COND {^through your veins. You let loose a vigorous roar of exhilaration.$} {#delitem totems_temp bear} {within|param=1}
#TRIGGER {^You call upon the spirit of stag and your scalp itches as invisible antlers $} {}
#COND {^sprout from your head.$} {#delitem totems_temp stag} {within|param=1}
#TRIGGER {^You call upon the spirit of monkey and surrender yourself to a sudden urge to $} {}
#COND {^drag your knuckles on the ground and whoop.$} {#delitem totems_temp monkey} {within|param=1}
#TRIGGER {^You call upon the spirit of horse and an electrifying surge of energy ripples $} {}
#COND {^through your legs, forcing you to neigh loudly.$} {#delitem totems_temp horse} {within|param=1}
#TRIGGER {^You call upon the spirit of snake and feel cool silky coils winding over your $} {}
#COND {^skin.$} {#delitem totems_temp snake} {within|param=1}
#TRIGGER {^You call upon the spirit of the river daughter and laugh joyously as water $} {}
#COND {^swirls over your body.$} {#delitem totems_temp river} {within|param=1}
#TRIGGER {^You call upon the spirit of the great rock to ground you to the earth, and you $} {}
#COND {^feel your feet become encased in clay.$} {#delitem totems_temp rock} {within|param=1}
#TRIGGER {^You call upon the spirit of sun and a warm ray of sunlight infuses you with $} {}
#COND {^confidence.$} {#delitem totems_temp sun;#delitem totems_waiting sun}
#TRIGGER {^You call upon the spirit of wolf to give you courage. As the power of Wolf $} {}
#COND {^infuses you, you let out a howl of the wild.$} {#delitem totems_temp wolf} {within|param=1}
#TRIGGER {SPIRITS~:} {#var totems_waiting "";#var totems_list {squirrel|night|skunk|sun|rock|moon|crow|tree|groundhog|trout|wolf|bear|stag|monkey|horse|river|snake};#var totems_temp @totems_list}
#COND {~(None~)} {#var spirits ""} {within|param=1}
#TRIGGER {^It must be day to bond with sun spirit.$} {#delitem totems_temp sun;#additem totems_waiting sun}
#TRIGGER {^You must be standing in the mountains to bond with rock spirit.$} {#delitem totems_temp rock}
#TRIGGER {^It must be night to bond with moon spirit.$} {#delitem totems_temp moon;#additem totems_waiting moon}
#TRIGGER {^It must be night to bond with mother night.$} {#delitem totems_temp night;#additem totems_waiting sun}
#TRIGGER {^You must be swimming in a river or fresh water lake to bond with river spirit.$} {#delitem totems_temp river}
#TRIGGER {^The spirit of squirrel grants you the ability to forage.$} {#delitem totems_temp squirrel}
#TRIGGER {^During the dark hours, the spirit of mother night will conceal you.$} {#delitem totems_temp night;#delitem totems_waiting night}
#TRIGGER {^The spirit of skunk grants you the dubious gift of stink.$} {#delitem totems_temp skunk}
#TRIGGER {^The spirit of rock will help root you to the earth.$} {#delitem totems_temp rock}
#TRIGGER {^Make others flee with the power of the spirit of crow.$} {#delitem totems_temp crow}
#TRIGGER {^Burrow through the ground with the spirit of groundhog.$} {#delitem totems_temp groundhog}
#TRIGGER {^In the presence of mystic trees, be healed by virtue of the spirit of tree.$} {#delitem totems_temp tree}
#TRIGGER {^You gain the ability to trueswim and breathe underwater by the spirit of trout.$} {#delitem totems_temp trout}
#TRIGGER {^The spirit of bear grants you great strength.$} {#delitem totems_temp bear}
#TRIGGER {^Run free and fast like the spirit of stag.$} {#delitem totems_temp stag}
#TRIGGER {^The spirit of monkey grants you the ability to move about the trees.$} {#delitem totems_temp monkey}
#TRIGGER {^Leap over obstacles by virtue of the spirit of horse.$} {#delitem totems_temp horse}
#TRIGGER {^While in the waters of a raging river, the spirit of river will heal you.$} {#delitem totems_temp river}
#TRIGGER {^Under the night sky, your mana replenishes, a gift from the spirit of the moon.$} {#delitem totems_temp moon;#delitem totems_waiting moon}
#TRIGGER {^Resist venoms by virtue of the spirit of snake.$} {#delitem totems_temp snake}
#TRIGGER {^By the grace of the spirit of the sun, your ego shall replenish during the day.$} {#delitem totems_temp sun;#delitem totems_waiting sun}
#TRIGGER {^Find courage within yourself by the spirit of wolf.$} {#delitem totems_temp wolf}
#CLASS 0
Unknown2007-02-27 17:39:18
it doesn't work
bal_newact sbqueue isn't defined as anything
Laysus2007-02-28 02:39:30
Whoops. I just realised that it's slightly more based on my sys than I thought.

Don't use that for now, I'll figure out some way to work it on a standard thing >.>
Sylvanis2007-04-28 13:21:36
Looking for basic programming of a room, including descriptions, items in it...maybe some weather effects.....

Kinda new to this sort of thing...and Creating my own zMUD program...

Any help is appreciated...

Preferably in C++ though.....


Sylvanis
Unknown2007-04-28 14:29:25
QUOTE(sylvanis @ Apr 28 2007, 09:21 AM) 402316
Looking for basic programming of a room, including descriptions, items in it...maybe some weather effects.....

Kinda new to this sort of thing...and Creating my own zMUD program...

Any help is appreciated...

Preferably in C++ though.....


Sylvanis



I'm not sure what you mean by this, but I have code to capture room names, descriptions, and exits in zMUD. There is a C++ mapper program available (which I am helping to adapt to Lusternia), also, but it doesn't capture descriptions or items.