PDA

View Full Version : MediaNexus Function Pack 1


Programmer
04-20-2008, 05:05 AM
This is a small function pack me and Chompy scripted together. It has several functions:


Binary to Decimal conversions
Decimal to Binary conversions
Binary to Octal conversion
Base4 to Base10 conversions
Base10 to Base4 conversions
Hexadecimal to RGB Conversions
RGB to Hexadecimal Conversions
Hexadecimal Letter To Number Conversion
Arabic to Roman Numeral Conversions
Roman Numeral to Arabic Number Conversions
Quadratic Support
Fibonacci Support
Graal Tile Conversions


Installation:
Simply put this into a class and join it to any weapon or NPC you want by doing: this.join("classname");

The Code:
See the attachment.
Reason being, I get a bad request because the forums won't post anything with a percent sign .


Enjoy!

cbk1994
04-20-2008, 05:10 AM
Some of that stuff is kinda overkill, but nice work anyway!

Chompy
04-20-2008, 09:36 PM
Some of that stuff is kinda overkill, but nice work anyway!

Hehe, thanks Chris :)

Recently started pack 2 as well ^^

DustyPorViva
04-20-2008, 09:38 PM
Did you(or Chompy) figure out the tile/image conversions yourself?

cbk1994
04-20-2008, 10:04 PM
Did you(or Chompy) figure out the tile/image conversions yourself?

I couldn't figure out exactly what that did.

Programmer
04-20-2008, 10:28 PM
I couldn't figure out exactly what that did.

Open an NW file in Notepad, theres a bunch of 2-digit codes for each tile. Conversions take those digits and turns them into points on the tileset image.

cbk1994
04-20-2008, 10:42 PM
Oh, okay.

Tigairius
04-20-2008, 11:45 PM
Ve-y nice ;)

zokemon
04-21-2008, 06:52 AM
Did you(or Chompy) figure out the tile/image conversions yourself?

I figured them out for my scripted level editor a few years ago in about 5 minutes :rolleyes:.

Dan
04-21-2008, 10:07 AM
Nice stuff :)

Tigairius
05-13-2008, 10:13 PM
Sorry for late post, but I was looking at your convertToHex function:
HEX = {{10, "A"}, {11, "B"}, {12, "C"}, {13, "D"}, {14, "E"}, {15, "F"}};
function convertToHex(nr)
{
for (i = 0; i < HEX.size(); i++)
{
if (HEX[i][0] == nr)
{
return HEX[i][1];
}
}

return nr;
}
and I noticed you could just as easily have done this:
function convertToHex(nr) {
temp.hextable = "0123456789ABCDEF";
return hextable.charat(nr % 16);
}
Just for future reference, it's quite a lot more efficient to do it that way, I'd say.