Jump to content

Photo

tango.zh


  • Please log in to reply
398 replies to this topic

#346 Deedee

Deedee

    Bug Frog Dragon Girl

  • Moderators
  • Real Name:Deedee
  • Pronouns:She / Her, They / Them
  • Location:Canada

Posted 02 October 2017 - 12:16 AM

I ran out of bitmap space by using append message. Is there any way I can either clear the bitmap and continue using the same slot or fake a continuation of the scrolling using a second slot?

Also, @A0 doesn't seem to work, nor does @speed.



#347 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 02 October 2017 - 03:26 AM

I ran out of bitmap space by using append message. Is there any way I can either clear the bitmap and continue using the same slot or fake a continuation of the scrolling using a second slot?

Also, @A0 doesn't seem to work, nor does @speed.

 

Hmph. These features are new to me. The last time that I did this, I used:


bool showStats()
{

    
    Tango_D[0] = getMuscStat();
    Tango_D[1] = getBodyStat();
    Tango_D[2] = getMindStat();
    Tango_D[3] = getMystStat();
    Tango_D[4] = getLuckStat();
    Tango_D[5] = getInflStat();
    Tango_D[6] = Game->Counter[CR_LEVEL];
  

Old Tango used a pre-set number of D[] args.

 

I'm going to have some fun converting all of my old pre-release Tango code to anything current. (It would have been nice if the tango API changes were made in a way that allowed full compatibility, though a legacy layer. None of my old code works, at all, these days.)

 

Anyway, @A is wrong, it needs to be @a. Which are you using?

 

Insofar as clearing the bitmap, couldn't you loop back to the start of your scrolling text and append a new string into your buffers (starting with the first buffer) to do that for you? Is the tango text bitmap separate from the background?


Edited by ZoriaRPG, 02 October 2017 - 03:29 AM.


#348 Deedee

Deedee

    Bug Frog Dragon Girl

  • Moderators
  • Real Name:Deedee
  • Pronouns:She / Her, They / Them
  • Location:Canada

Posted 02 October 2017 - 07:31 AM

Anyway, @A is wrong, it needs to be @a. Which are you using?

Sorry, autocapitcalized it. I was using @a0, and I've tried @a0(1), @set(a0, 1), @set(@a0, 1), and @set(@a0(), 1).



#349 Saffith

Saffith

    IPv7 user

  • Members

Posted 02 October 2017 - 08:52 AM

I ran out of bitmap space by using append message. Is there any way I can either clear the bitmap and continue using the same slot or fake a continuation of the scrolling using a second slot?

Not easily, I'm afraid. I've been thinking of adding something like that, but it's pretty difficult internally, too. What sort of thing are you doing? Is this a regular message, or something else?
 

(It would have been nice if the tango API changes were made in a way that allowed full compatibility, though a legacy layer. None of my old code works, at all, these days.)

What doesn't work? Other than array sizes changing and TANGO_STYLE_MENU_CURSOR_WIDTH being renamed, I don't think anything should have broken.
 

Sorry, autocapitcalized it. I was using @a0, and I've tried @a0(1), @set(a0, 1), @set(@a0, 1), and @set(@a0(), 1).

No commas. It's @set(@a0 1).

#350 Deedee

Deedee

    Bug Frog Dragon Girl

  • Moderators
  • Real Name:Deedee
  • Pronouns:She / Her, They / Them
  • Location:Canada

Posted 02 October 2017 - 10:16 AM

Not easily, I'm afraid. I've been thinking of adding something like that, but it's pretty difficult internally, too. What sort of thing are you doing? Is this a regular message, or something else?

It was for a LttP styled backstory sequence, but I got around the issue by clearing the slot, loading a duplicate message of the last message before it would have overflowed but with a 1 frame @delay at the end, and set the speed of the message in the script to 0 for one frame before setting it back.



#351 Shoelace

Shoelace

    The Shaman of Sexy!

  • Members
  • Real Name:Michael
  • Pronouns:He / Him
  • Location:Arizona

Posted 26 December 2017 - 02:32 PM

So... I am still having trouble with this from two years ago. lol  I started from scratch basically, so that I can redo it and learn along the way.  But I am still running into my same issue:

 

Basically, when my text comes up, it remembers the last time the text was made.  So, in a fresh ZC play through, it works fine (First image).  The Text is complete as well.  But, if I go to read it again, it will have the last string used still posted, and then start to write over it like this picture 2.  Even when the text is writing, if I get another text at the same time, it will overwrite it, even though they are using two different slots:

 

Normal: MohKswA.png When another text is used: 76YVMyT.png 

Here is a picture of what it looks like when I get an item with a string attached:arg6F8w.png.  Even though that string is displayed correctly: N3Dyww9.png.  But... if I do it in the reverse order, it does the same thing to that one too: o4fHkVU.png.  But I don't understand because I using two different Slot Types.  Just like if I used the TANGO_SLOT_NORMAL, it won't interfere with them.

 

Here is the part of the code that I am pretty sure the problem is, but I just don't understand what I am looking for:

// Slot types and definitions
const int TANGO_SLOT_POPUP = 0;
const int TANGO_SLOT_CLOUD = 1;
const int TANGO_SLOT_NORMAL = 2;

// Style data
const int __TANGO_NUM_STYLES = 20;
int __Tango_Styles[960]; // 48 * __TANGO_NUM_STYLES

// Text buffer and slots
int __Tango_Buffer[3201]; // Arbitrary size

const int __TANGO_NUM_SLOTS = 4;
int __Tango_SlotData[84]; // 21 * __TANGO_NUM_SLOTS

int __Tango_SlotDefs[] = {
	
    // 0
    TANGO_SLOT_POPUP, //This is what I use to display the item that you get.
    0, 128,
    256, 64,
    128, 64,
    
    // 1
    TANGO_SLOT_CLOUD, //This is what I use for the Cloud string that is having the problem.
    128, 1024,
    256, 64,
    128, 192,
    
    // 2
    TANGO_SLOT_NORMAL,
    1152, 1024,  // Starting index and length in __Tango_Buffer
    0, 0,     // X, Y on offscreen bitmap
    256, 512, // Width, height on offscreen bitmap
    
    // 3
    TANGO_SLOT_NORMAL,
    2176, 1024,
    256, 0,
    256, 512
};

Here is the script that I use for the Cloud Talking and the itemObtained:

item script ItemObtained
{
    void run()
    {
        int slot=Tango_GetFreeSlot(TANGO_SLOT_POPUP);
        if(slot==TANGO_INVALID)
            Quit();
        
        // Item obtained
        // Partial item name
        // Followed by commands to move up, wait, and move back down
        int obtained[]="Item obtained@26";
        int itemName[64];
        int movement[]="@while(@greater(@y 130) @inc(@y -3))@delay(240)@while(@less(@y 168) @inc(@y 3))";
        
        this->GetName(itemName);
        
        Tango_ClearSlot(slot);
        
        Tango_LoadString(slot, obtained);
        Tango_AppendString(slot, itemName, '%'); // Only display the part of the name after '%'
        Tango_AppendString(slot, movement);
        
        Tango_SetSlotStyle(slot, STYLE_POPUP);
        Tango_SetSlotPosition(slot, 144, 168);
        Tango_ActivateSlot(slot);
    }
}

ffc script CloudTalk{
    void run(int String)
    {
        int slot=Tango_GetFreeSlot(TANGO_SLOT_CLOUD);
        if(slot==TANGO_INVALID)
            Quit();
        
		slot = ShowMessage(String, TANGO_SLOT_CLOUD, STYLE_CLOUD_TALK, 160, -56);
       
					// If the message was displayed successfully...
                		if(slot!=TANGO_INVALID)
                		{
                    		// Wait for it to be closed
                    		while(Tango_SlotIsActive(slot))
                       		{
                        			Waitframe();
                        	}
                        		Tango_ClearSlot(slot); //I only put this here to see if I can clear the slot afterwards... but no go...
                	}
                		
        if(slot!=TANGO_INVALID)
            Tango_ClearSlot(slot); Tango_ClearSlot(slot); //I only put this here to see if I can clear the slot afterwards... but no go...
            
        Quit();
     }
}

Does anyone have any insight on what my problem is?



#352 Russ

Russ

    Caelan, the Encouraging

  • Administrators
  • Location:Washington

Posted 26 December 2017 - 03:37 PM

I think I know what the problem here is. The basic idea behind tango is that it draws the strings to a bitmap, which is drawn to the screen. Each slot is drawn to a different location on the bitmap, or at least should be. So let's say you draw a string in slot 0. You don't clear it when it's done. Now you draw a string in slot 1. Well, what happens if slot 1 occupies the same position on the bitmap as slot 0? Tango will display that section of the bitmap as it draws the string in slot 1 onto it, but the string in slot 0 will still be there and displayed, giving the effect of the new string drawing over the old one.
 
So let's look at your slot definitions.
 
// 0
TANGO_SLOT_POPUP, //This is what I use to display the item that you get.
0, 128,
256, 64,
128, 64,

// 1
TANGO_SLOT_CLOUD, //This is what I use for the Cloud string that is having the problem.
128, 1024,
256, 64,
128, 192,
 
Here's the problem. Both these slots use the position 256, 64 on the bitmap. This means that both slots are drawing to the exact same spot, so if they're not being cleared properly, any text that was displayed in one will be displayed in the next. Additionally, if both slots are active at once, they'll both show the same thing (two strings being printed on top of each other). To clear this up, you'll wanna assign them unique x and y locations on the bitmap that don't overlap . Since slot 1 is 128 wide and 192 tall, you could assign slot 0 to 256 + 128, 64 + 92, or something like that.

#353 Shoelace

Shoelace

    The Shaman of Sexy!

  • Members
  • Real Name:Michael
  • Pronouns:He / Him
  • Location:Arizona

Posted 26 December 2017 - 05:02 PM

Yay!  You the best Russ!  That definitely fixed the sharing text from one string type to another.  It looks to be working properly. :)

 

However, I am still having a problem with it saving the last text.  You mentioned that I am forgetting to Clear it.  I tried to put "Tango_ClearSlot(slot);" in the code 3 different times in different places to see if it would work, but it is not working.  Am I not clearing it correctly?

ffc script CloudTalk{
    void run(int String)
    {
        int slot=Tango_GetFreeSlot(TANGO_SLOT_CLOUD);
        if(slot==TANGO_INVALID)
            Quit();
        
                Tango_ClearSlot(slot); //I only put this here to see if I can clear the slot afterwards... but no go...
		slot = ShowMessage(String, TANGO_SLOT_CLOUD, STYLE_CLOUD_TALK, 160, -56);
       
					// If the message was displayed successfully...
                		if(slot!=TANGO_INVALID)
                		{
                    		// Wait for it to be closed
                    		while(Tango_SlotIsActive(slot))
                       		{
                        			Waitframe();
                        	}
                        		Tango_ClearSlot(slot); //I only put this here to see if I can clear the slot afterwards... but no go...
                	}
                		
        if(slot!=TANGO_INVALID)
            Tango_ClearSlot(slot); //I only put this here to see if I can clear the slot afterwards... but no go...
            
        Quit();
     }
}


#354 Saffith

Saffith

    IPv7 user

  • Members

Posted 26 December 2017 - 05:29 PM

If you're using the ShowMessage function from the demo, it already clears the slot, so you shouldn't need to do it yourself.
 

Even when the text is writing, if I get another text at the same time, it will overwrite it, even though they are using two different slots:

Only when you have two at the same time? Going by the definitions you posted before, slots 1 and 3 share bitmap space. If you're using those two at the same time, it'll cause problems like that.
You don't actually need to keep the normal slots the way they were, or at all. The default setup is just meant to be sufficient for most quests. Since you're using smaller text boxes, you can shrink the areas allocated to each slot and move them around so they don't overlap.

#355 Shoelace

Shoelace

    The Shaman of Sexy!

  • Members
  • Real Name:Michael
  • Pronouns:He / Him
  • Location:Arizona

Posted 26 December 2017 - 07:11 PM

I think I understand that now.  Thank you!  I went ahead and fixed that up so it should be set up a lot better so it won't be overlapping. 

 

As for the problem, yeah, I don't know know why it doesn't clear out then, since I am using the ShowMessage function...  I made a video to show it visually, and I am using the same text to show that it doesn't seem to be clearing out:

 

 

Here is some more code:

void SetUpCloudTalk()
{
    
    Tango_SetStyleAttribute(STYLE_CLOUD_TALK, TANGO_STYLE_TEXT_FONT, TANGO_FONT_SMALL_EXTENDED);
    Tango_SetStyleAttribute(STYLE_CLOUD_TALK, TANGO_STYLE_TEXT_X, 4);
    Tango_SetStyleAttribute(STYLE_CLOUD_TALK, TANGO_STYLE_TEXT_Y, 16);
    Tango_SetStyleAttribute(STYLE_CLOUD_TALK, TANGO_STYLE_TEXT_WIDTH, 86);
    Tango_SetStyleAttribute(STYLE_CLOUD_TALK, TANGO_STYLE_TEXT_HEIGHT, 32);
    Tango_SetStyleAttribute(STYLE_CLOUD_TALK, TANGO_STYLE_TEXT_COLOR, 110);
    Tango_SetStyleAttribute(STYLE_CLOUD_TALK, TANGO_STYLE_TEXT_SPEED, 8);

    Tango_SetStyleAttribute(STYLE_CLOUD_TALK, TANGO_STYLE_FLAGS, 
        TANGO_FLAG_AUTO_ADVANCE |
        TANGO_FLAG_CARRY_OVER);
}


#356 Saffith

Saffith

    IPv7 user

  • Members

Posted 27 December 2017 - 01:55 AM

It looks like it's working inconsistently, and I can't think of any reason why that might be. Even if it's a bug in tango.zh or ZC, I'm failing to see how it could manifest like that.
Are there any errors logged? (You have that quest rule enabled, right?) And you're not reusing an existing save after changing scripts?
Try Tango_ValidateConfiguration(), too. Just call that at the beginning of the global script. It'll report anything it finds in allegro.log.

#357 Shoelace

Shoelace

    The Shaman of Sexy!

  • Members
  • Real Name:Michael
  • Pronouns:He / Him
  • Location:Arizona

Posted 27 December 2017 - 11:17 AM

Yeah, it works the first time (This is only when it is a new instance of Zelda Classic), once played, it will then forever remember the last text. 

 

As far as error messages, I do have the Tango Error Notification, but it isn't saying there is a error on screen.  I do have "Log Script Errors To Allegro.log" check on.  I am also new reusing an existing save file.

 

In the Allegro.log, not sure if this is the part I was looking for:

 

tango.zh configuration report:
No errors detected.

 

Edit: You know, I found a backway of fixing it. lol.  At the end of my string I can just input @next(1) which is a blank line of text.  Now it will actually save the blank line, tested and it worked.  It is definitely a back way, and I just have to remember to do that with all of my texts, but... it works. lol


Edited by Shoelace, 27 December 2017 - 11:21 AM.

  • Russ likes this

#358 Russ

Russ

    Caelan, the Encouraging

  • Administrators
  • Location:Washington

Posted 27 December 2017 - 03:23 PM

Edit: You know, I found a backway of fixing it. lol.  At the end of my string I can just input @next(1) which is a blank line of text.  Now it will actually save the blank line, tested and it worked.  It is definitely a back way, and I just have to remember to do that with all of my texts, but... it works. lol

This is a functional if not amazingly silly workaround. Congratulations, you're a true scripter now. :P

#359 Saffith

Saffith

    IPv7 user

  • Members

Posted 27 December 2017 - 04:33 PM

I just noticed something...
// Style data
const int __TANGO_NUM_STYLES = 20;
int __Tango_Styles[960]; // 48 * __TANGO_NUM_STYLES

const int __TANGO_NUM_SLOTS = 4;
int __Tango_SlotData[84]; // 21 * __TANGO_NUM_SLOTS
Those sizes aren't correct for any released version. It should be 36 per style and 21 per slot in 1.2, 48 per style and 24 per slot in 1.3. Did you update and copy the slot data from the earlier version?

Speaking of which, I also just noticed I made kind of a huge mistake in 1.3.0. I just submitted a corrected version; anyone using 1.3.0 should update it.

#360 Shoelace

Shoelace

    The Shaman of Sexy!

  • Members
  • Real Name:Michael
  • Pronouns:He / Him
  • Location:Arizona

Posted 27 December 2017 - 05:24 PM

I am indeed using 1.3.0, so I will update to the newest version you uploaded. :)

 

Yeah, I noticed the size issue this morning because the allegro.log told me it needed to be a certain size (first time I used the allegro.log, thanks for teaching me that).  I now corrected it, it is now 24 per slot.  I may have copied the slot data from an earlier version.  >_< Don't mind me...

 

Thanks for all of your help. :)  I am going to do some massive testing and see how it works. 




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users