Need help writing a script

Posted by Pippysmurf on Wed 09 Apr 2003 11:59 PM — 22 posts, 80,644 views.

#0
I am playing various Btech muxs and I have no clue how to make a script I have read the mushclient help files and they do not explain things clearly enough for me to use them.

I want 2 scripts one that allows me to do the same things but in 2 different ways.

1. Would allow my combat unit to move up lock the target id i would put in before i moved. ie target id is AA so i type something then the unit move speed 10 on sight of target AA locks it fires guns then backs speed run. Then i can reset it and repeat

2. This one would be the same except the instead of backing I input the id then on sight of the target I would lock it and fire my guns then prone command would go through. Thanks for help with this.
Amended on Thu 10 Apr 2003 12:54 AM by Pippysmurf
Australia Forum Administrator #1
It would help if you posted some example output (copy and paste) so we could see what sort of triggers are required.
#2
I am not sure what you mean copy some output.

Bascily what I need is I type a command followed by the 2 leter case contact id which could for examle XY. when I do that, when the target XY comes in to view. I fire my guns the command would be .f then i want to enter the command speed back to be entered.

Triggers to base off..

You notice Aw Wolverine [CK] in your Forward arc.

This is the bad guy the id is CK in the brackets. so before i would see him I would want to be able to input ck so the the trigger/script would lock CK when i saw it.

Target set to Aw Wolverine [CK].

This is the emit you get after locking target CK

Then i want the trigger/script to sendout firetic 0

Firing weapons in tic #0!

That is the emit from firing then i want the trigger/script
to enter speed back

Then i want to be able to reset and repeat it with by entering the same or different target id.

The other thing I want to do is all the same except i want to the command to be PRONE after the firing weapons emit.


Australia Forum Administrator #3
It isn't totally clear what you want to do here, but this should get you started. The following trigger should do some of what you said:


<triggers>
  <trigger
   custom_colour="7"
   enabled="y"
   match="You notice * [*] in your * arc."
   send_to="12"
   sequence="100"
   variable="target"
  >
  <send>SetVariable &quot;target&quot;, &quot;%2&quot;
Send &quot;lock %2&quot;
Send &quot;firetic 0&quot;</send>
  </trigger>
</triggers>


This will detect "You notice * [*] in your * arc.", set a variable "target", and send two things to the MUD.

This should give you an idea of how to do the rest.

You need MUSHclient version 3.36 or up for this to work, as it relies on the "send to script" feature recently introduced.
#4
I am confused on where and how i input this info I upgraded to 3.34 but i dont see the send to script feature. If someone could be me some details on how to enter this data that would be very helpful.
USA #5
Sent to Script was only introduced in 3.36 and later, you'd need to upgrade to one of the later versions (As of this post, the latest is 3.38)

version 3.38 was released on wed, the 16th. You can scroll down and find the forum post to get the link to download it, or just go to the following URL:

http://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=2571&page=999999
Amended on Sun 20 Apr 2003 07:30 PM by Flannel
#6
ok, I have upgraded to 3.38 but I am still confused as to where this trigger data goes. Could someone please enlighten me? Yes I am coding retarded:)
Australia Forum Administrator #7
Copy from this web page between, and including, <triggers> and </triggers> to the clipboard.

Go into the trigger configuration window. The "paste" button will be active now. Click it. That will paste the trigger into it. Now edit it and inspect what it does.

#8
Thanks for your help thus far:) I have done what you said and tested the trigger. The only promblem that I am currently working on with no success is as follows.


It keeps adding onto the number of id's to lock on fire on when the client sees the target. I need to be able to have it only have 1 target id for it to remimber ie: the last one entered or an option to clear the buffer.

Any assitance with this would be very helpful.
Australia Forum Administrator #9
I am not sure why it is doing that - the SetVariable in the trigger only gets the last one. Do you need to do something in the MUD to unlock the previous one?
#10
there are 2 ways to unlock a target breaking sight on the "target" (which i did when testing the script), or typing "lock -" to clear a lock with out breaking sight on the "target".
#11
Also you can only have one "target" locked at a time. So their maybe mutiple possible "targets" but you can only lock and fire at one at any given time.
Australia Forum Administrator #12
In the trigger send text, then add (at the start):

Send ("lock -")

... to clear any existing locks.
#13
Ok well I did as you instructed. However, the promblem continues the script continues to repeat each "target id" I have entered. Starting with the first one I have entered and going through to the last one.

For example, I have entered 3 id's so far "AA", "AB", and "BB". It starts with "AA" then does "AB" and ending with "BB". If I input another target id it would repeat the process and put the latest ID after "BB". I need some means to clear out that buffer.
Australia Forum Administrator #14
What buffer are you referring to? Nothing I have done here will append to anything else.
#15
Well I dont know what buffer it would be. However the promblem continues. It cycles down the list of "target ID's" starting with the first one ever entered and cycling through them all until it does the last one (most recent) "target id" entered.

I need some means to correct this. So it only attempts to lock the "target id" that i enter each time and ignore all the previous ones.
Australia Forum Administrator #16
Can you copy and paste some output or something? I don't understand what you mean by "It cycles down the list" - what cycles? what list?
#17
Ok well I made a mistake in describing the problem.

It locks every "target" in sight and tries to shoot it. I want to be able to only enter 1 target id. Here is the info as requested.

You notice Aw Centipede [st] in your Forward arc.

The following are commands are sent from the trigger
lock -
lock st
firetic 0

The following are emits back from the mud
All locks cleared.
Target set to Aw Centipede [st].
Firing weapons in tic #0!

Then it repeats the process on the next target in Sight and continues until it runs out of targets.

I need to be able to limit what it shoots. By being able to enter the "target" id before I see it. Then the trigger should shoot nothing else until I regain sight on the target or enter a new target id.
Australia Forum Administrator #18
OK, I see it now. What you need is an alias to set the lock, like this:



<aliases>
  <alias
   match="target *"
   enabled="y"
   variable="target"
   send_to="9"
   sequence="100"
  >
  <send>%1</send>
  </alias>
</aliases>



This will set a target, eg. type "target CK".

Then the trigger matches that exact target, by using the variable "target" and variable expansion in the trigger:



<triggers>
  <trigger
   custom_colour="7"
   enabled="y"
   expand_variables="y"
   match="You notice * [@target] in your * arc."
   send_to="12"
   sequence="100"
   variable="target"
  >
  <send>Send &quot;lock -&quot;
Send &quot;lock @target&quot;
Send &quot;firetic 0&quot;</send>
  </trigger>
</triggers>

#19
Thanks for your help. That works great. I do have 1 more question how can I add one more command line at the end I want to speed back. How can and another command in the trigger?
Australia Forum Administrator #20
If you convert &quot; to " in the trigger text above, the trigger "send" box will look like this:


Send "lock -"
Send "lock @target"
Send "firetic 0"


To add another command, simply put another "send" command there, eg.


Send "laugh"

Canada #21
Dealing with battletech I know there was talk about here posted here..

http://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=1515

As well as If you want somethat works well for battletech check out Mav's BTSuite at..

www.mavsoft.net/

The BTSuite works verywell for any sort of addons you could want with Btech.
And last I recall was easy to configurate to do anything special you wanted it to.