Re: Looking for some Scripts

From: Mark A. Heilpern (mark@heilpern.com)
Date: 02/02/00


At 11:27 PM 2/1/00 -0500, you wrote:
>I have been trying to make a few scripts with no luck.
>
>Does anyone (or is anyone willing to) have some scripts basic ones that
>work
>to send to the list for others to use as examples?

There are a >few< basic ones in your DG patch; look at 0.trg.


>What is the "return value", and how do you "return" something other than
>0?

Different trigger types have different meanings for the return value; check
the docs at http://www.mindspring.com/~heilpern/dgscripts. To >specify<
the return value, you use the return command. I.e.,
     return 1
will >specify< that >when< the script returns, the return value will be 1
(unless subsequently changed with another return command). This is
counter-intuitive to most of us who program in C, thinking the return
command should >cause< a return to occur.

So, the question is >when< does the script return? The answer is, of
course, dependent on the script. Actually, any given script can return
multiple times, so what is important to realize is it's only the >first<
time a script returns that the return value is actually used.

 >How< does a script return? Three ways -- running out of commands
to execute, executing the halt command, and, the not-so-obvious
way: executing the wait command. Why the wait command? If that
didn't cause a return, the mud would be waiting for a return value while
your script went through its timing motions, trying to make things look
smooth (instead of jumbled together), defeating the purpose of the
wait command completely.


[snip]


>1) Name         : teleport
>2) Intended for : Rooms
>3) Trigger types: Command
>4) Numberic Arg : 4
>5) Arguments    : enter
>6) Commands:
>if (%arg% == "hole")
>    oteleport %actor% 7200
>
>also just tried it without the if statement.
>tried "%arg%"
>tried various combinations of room triggers, object triggers
>with no luck.

Make sure you're not an imm when testing command triggers; since
a command trigger can prevent you from issuing valid commands,
the code (by default) ignores command triggers for imms.

Also, don't forget about the world's oldest and most-often-used
debugger, printf(). Change your commands to comsthing like:

%echo% teleport trigger is starting.
%echo% arg is %arg%
%echo% actor is %actor.name%
if (%arg% == "hole")
    oteleport %actor% 7200
%echo% teleport trigger is exiting.



Ok, so it might be excessive, but you get the point.





Now, for anyone who's made it this far... I am on the verge of
releasing several DG Scripts patches -- pl7b, 7c, 7d, and pl8,
all simultaniously. 7b is basically Cris Jacobin's patch for
bpl16 + Oasis 2.0 + DG 7a. 7c is the same, for bpl17. 7d
is the same again, with the zedit options for trigger/
variable assignment put back in. 8 is the latest-and-greatest
(incorporating bug fixes submitted since 7/7a and a new
trigger type -- time-of-(mud)-day triggers, as well as a few
code submissions from various people.

I am interested in getting beta testers for these patches; if
you are interested, please send me mail -- directly to me, so as
to not spam the list!


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html  |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 04/10/01 PDT