Jump to content

Photo

tango.zh


  • Please log in to reply
398 replies to this topic

#316 Saffith

Saffith

    IPv7 user

  • ZC Developers

Posted 31 October 2016 - 12:17 PM

The return value from Tango_GetFreeSlot() should be the first argument to the other functions. And you'll need to set up a style. TANGO_FONT_PROPORTIONAL isn't a style; it's a font pitch. Look at styles.zh in the demo for examples. You could also just use the functions from tangoQuickStart.zh.

I have to point out, though, that this is not the most beginner-friendly library. You don't seem to have much experience with ZScript, and you're starting with something relatively difficult. You're probably going to have a bad time of it.

#317 Shadowblitz16

Shadowblitz16

    Illustrious

  • Members

Posted 31 October 2016 - 03:09 PM

@Saffith

Ya Its how you learn though. I think I almost got it.

the only problem is that the message box flickers, the text auto scrolls instead of waiting for input, and the text doesn't disappear when the message is over.

I suspect the message not disappearing is because I haven't checked if the message was over with "Tango_SlotIsFinished()" 

 

can you explain how to fix these problems?

I suspect (1) is cause by my global script running it every frame?

I don't know about (2)

and (3) I guess I need to check if its finished and then if it is use "Tango_ClearSlot()"?



#318 Saffith

Saffith

    IPv7 user

  • ZC Developers

Posted 01 November 2016 - 05:30 PM

Ya Its how you learn though.

Could be. Could also be how you flail blindly until you give up in frustration.

There are all sorts of things that could be wrong. Did you set up a style yet? Are you using the regular global script, or did you combine it with an existing one? Did you start a new game? Is there anything useful in allegro.log?

#319 Shadowblitz16

Shadowblitz16

    Illustrious

  • Members

Posted 01 November 2016 - 07:07 PM

@Saffith

1) I was using the STYLE_TQS style in TangoQuickStart.zh.

2) I am using a my global script for updating and initializing tango and then playing the message for within the ffc script

3) no I am using EZGBZ tileset quest

4) I don't know probably not I was messing with stdWeapons.zh today

 

Edit: ok so I got it working kinda

basically I have it so that it shows a message with tango but it auto scrolls to the end of the text.

I want it to stop when the text reaches the height of the text box and then show a more.. combo and  continue printing when I press A 


Edited by Shadowblitz16, 01 November 2016 - 09:13 PM.


#320 Saffith

Saffith

    IPv7 user

  • ZC Developers

Posted 02 November 2016 - 11:01 AM

Then you need to split it into multiple messages or add in a call to @pressa().

#321 Shadowblitz16

Shadowblitz16

    Illustrious

  • Members

Posted 02 November 2016 - 02:13 PM

@Saffith

Is there a way to get only the end char's position displaying in the message box without cutting off characters?

if so I can just append the @pressa() at the end of the char displayed in the message box


Edited by Shadowblitz16, 02 November 2016 - 02:27 PM.


#322 Saffith

Saffith

    IPv7 user

  • ZC Developers

Posted 02 November 2016 - 02:36 PM

I think you're asking if you can determine programmatically where to put it? No. You just have to try it and see.

#323 Shadowblitz16

Shadowblitz16

    Illustrious

  • Members

Posted 02 November 2016 - 03:42 PM

@Saffith

ok that sucks since my messages are different depending on the chest's contents



#324 ywkls

ywkls

    Master

  • Members

Posted 15 April 2017 - 08:37 PM

So, I tried writing a function for a guy who runs a minigame. Sort of a shop lite script. But something's going wrong, because it freezes the game and I'm not sure what.

 

Minigame Guy

 

I originally intended for it to display the "Press Ex4 message while waiting for you to interact with him, but I haven't gotten around to it yet.


Edited by ywkls, 15 April 2017 - 08:38 PM.


#325 Gégé

Gégé

    Senior

  • Members
  • Real Name:Gérard
  • Location:France

Posted 19 April 2017 - 07:41 AM

Hello :)
How to show a message from Message String, please ?
 

    int str = 1;
    int buffer[128];
    GetMessage(str, buffer);
    Texte(7, buffer , TANGO_FONT_LTTP_SMALL, 64, 64, TF_CENTERED, Lettre);

Edit : I forgot

strcpy();

Edited by Gégé, 24 April 2017 - 07:11 AM.


#326 Saffith

Saffith

    IPv7 user

  • ZC Developers

Posted 25 April 2017 - 09:29 PM

I swear I've told it like three times now to follow this topic. :P
 

So, I tried writing a function for a guy who runs a minigame. Sort of a shop lite script. But something's going wrong, because it freezes the game and I'm not sure what.

At what point does it freeze? Any errors logged?
I don't see yet why it's freezing, but it definitely could be simplified a bit. In particular, if you don't pass 1 to @domenu(), you won't need to handle canceling.
 

Edit : I forgot

strcpy();

That all you needed, then? I don't actually see why you need strcpy(), but, hey, long as it works.
  • Gégé likes this

#327 Gégé

Gégé

    Senior

  • Members
  • Real Name:Gérard
  • Location:France

Posted 30 April 2017 - 07:47 AM

That all you needed, then? I don't actually see why you need strcpy(), but, hey, long as it works.

 
I wanted to show a string message without using style.
Just with a simple function
 
Here, I did :
 

Texte(7, message, TANGO_FONT_LTTP_SMALL, 64, 64, TF_CENTERED, Lettre);
Texte(LAYER, Message/Number , FONT, X, Y, TF_CENTERED, Message or Integer);

It works great but messages from Quest->String was not displayed.
With strcpy(); I succeeded. But, Tango_GetStringWidth(); does not work with that ? (for TF_CONSTANT) 

I finally use for text message
int[ ] = " ";  and the GetName() functions.

 

Tango_GetStringWidth();

I managed to size automatically the border in relation to the text with that. It's a nice function  :love:  !


Edited by Gégé, 30 April 2017 - 07:50 AM.


#328 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 02 May 2017 - 02:51 PM



I think you're asking if you can determine programmatically where to put it? No. You just have to try it and see.

 

Tango_GetStringWidth();

 

I do not know if this issue is now resolved, using the above function. If not, I'm just throwing this out there as an idea, that I have used elsewhere, was to track a total width of a string by using an array of character sizes, and doing += size analysing each character in the string, to determine its display width. (Copy a string into a buffer, keep a tally of its size, and append the instruction if the next character would overflow the allotted space.)

 

This is in effect, similar to what I had to do, to determine where to put a blinking cursor in a displayed string, as well, in the function int GetCursorSpacing(int chr). [Line 531].

 

In Tango, the font character widths are already known, so a function to tally them, and determine based on the output box display size (defined in the style), when they would overflow, should be straightforward; or did I misunderstand the issue here, and the request?

 

P.S. Clearly, the user may also define functions to do this. If you add it to the header Saffith, please make it an option that is enabled by default. One of these days, I need to try the post-beta version of this, go through it in detail, and update my scripts to work with it, as some that I have made, and shared, have been known to be broken past beta 1.0.0.


Edited by ZoriaRPG, 02 May 2017 - 03:35 PM.


#329 Russ

Russ

    Caelan, the Encouraging

  • Administrators
  • Location:Washington

Posted 20 June 2017 - 02:35 PM

I've been using tango for a bit and I think I get the basics, though I have a few questions, mostly stemming from the fact that while I know how to use tango for some things, I don't feel like I truly understand what it's doing. It's a magical black box. Anyways, questions.

So I've got a style for use on a custom subscreen to display flavor text. The only flag set is TANGO_FLAG_PERSISTENT, so that the text writes itself on the subscreen while you're viewing it but can't be sped by pressing A so you can still select items and the like. However, I'd like to expand the system to allow for character banter of sorts. Ideally, I'd want for one string to print, and then once it's done, having a second string underneath it begin. Is there any way of accomplishing this? Is there some internal variable I can check to see when the first string has finished printing so that I can play the second string?

The other question I have is in regards to advancing strings. With the default strings in ZC, holding A or B not only speeds up/instantly prints the text of the string, but also advances to the next string automatically after a few seconds. In Tango, so far as I can tell, you have to manually press A after each string has finished printing. Is there any way to replicate the built-in ZC behavior of strings with Tango?

#330 Saffith

Saffith

    IPv7 user

  • ZC Developers

Posted 20 June 2017 - 03:25 PM

It's a magical black box.

The best kind of box!
 

Is there some internal variable I can check to see when the first string has finished printing so that I can play the second string?

There are a couple of ways you could do that. Tango_SlotIsFinished() will tell you when the string is finished printing, so you could check that each frame. Another option would be to use @sync().
"This is string 1@sync(1)"
"@sync(1)This is string 2"
Start them both running at once, and string 2 won't start until string 1 finishes. That is, if two strings call @sync() with the same argument, whichever one reaches it first will stop and wait for the other one to get there. You could pair it with Tango_Sync() instead, which works the same way. That would look something like:
int str1[]="This is string 1@sync(1)";
int str2[]="This is string 2";
ShowString(slot1, str1);
Tango_Sync(1); // Doesn't return until @sync(1) is called
ShowString(slot2, str2);
 

Is there any way to replicate the built-in ZC behavior of strings with Tango?

Hmm... There isn't anything like that built in, but I'll look into adding it. Probably an argument to __Tango_PressAdvance() to tell you how long it's been waiting.

It's a bit kludgey, but you could do it by using @a0 or @a1 as a timer. In the function that sets up the slot, add a line like this:
Tango_SetSlotVar(slot, TANGO_VAR_A0, MIN_ADVANCE_DELAY);
Then edit __Tango_PressAdvance() in the main file to check it and update that variable.
bool __Tango_PressAdvance()
{
    int slot=Tango_GetCurrentSlot();
    int timer=Tango_GetSlotVar(slot, TANGO_VAR_A0);
    
    if(timer==0)
    {
        // Reset for next time
        Tango_SetSlotVar(slot, TANGO_VAR_A0, MIN_ADVANCE_DELAY);
        return Link->InputA || Link->InputB;
    }
    else
    {
        // Count down
        Tango_SetSlotVar(slot, TANGO_VAR_A0, Max(timer-1, 0));
        return false;
    }
}

  • Russ likes this


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users