Jump to content

Photo

Now message nor blackbox nor both is showing up. Please help. Thank yo


  • Please log in to reply
5 replies to this topic

#1 LikeLike888

LikeLike888

    Spicy food lover!!

  • Members
  • Real Name:Jason
  • Location:North America

Posted 14 October 2018 - 11:41 PM

How do I change

import "std.zh"
int First_Message = 0;
int Last_Message = 0;
int Message_Display = 0;
 
global script NeededWhile
{
  void run()
  {
    while(true)
    {
      if (Message_Display == Last_Message)
      {
        if (Link->PressA)
        {
          Screen->Rectangle(0,0,0,0,0,0,0,0,0,0,false,64);
        }
      }
      Waitframe();
    }
  }
}
 
ffc script Roxanne_One
{
  void run()
  {
    while(true)
    {
      if (Link->Dir == DIR_UP)
      {
        if (Link->X == this->X && Link->Y == this->Y+16)
        {
          if (Link->PressA)
          {
            First_Message = 1;
            Last_Message = 6;
            if (Message_Display < First_Message)
            {
              Message_Display = First_Message;
              Screen->Rectangle(0,32,32,32,168,0,0,0,0,0,true,128);
              Screen->Message(Message_Display);
            }
            else if (Message_Display > First_Message || Message_Display == First_Message)
            {
              Message_Display += 1;
              Screen->Message(Message_Display);
            }
          }
        }
      }
    Waitframe();
    }
  }
}


#2 Saffith

Saffith

    IPv7 user

  • ZC Developers

Posted 16 October 2018 - 11:29 AM

You need to change the scale argument to Rectangle(). If it's set to 0, the rectangle is resized to 0x0, meaning it's invisible. Set the scale to -1 and it will be ignored.

Also, this might be a problem:
if (Link->X == this->X && Link->Y == this->Y+16)
It's not wrong, but it's too precise to trigger easily. Link has to be standing in exactly the right spot for that to be true; if he's off by a single pixel, it won't work. There are a couple of different ways to make it more forgiving. One would be to use four comparisons setting upper and lower bounds:
if (Link->X >= this->X-6 && // Link can be six pixels to the left of the FFC
    Link->X <= this->X+6 && // or six pixels to the right.
    Link->Y >= this->Y+8 && // Half a tile down
    Link->Y <= this->Y+16)  // to a full tile down.

  • ShadowTiger likes this

#3 LikeLike888

LikeLike888

    Spicy food lover!!

  • Members
  • Real Name:Jason
  • Location:North America

Posted 16 October 2018 - 06:16 PM

Thank you Saffith

#4 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 18 October 2018 - 02:18 AM

You need to change the scale argument to Rectangle(). If it's set to 0, the rectangle is resized to 0x0, meaning it's invisible. Set the scale to -1 and it will be ignored.

Also, this might be a problem:

if (Link->X == this->X && Link->Y == this->Y+16)
It's not wrong, but it's too precise to trigger easily. Link has to be standing in exactly the right spot for that to be true; if he's off by a single pixel, it won't work. There are a couple of different ways to make it more forgiving. One would be to use four comparisons setting upper and lower bounds:
if (Link->X >= this->X-6 && // Link can be six pixels to the left of the FFC
    Link->X <= this->X+6 && // or six pixels to the right.
    Link->Y >= this->Y+8 && // Half a tile down
    Link->Y <= this->Y+16)  // to a full tile down.

 

I'm pretty sure that this was bugged, and IDR if I had ever fixed it: Rectangle() has different behaviour for this arg, than other drawing functions, such as DrawTile().

if(sdci[7] != 10000)

    {

        int w=x2-x1+1;

        int h=y2-y1+1;

        int w2=(w*sdci[7])/10000;

        int h2=(h*sdci[7])/10000;

        x1=x1-((w2-w)/2);

        x2=x2+((w2-w)/2);

        y1=y1-((h2-h)/2);

        y2=y2+((h2-h)/2);

    }

That's from 2.50.2. If scale == 1, then it is ignored, there. Setting it to -1 would just cause the allegro utine to flip it around at 1% scale. This isn't fixed in the 2.53 source, either, so, that's something for me to do.


Circle() and some other functions are likewise inconsistent with the intended behavior for passing -1 to scale. I'll fix it, but it'll use up the last free bit for 2.50.x. Too many users have figured out that 1 == 100% and 100 == 100% and have intermittently used either of these values. (A raw fix would instantly brreak any script where someone passed 1 as the scale arg, for 100%.)

 

It didn't help that the ZScript docs never detailed the scale arg for these functions in any detail.



#5 Saffith

Saffith

    IPv7 user

  • ZC Developers

Posted 18 October 2018 - 09:43 AM

Huh, weird. But try it out; that doesn't flip it at all. A negative number works the same as a positive one, except it removes the pixel of padding that's normally added, making it the size you actually asked for instead of slightly larger.

#6 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 21 October 2018 - 05:44 PM

Huh, weird. But try it out; that doesn't flip it at all. A negative number works the same as a positive one, except it removes the pixel of padding that's normally added, making it the size you actually asked for instead of slightly larger.

 

Ugh, it's bad maths, to be sure. These should just uniformly scale with multiplication. :(

 

x1 = 1
x2 = 200
y1 = 1
y2 = 400

w = 200-1+1 == 200
h = 400-1+1 == 400

w2 = -1
h2 = -1


x1=x1-((w2-w)/2); == 1-((-1 - 200))) == -201 / 2 == -100
x2=x2+((w2-w)/2); == 200 + ( -1- 200)/2 == -100 ) = 100
y1=y1-((h2-h)/2); == 1-((-1 - 400)/2 == -200 ) == -201
y2=y2+((h2-h)/2); == 400+((-1 -400)/2 == 200 ) == 200

rectfill(bmp, -100, -201, 100, 200, color);

 

That should flip it, but...erm, I don't have enough sanity left for it.

 

Nothing absolutes any calues along the way, that I see.  There's a call to zc_swap(), but it occurs before these calcs.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users