Lookup examples¶
Three short scripts built on lookups. Save one as a .js file in your scripts folder, run /fkdr script reload, and switch it on in the Scripts tab.
.stats <name> in chat¶
Type .stats Notch in chat to see a player's Bed Wars stats. The line is never sent to the server.
script.meta({ name: 'Stats Command', description: 'Type .stats <name> to look a player up.' });
function onChatSend(e) {
var parts = e.message.trim().split(/\s+/);
if (parts[0].toLowerCase() !== '.stats') return;
e.cancel(); // keep it out of chat
var who = parts[1] || player.name;
chat.print('§7Looking up ' + who + '…');
fkdr.hypixel.player(who, function (r) {
if (!r.ok) { chat.print('§c' + r.message); return; }
var s = r.stats;
chat.print('§f' + r.name + ' §7' + s.star + '✫ FKDR §f' + s.fkdr.toFixed(2)
+ ' §7WLR §f' + s.wlr.toFixed(2) + ' §7wins §f' + s.wins
+ ' §7streak §f' + s.winstreak);
});
}
Asking about the same player again within 10 minutes is answered from memory, so the command can be used as often as you like.
Check your party before you queue¶
Type .pc before you queue to see everyone in your party at a glance, with any Urchin tags. Without an Urchin key the tags are skipped.
script.meta({ name: 'Party Check', description: 'Type .pc to check your party before you queue.' });
function onChatSend(e) {
if (e.message.trim().toLowerCase() !== '.pc') return;
e.cancel();
var members = fkdr.party.members();
if (members.length === 0) { chat.print('§7You are not in a party.'); return; }
members.forEach(function (name) {
fkdr.hypixel.player(name, function (r) {
if (!r.ok) { chat.print('§7' + name + ': §c' + r.message); return; }
var line = '§f' + r.name + ' §7' + r.stats.star + '✫ FKDR §f' + r.stats.fkdr.toFixed(2);
if (!fkdr.urchin.hasKey()) { chat.print(line); return; }
fkdr.urchin.player(r.uuid, function (u) {
chat.print(line + (u.ok && u.flagged ? ' §c' + u.tags.join(', ') : ''));
});
});
});
}
Each member is looked up on their own, so the lines arrive as the answers come in. A large party is spaced out a little rather than refused.
Guild Recruiter¶
A sketch of a recruiting helper: it goes through the tab list, finds players who are not in a guild and whose stars and FKDR are at least what you set, and lists them in chat. Run it with /fkdr recruit.
script.meta({ name: 'Recruiter', description: 'Lists guildless players in your lobby above a star and FKDR mark.' });
function onLoad() {
settings.number('Min stars', 100, 0, 3000, 10, 'Lowest star to list.');
settings.number('Min FKDR', 2, 0, 50, 0.1, 'Lowest FKDR to list.');
}
commands.register('recruit', [], function () {
var rows = world.tabList().filter(function (p) { return p.name !== player.name; });
chat.print('§7Checking ' + rows.length + ' players…');
rows.forEach(function (p) {
fkdr.hypixel.guild(p.uuid, function (g) {
if (!g.ok || g.inGuild) return; // already in a guild, or no answer
fkdr.hypixel.player(p.uuid, function (r) {
if (!r.ok) return;
if (r.stats.star < settings['Min stars'] || r.stats.fkdr < settings['Min FKDR']) return;
chat.print('§a' + r.name + ' §7' + r.stats.star + '✫ FKDR §f' + r.stats.fkdr.toFixed(2)
+ ' §7- not in a guild');
});
});
});
});
Every player costs two lookups, and a full lobby is spread out over a short while instead of hitting your key all at once. Players you checked in the last 10 minutes are answered from memory.
The full version is in the game
The complete Guild Recruiter script ships in fkdr's in-game Examples.