View Single Post
  #15  
Old 05-02-2001, 08:02 AM
WhoopA WhoopA is offline
Registered User
Join Date: May 2001
Location: Wherever I may roam
Posts: 86
WhoopA is on a distinguished road
Cool

WhoopA to the rescue! Here's some code you can use. It'll use the default letters.png for the readout. You should be able to modify it to your own use.

NPC Code:

// Digital readout function Draw()
// Script by WhoopA
// Displays a value, left aligned, on the player's screen.
//
// These variables muse be set before this function is called!
// num: Number to display
// dx, dy: Position to display the number on the player's screen. These will be changed as the function runs.
// img: Image values to use (start with 200). This is the parameter supplied to showimg and will be incremented automatically.

function Draw()
{
dr_val = 10; while (dr_val < num) dr_val *= 10;
while (dr_val > 1) {
dr_val = dr_val / 10;
dr_i = int(num / dr_val) % 10;
showimg img,letters.png,dx,dy;
changeimgpart img,64*dr_i,96,12,32;
changeimgvis dr_i,4;
dx += 12; img++;
}
}



At the end of your timeout, you can take care of cleanup by running these lines (assuming you use this method of doing your status):

for (i=200;i<this.lastimg;i++) hideimg i;
this.lastimg = img;

Hope this helps.
__________________
WhoopA, the Official Kicker of Butts

--- No images. No clutter. Just pure, simple text.
"Thank you, thank you. Please, ladies, put your clothes back on... Not you Samus..." - Link from the BOTVGH
Everywhere I look, I see rabbits. Maybe I should take down all my Sailor Moon stuff.
Reply With Quote