The Dink Network

dink rts dev thread

March 29th 2020, 01:07 PM
slayer.gif
Exzcimus
Peasant He/Him Philippines
Change is constant, but Constants do not change. 
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?
March 30th 2020, 10:51 AM
slayer.gif
Exzcimus
Peasant He/Him Philippines
Change is constant, but Constants do not change. 
I m pretty sure that someone out there will help! Right? <cricket noises>
March 30th 2020, 08:21 PM
dinkdead.gif
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:

// Place '1' in the 'Pie' key
sp_custom("Pie", &current_sprite, 1);

// Place '0' in the 'Cake' key
sp_custom("Cake", &current_sprite, 0);

// Get the values
int &pie = sp_custom("Pie", &current_sprite, -1);
int &cake = sp_custom("Pie", &current_sprite, -1);

// Dink will say "1 - 0"

say("&pie - &cake", 1);
April 5th 2020, 10:34 AM
slayer.gif
Exzcimus
Peasant He/Him Philippines
Change is constant, but Constants do not change. 
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.
April 5th 2020, 05:37 PM
duck.gif
toof
Peasant He/Him
I disagree. 
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.

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);
                  }
            }
      }

}