Skip to content
Snippets Groups Projects
Commit 7d9f8cf2 authored by rswindell's avatar rswindell
Browse files

A simple script to display a user's avatar somewhere on the terminal screen.

The default user is the current user. If a different user's avatar is to be
shown, the user number must be passed on the command-line. Other command-line
options supported:
  -draw  = use the Graphic.draw() method to display anywhere (requires ANSI)
  -top   = display the avatar at the top of the screen
  -right = display the avatar at the right edge of the screen
  -above = display the avatar above the current cursor position

The -top/right/above options imply "draw", and all require ANSI support.
The default display method is to simply "show" the avatar (not draw) and that
does not require ANSI support, but can only display the avatar at the current
cursor location, left-justified.
parent 4b026403
Branches
Tags
No related merge requests found
// $Id$
var usernum = user.number;
var draw = false;
var above = false;
var right = false;
var top = false;
for(var i in argv) {
switch(argv[i]) {
case '-draw':
draw = true;
break;
case '-above':
draw = true;
above = true;
break;
case '-right':
draw = true;
right = true;
break;
case '-top':
draw = true;
top = true;
break;
default:
if(parseInt(argv[i], 10))
usernum = parseInt(argv[i], 10);
}
}
var Avatar = load({}, 'avatar_lib.js');
if(draw) {
Avatar.draw(usernum, /* name: */null, /* netaddr: */null, above, right, top);
console.attributes = 7; // Clear the background attribute as the next line might scroll, filling with BG attribute
} else {
Avatar.show(usernum);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment