Help - Search - Members - Calendar
Full Version: Question about creating triggers
BatMUD > BatMUD forums > Batclient
byrdheart
Hello
I am new to BatMud and new to the Java environment. How do I create simple scripts, ie a script that would get all from the corpse of a monster? I looked a little into the helpfiles and they weren't very explicit so I thought that it would probably be better to ask a person. My question really is more about the syntax for the command.

/trig trigname 'name of trigger' (then there should be something like input from mud) (action taken by client)

Thank you for your help.

Sincerely,
Masahiro Matsumoto
Nosunrise
You might want to check Era's triggers for clues... although I looked and didn't understand a thing :D

I think the best way is to ask on newbie channel and hope that someone has already learned how to make trigs.
(The BatClient is fairly new, so trigger knowledge might not be that common yet)

Askan
I've delved into it and here's what I came up with.

First, the script reload command does not seem to work properly. To get my scripts to run correctly after modification I had to close the client and open it again.
I think this has something to do with the fact my script gets defined in the bootup section.

So here's my minimal script.
//START HERE

SCRIPT_NAME = "sample";
SCRIPT_DESC = "Minimal script.";
SCRIPT_OFF = false;

void bootup() {
triggerManager.newTrigger("sampletrig",
"is DEAD, R.I.P.$",
"smile",
false, false, false,
null, Font.PLAIN);
}

//END HERE

To use open a new script window, copy the code in and save the script. When the client is reloaded the script becomes active.
If you have multiple scripts you can define them all in one file (by repeated calls to the triggerManager.newTrigger). Its important that your SCRIPT_NAME variable is unique and the trigger names (in this case "sampletrig") are also unique.

In my example here you can see the text being searched for "is DEAD, R.I.P.$". The $ sign means match the end of the line, I just put it in there so it doesn't work with people saying "is DEAD, R.I.P.".
The next part is what you want to do when the trigger matches the "is DEAD, R.I.P.$" string. In this case its just "smile". Any command can be here, and multiple commands can be seperated with the ; as usual.

So thats my very minimal script. You can do a lot more with functions, variables etc and I've really only just started exploring it. I much prefer it to the scripting languages in Zmud but I guess thats just going to be a personal preference based on where your skillset lies.

Cheers,
Askan
kogack
Is there an existing help file for triggers? or even a site that explains them more fully?
Calmar
The client itself has helps on triggers. They can be found at Help -> Game Client Help.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2024 Invision Power Services, Inc.