Building & Scripting > Scripting Board

Advanced Scripts

<< < (8/10) > >>

Kvetch:
35. %PURGE% RULES



for objects:

 when the item is worn use: %purge% %self%

 otherwise use: %purge% %self.name%



for mobs:

 %purge% without arg won't make the mob purge itself, but everything else in the room.

 To make a mob get rid of itself use: %purge% self



containers:

 If you want a script to purge a container with content, you need to purge twice,

 otherwise the content will ne on the floor.



OBS!!!!

mjunk is a safer way of purging mob inventory. (leaves no room message).

The %purge% scripts have a tendency to screw things up after the code update,

since they now can do a purge even outside the room where the mob is.

So the command line

%purge% sword

would purge the first sword it finds in the WHERE list, which might be disastrous.

This happens especially if there is no ball in the room with the script, because

someone took it away, or whatever. This is one reason for the weird equip bug where

certain items would inexplicably disappear from a player's inventory.



Go easy on the %purge% script, and consult a head builder about how to use them!

Kvetch:
36. COMMAND TRIGGERS

1. Command triggers don't work for immortals, so you need a mort to test

   those scripts, or use

   atlev 50 >command>

2. If the command line is one of the usual mudcommands, you need to bypass

   it by setting the trigger up like this:



Trigger Intended Assignment: Rooms

Trigger Type: Command , Numeric Arg: 100, Arg list: *

Commands:

if %cmd.mudcommand% == sit

 %send% %actor% Go hang out somewhere else.

 %teleport% %actor% 3000

else

 return 0

endif



3. You can also set the command arg in 2 steps, like this:



Trigger Type: Command , Numeric Arg: 100, Arg list: push

Commands:

if boulder/=%arg||stone/=%arg%

 wait 1 s

 %echo% The boulder reluctantly rolls to one side.

else

 wait 1 s

 %send% %actor% push what?

endif

Kvetch:
37. SET PLAYER FLAGS WITH SCRIPTS



example:

nop %actor.is_killer(on)%



------------

SOME UNSORTED EXAMPLES:



THIEF_ASSASSIN SCRIPT

Name: 'Near Death Trap Mahatma - 6318',  VNum: [ 6300], RNum: [  618]

Trigger Intended Assignment: Mobiles

Trigger Type: Greet , Numeric Arg: 100, Arg list: None

Commands:

* Near Death Trap stuns actor and takes all of their equipment.

wait 3 sec

say Here, have a quick trip to Hell.

wait 2 sec

%send% %actor% Mahatma plunges a black dagger into your back and takes all

your equipment.

%echoaround% %actor% Mahatma plunges a black dagger into %actor.name%'s back

and takes all of %actor.hisher% equipment.

eval stunned %actor.hitp%

%damage% %actor% %stunned%

while %actor.inventory%

  eval item %actor.inventory%

  eval item_to_purge %%actor.inventory(%item.vnum%)%%

  eval stolen %item.vnum%

  %purge% %item_to_purge%

  %load% obj %stolen%

done

eval i 0

while %i% < 18

  eval item %%actor.eq(%i%)%%

  if %item%

    eval stolen %item.vnum%

    eval item_to_purge %%actor.eq(%i%)%%

    %purge% %item_to_purge%

    %load% obj %stolen%

  end

  eval i %i%+1

done



----------

This script makes a mob load and hand out random objects.



Name: 'trick or treat',  VNum: [37522], RNum: [ 4109]

Trigger Intended Assignment: Mobiles

Trigger Type: Speech , Numeric Arg: 1, Arg list: trick treat

Commands:

wait 1s

if !%actor.inventory(34016)%

shout Get lost you beggar!

halt

end

say Oh my! Don't you look .. uhh.. how do you look? Well, anyway, nice get up.

em goes to get the treat bowl.

wait 4s

em comes back holding a huge bowl filled to the brim with all sorts of things.

wait 2s

em digs in the bowl and pulls something out.

set obj1 11060

set obj2 37571

set obj3 13315

set obj4 37572

set obj5 17430

set obj6 32089

set obj7 37573

set obj8 14771

set obj9 37574

set obj10 22360

set obj11 12300

set obj12 37575

set obj13 37547

set obj14 37576

set obj15 37577

eval obj %%obj%random.15%%%

%load% obj %obj%

wait 1s

eval object %self.inventory%

eval objname %object.name%

give %objname.car% %actor.name%

say There you go! Enjoy!

end

Kvetch:
38. RANDOM SPELLS ON A POTION



Name: 'A Potion of Many Things',  VNum: [10116], RNum: [ 2467]

Trigger Intended Assignment: Objects

Trigger Type: Load , Numeric Arg: 100, Arg list: None

Commands:

set spell_list 1 3 4 12 14 15 16 17 18 19 20 21 28 29 33 34 36 38 39 41 43 44

46 50 51 56 57 58 59 60

extract oval %random.30% %spell_list%

osetval 1 %oval%

extract oval %random.30% %spell_list%

osetval 2 %oval%

extract oval %random.30% %spell_list%

osetval 3 %oval%

global oval

%echo% The drink bubbles and foams.

Kvetch:
39. SEX CHANGE AND ABORTION PILLS

OBS! You can have no waits in consume triggers!



#44603

fertility pill~

1 s 100

~

%send% %actor% You swallow a fertility pill.

%echoaround% %actor% %actor.name% hopefully swallows a fertility pill.

if %actor.sex% == female

 nop %actor.is_pregnant(on)%

 %send% %actor% It seems the Goddess Illythia made your wish come true!

 %echoaround% %actor% It seems the Goddess Illythia made %actor.name%'s wish come true!

else

 %send% %actor% Only females can get pregnant, you dork!

 %echoaround% %actor% What a dork! Next he'll ask for an abortion, no doubt.

endif

~



#44609

abortion pill~

1 s 100

~

%send% %actor% You swallow a fertility pill.

%echoaround% %actor% %actor.name% hopefully swallows an abortion pill.

if %actor.sex% == female

 nop %actor.is_pregnant(off)%

 eval amount (%actor.hitp%/2)

 %damage% %actor% %amount%

 %send% %actor% You feel a wave of nausea and a searing pain.

 %send% %actor% It's taken care of. But next time use a contraceptive instead!

 %echoaround% %actor% Really - you'd think people could use contraceptives instead!

else

 %send% %actor% Just use a condom, you dork!

 %echoaround% %actor% What a dork! Next he'll ask for a pregnancy pill, no doubt.

endif

~



num arg 2

if %cmd.mudcommand%==eat

 if ((%arg% == meat)||(%arg% == meatball))

  if %actor.sex(female)%

   nop %actor.sex(male)%

   %echo% %actor.name% eats the meatballs.

   %echo% %actor.name% has become a GIRL!

   %purge% %self%

  elseif %actor.sex(male)%

   nop %actor.sex(female)%

   %echo% %actor.name% eats the meatballs.

   %echo% %actor.name% has become a BOY!

   %purge% %self%

  endif

 else

  return 0

 endif

else

 return 0

endif

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version