dink rts dev thread
Okay, it's been long since I've last posted about this RTS type dmod thing. Im a beginner, and help will be much appreciated.
My first question; there are key-activated scripts i made such as key-86, key-45 and so on. These work on version 1.08, but not on freedink 109.6. So how can I make it work on freedink? Also, can someone explain how sp_custom works?
My first question; there are key-activated scripts i made such as key-86, key-45 and so on. These work on version 1.08, but not on freedink 109.6. So how can I make it work on freedink? Also, can someone explain how sp_custom works?
I m pretty sure that someone out there will help! Right? <cricket noises>
Dunno about the key scripts in freedink but sp_custom is just a way of storing some values for a sprite (it doesn't actually do anything as such)
Example from the DinkC Reference:
Example from the DinkC Reference:
// Place '1' in the 'Pie' key
sp_custom("Pie", ¤t_sprite, 1);
// Place '0' in the 'Cake' key
sp_custom("Cake", ¤t_sprite, 0);
// Get the values
int &pie = sp_custom("Pie", ¤t_sprite, -1);
int &cake = sp_custom("Pie", ¤t_sprite, -1);
// Dink will say "1 - 0"
say("&pie - &cake", 1);
Say, anyone out there who knows how to use "inside_box"? I don't really get how to put the left, top, right, and bottom coordinates. Are those values like x and y pixel coordinates, or maybe something else?
From my recent post about key-activated scripts; it's actually my bad. Key-activated scripts actually work on freedink, except the 12345 number buttons above QWERTY, which is quite strange.
From my recent post about key-activated scripts; it's actually my bad. Key-activated scripts actually work on freedink, except the 12345 number buttons above QWERTY, which is quite strange.
Say, anyone out there who knows how to use "inside_box"?
I'm not sure I understand the question. inside_box checks whether certain coords are within range. But you must supply that info yourself.
I'm not sure I understand the question. inside_box checks whether certain coords are within range. But you must supply that info yourself.
Category: Math
Version: 1.00+
Prototype: bool inside_box(int x, int y, int left, int top, int right, int bottom);
inside_box returns 1 if the x and y coordinates are inside the box defined by left, top, right, and bottom.
// excerpt from item-pig.c to check if Dink is in the pig pen
&junk = inside_box(&mholdx,&mholdy, 200, 180, 400, 306);
if (&junk == 1)
{
freeze(1);
wait(200);
say_stop("Come on pigs, eat!", 1);
//... continued
}
Put another way, this function ensures the x coordinate is within the left and right boundaries, and the y coordinate is within the top and bottom boundaries, like so:
if (&x >= &left)
{
if (&x <= &right)
{
if (&y <= &bottom)
{
if (&y >= &top)
{
say("I'm inside the box!", 1);
}
}
}
}









