Kill all <target> <2-100> alias

Need some help with your MUD client? Forgot your password? Get help here.
Forum rules
- Use common sense and be respectful towards each other at all times, even when disagreeing.
- Do not reveal sensitive game information. Guild secrets, player seconds are examples of things not allowed.
Post Reply
bashere
Beginner
Posts: 10
Joined: 12 Oct 2017 19:31

Kill all <target> <2-100> alias

Post by bashere » 14 Nov 2017 23:37

For the Web Ui.

Enjoy!

/*
Description: Script to kill up to 100 targets. The alias requires at least
one argument, kill <human> or within single quotes 'dark elf', 'blue goblin', etc.
The second argument is used to kill a certain range of targets such as,
kill 'dark elf' 5, will attack the first 5 dark elves in the room.

Alias Command: ka
Script Type: Javascript

Synopsis:
Usage: ka target (defaults to the first 10 targets) ka target 1-100

Examples:
ka human (defaults to 10) . # this will attack the first 10 'humans' in the room
ka human 2 # will attack the first 2 humans
ka 'dark elf' 100 # will attack 100 dark elves in the room. ** Note the single quotes **

*/

var target = args[1];
var bodycount = args[2];
var special = ['first', 'second', 'third', 'fourth', 'fifth', 'sixth', 'seventh', 'eighth', 'ninth', 'tenth', 'eleventh', 'twelfth', 'thirteenth', 'fourteenth', 'fifteenth', 'sixteenth', 'seventeenth', 'eighteenth', 'nineteenth'];
var deca = ['twent', 'thirt', 'fort', 'fift', 'sixt', 'sevent', 'eight', 'ninet'];

if (! bodycount) {
bodycount = 10; // Change this to modify the default number of kills
}

function stringifyNumber(n) {
if (n < 20) return special[n];
if (n%10 === 0) return deca[Math.floor(n/10)-2] + 'ieth';
return deca[Math.floor(n/10)-2] + 'y-' + special[n%10];
}

// kill up to 100
for (var i=0; i<bodycount; i++) gwc.connection.send('kill ' + (stringifyNumber(i) + ' ' + target));

Post Reply
http://tworzymyatmosfere.pl/przescieradla-jedwabne-z-gumka/