Digit Counter

Post all your awesome maps here.

Digit Counter

Postby kitty » Tue Dec 11, 2018 8:17 pm

Created a basic kill counter in Nox Script 3.0, feel free to use:
- Does not require Unimod or patch files
- Max value: 9999
- Open Digits.ns to see code
- - Usage: HandleDigits(123);
- - Requires: 5 named waypoints

Image
Attachments
Digits.zip
Digit Counter Map Files
(274.38 KiB) Downloaded 111 times
User avatar
kitty
Apprentice
Apprentice
Posts: 56
Joined: Thu May 25, 2017 3:02 am

Re: Digit Counter

Postby panic » Sun Dec 23, 2018 11:50 am

Code: Select all
float FloatTable(int num)

{

    float arr[28];

    int k;

    float count;


    if (num < 0)

    {

        count = 27.0;

        for (k = 27 ; k >= 0 ; k --)

        {

            arr[k] = count;

            count -= 1.0;

        }

        return AnyIntToFloat(0);

    }

    return arr[num];

}

NumberOrb(int wp)

{

    int ptr;

    int k;


    if (wp)

    {

        ptr = CreateObject("InvisibleLightBlueHigh", wp) + 1;

        for (k = 0 ; k < 28 ; k ++)

        {

            CreateObject("ManaBombOrb", wp);

            MoveWaypoint(wp, GetWaypointX(wp) + 1.0, GetWaypointY(wp));

        }

        Raise(ptr - 1, AnyIntToFloat(wp));

    }

    return ptr;

}

int NumberData(int num)

{

    int data[10];


    if (!data[0])

    {

        data[0] = 110729622; data[1] = 239354980; data[2] = 252799126; data[3] = 110643350; data[4] = 143194521;

        data[5] = 126382367; data[6] = 110719382; data[7] = 71583903; data[8] = 110717334; data[9] = 110684566;

        return 0;

    }

    return data[num];

}

void DisplayNumber(int ptr, int loc, int bytes)

{

    float pos_x = GetWaypointX(loc);

    float pos_y = GetWaypointY(loc);

    int idx = 0;

    int k;

    int wp = AnyFloatToInt(GetObjectZ(ptr - 1));


    for (k = 1 ; !(k & 0x10000000) ; k <<= 1)

    {

        if (bytes & k)

            MoveObject(ptr + idx, pos_x, pos_y);

        else

            MoveObject(ptr + idx, GetWaypointX(wp) + FloatTable(idx), GetWaypointY(wp));

        if (idx % 4 == 3)

        {

            pos_x = GetWaypointX(loc);

            pos_y += 2.0;

        }

        else

            pos_x += 2.0;

        idx ++;

    }

}

int NUM_FST;

int NUM_SCD;


void MapInitialize()

{

    FloatTable(-1);

    NUM_FST = NumberOrb(59);

    NUM_SCD = NumberOrb(3);

    NumberData(0);

}

void Function()

{

    int num;


    DisplayNumber(NUM_FST, 25, NumberData(num));

    num = (num + 1) % 10;

}





my code...
panic
Adept
Posts: 298
Joined: Thu Nov 12, 2015 3:47 pm

Re: Digit Counter

Postby panic » Sun Dec 23, 2018 11:51 am

result:
Attachments
numbering.png
numbering.png (377.61 KiB) Viewed 1823 times
panic
Adept
Posts: 298
Joined: Thu Nov 12, 2015 3:47 pm

Re: Digit Counter

Postby panic » Sun Dec 23, 2018 11:56 am

StopScript code can ignore all data types

int ToInt(float x)
{
StopScript(x);
}

float ToFloat(int x)
{
StopScript(x);
}
panic
Adept
Posts: 298
Joined: Thu Nov 12, 2015 3:47 pm

Re: Digit Counter

Postby kitty » Sun Dec 23, 2018 11:22 pm

Thank you for the code panic! Your code is definitely much cleaner than mine! Also good to have for a visually horizontal counter.

A+!
User avatar
kitty
Apprentice
Apprentice
Posts: 56
Joined: Thu May 25, 2017 3:02 am

Re: Digit Counter

Postby panic » Mon Dec 24, 2018 12:20 am

did you use another program for make number form?

or make by hand?
panic
Adept
Posts: 298
Joined: Thu Nov 12, 2015 3:47 pm

Re: Digit Counter

Postby panic » Mon Dec 24, 2018 12:26 am

as another issue, 'WhiteMoveOrb' will does destroyed when out the sight. so i recommend using 'ManaBombOrb' instead of it.
panic
Adept
Posts: 298
Joined: Thu Nov 12, 2015 3:47 pm

Re: Digit Counter

Postby kitty » Mon Dec 24, 2018 5:23 am

panic wrote:did you use another program for make number form?

or make by hand?


I made a program to map pixels of a specific color then used it on a photoshopped image.

panic wrote:as another issue, 'WhiteMoveOrb' will does destroyed when out the sight. so i recommend using 'ManaBombOrb' instead of it.


Good to know! I thought all of them did that.
User avatar
kitty
Apprentice
Apprentice
Posts: 56
Joined: Thu May 25, 2017 3:02 am


Return to Maps

Who is online

Users browsing this forum: No registered users and 0 guests