Im looking for a way to easily tally backstabs on the mud i play. Mainly im looking for a way to see the total % of backstabs i hit/miss. Can anyone give me a hand in accomplishing this? I would hate to even think about firing up MM and be subject to its slowness to accomplish this. :P
Can you give a bit of example MUD output? In any case, it sounds like you need a couple of triggers, one that matches on a successful backstab, and one on an unsuccessful one. They would call a script like this:
I'll have a thrash at it. I have to do this over 2 posts because the first was too big! lol! Ok, I'm assuming here you don't have an existing script and know nothing of how to set up triggers scripts variables and aliases, so I'm making it as basic as I can, and the script is in vbs if you have an existing one.
First of all, the easier way to make a trigger in my opinion is to hit Shift+Ctrl+8 together when you're logged on the mud and you'll get a box pop up for adding triggers. Click the 'add' button near the bottom and you'll have another box pop up. At the top of this box where it says Trigger: you can write in whatever it is that is going to set the trigger off, so in your case you'd want to write in there
* makes a strange sound as you place the * in his back!
The * there just allows for the fact that the mob name is going to vary, and maybe the weapon you're stabbing with will change in time too. In the check boxes down the left make sure the Enabled box is checked. Down the bottom of this box you'll see a field to fill in called 'Script:' , this is telling the trigger that whenever the above line appears for a successful stab, it will call a script. Type in here
GoodStab
Now click the ok button. It will probably give you an error saying there is no script called 'goodstab' but that's no worries, just click ok because you haven't written the script (or sub-routine) yet.
Now you need to do the exact same process as above, but in the trigger field write
* manages to avoid your backstab
and where it says 'Script' down the bottom, type
BadStab
again you'll probably get the same error message, no worries just click ok.
Now you need to set up variables. Scripts will set them up automatically, but I'll get you to do this manually so you know where they are. The variables in this case just serve as a recording of how many good and bad stabs you have. (note: you can go into this area and set them both back to zero at anytime you want as well) This is how ya do it; enter Shift+Ctrl+7 all together and you'll get a box pop up showing all your variables. Click the 'add' button near the bottom and you'll get another box open up. Where it has a field to enter name, write
GoodStabCounter
and in the big area below it labelled 'Contents' just enter a 0 (zero). Click the 'ok' button. That variable is now set up and ready to start counting. Do the exact same process again, but name it
BadStabCounter
kewl. click 'ok' at the bottom and the box will close. Done.
The next thing to do is write the script. The script is basically just a collection of all your subroutines written on one page. The way I do it to start off with is to just open a blank notepad window on your computer and start typing.
Open a notepad window and type (or cut and paste) the following subroutines: (this is a long winded way to do it probably, but it's a bit clearer to see what's going on I think) Note: if you already have a script, then you'll be adding this stuff on to that existing notepad page, not creating a new one.
sub GoodStab (thename, theoutput, thewildcards)
dim oldtotal
dim newtotal
oldtotal = World.GetVariable("GoodStabCounter")
newtotal = (oldtotal + 1)
World.SetVariable "GoodStabCounter", newtotal
end sub
sub BadStab (thename, theoutput, thewildcards)
dim oldtotal
dim newtotal
oldtotal = World.GetVariable("BadStabCounter")
newtotal = (oldtotal + 1)
World.SetVariable "BadStabCounter", newtotal
end sub
Now save this notepad window as 'myscript.vbs' into one of your folders, preferably the folder titled 'scripts' on your computer inside the MUSHclient folder. If you already have a script, you'll just be adding the above to it and saving.
You now need to add this script to your world so whenever you log on to the mud it will load this script as well. While still logged in to the mud (or at least with the world open), hit Shift+Ctrl+6 together and you'll have the scripts window open up. At the top where it says 'Scripting Language', make sure that is set to VBscript, and that the checkbox to the right called 'Enable script' is ticked. On the next line down is a field titled 'Script File:'. Click the browse button to the right of it and browse through to the notepad document you created titled 'myscript.vbs' (or whatever you called it if you had an existing script) and select it and click 'open', and then click 'ok' down the bottom and the script box will go away.
Right, you are now up and running and the stabcounters should now all be working. Now what you need to do is write an alias and yet another script which will display your counters and calculate the success %.
Right, you are now up and running and the stabcounters should now all be working. Now what you need to do is write an alias and yet another script which will display your counters and calculate the success %.
Hit Shift+Ctrl+9 together and a the alias window will pop up for you. Click the 'add' button near the bottom and another box (window) will open. In the field at the top where it says 'Alias:' type in whatever you want to type to bring up your stab stats while playing on the mud. In fact, just type in there
stabstats
Make sure the 'Enabled' box down the left side is checked, and then near the bottom in the field called 'Script:' type
StabStats
click the 'ok' button and again you'll probably get an error message saying no such script, that's fine just ok through it and then click 'ok' again to close the alias window. Now you need to add another script to that same notepad window titled 'myscript.vbs' you had open before.
The script I'm writing belowe will give you your stats as a world.note - that is, nobody else will see it but you. If you want something different then you'll need to amend it. Ok, add the following script to your 'myscript.vbs' notepad window:
sub StabStats (thename, theoutput, thewildcards)
dim goodtotal
dim badtotal
dim rate
goodtotal = World.GetVariable("GoodStabCounter")
badtotal = World.GetVariable("BadStabCounter")
rate = Round((goodtotal / (goodtotal + badtotal)) * 100, 1)
World.Note "stabs: good = " & goodtotal & ", bad = " & badtotal & ", success rate = " & rate & "%"
end sub
Now save it and that will should bring up a box on mudclient asking to confirm re-processing the changes to myscript.vbs. Click ok. ALL DONE.
Now all you need to do is type 'substats' while playing, and you'll get a message come up saying something like
stabs: good = 5, bad = 5, success rate = 50.0%
hopefully.. I haven't tested this so let me know if it spits the dummy. If you wanted this to be said out loud on the mud rather than just to yourself, then in the subroutine above, the line that starts with
World.Note "stabs: good...
Well, thanks for your help.. It works kind of in VBscript, but i have a previous script already in place to ID equipment and it is JScript.. i fiddled with the principles from your post and nicks post and couldnt get it to work still.. I keep getting an error saying it expects ) when it has ) where its expecting it. :/ For some reason also, your alias math doesnt add right... its off by a good amount. i manually put in 50 & 50 and it says that i hit 1% and not 50%. :/ im still trying to figure that one out.. If anyone can help me out w/ this script in JScript i would wub you to death. This is the reason why i hate to code. :p
OK, i figured out WHY the math is off.. when you make it add 'goodtotal + badtotal' it just puts them together instead of adding them.. it says 10 + 5 = 105 instead of 15.
Yes, this is a fairly well-known "feature". Variables are stored as strings (after all, you can put names etc. in them) and when VB gets a string and you try to "add" them it concatenates them together.
As Demonsurfer says, you need to Convert them to Integers (CInt) to make it work properly.
Well.. It shouldn't be that hard to convert to JScript, since you are not doing a lot of complex stuff, but yes, placing the triggers and VBScript into a plugin instead would be a good option too.