Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ MUSHclient
➜ Jscript
➜ Damage Summing Script
It is now over 60 days since the last post. This thread is closed.
Refresh page
| Posted by
| Iterator
(5 posts) Bio
|
| Date
| Sun 12 Feb 2012 08:56 PM (UTC) |
| Message
| Hi everyone. I'm new to MUSH scripting (and scripting in general) but do have a background in Java.
I'm currently playing a mud where a certain ability rages you and you can't see your HP. I'm wanting to have a script that I can call from triggers and have it tally how much damage I've taken.
I've figured out an average of which hit takes how much: very hard, extremely, pulverized, etc. So these triggers would call the script and the script would add this value to the total and some how display this to the user.. or possibly deduct it from that characters total hp and return that.
Is this possible, and if so could someone point me in the right direction?
Thanks!
/iterator
| | Top |
|
| Posted by
| Kyrock
(20 posts) Bio
|
| Date
| Reply #1 on Fri 08 Jun 2012 09:26 PM (UTC) |
| Message
| don't know if you're still wanting an answer.
var rageTracker = {
hp: 0,
veryHard: 5,//don't know avg damages so I'm making them up
extremely: 10,
pulverized: 20,
etc: 40,
init: function(currentHp) {
this.hp = currentHp;
}
//this function treats its argument as a string.
hpMod: function(gotHit) {
//replace any white space with no space
//then make it lower case.
var hitSeverity = gotHit.replace(" ","").toLowerCase();
//if passed veryhard then hitSeverity is equal to 5 and etc.
hitSeverity = this[hitSeverity];
//hp is modified and then noted in the world
this.hp = this.hp - hitSeverity;
world.Note(this.hp);
}
}
When you log in you'd set your hp with an alias with the code:
or what ever your current hp is. then in your triggers...if the message is something like: "you get hit very hard" you'd send to script:
rageTracker.hpMod("very hard");
then you'd get a note saying 75 (80 - 5 = 75) | | Top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
15,111 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top