Jump to content

Photo

tango.zh


  • Please log in to reply
398 replies to this topic

#31 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 12 November 2013 - 06:50 PM

I think shortening the function names is fine. As for the unique names, I think you can call the Tango strings "string slots" or something similar. After all, they are 'slots' to load strings into, aren't they?



#32 Saffith

Saffith

    IPv7 user

  • ZC Developers

Posted 13 November 2013 - 01:47 PM

That could work. I've been thinking of "slots" as where the strings are stored — the containers rather than the contents — but users aren't dealing with loaded strings directly, so perhaps there's no need to make that distinction.

#33 Saffith

Saffith

    IPv7 user

  • ZC Developers

Posted 27 November 2013 - 08:38 PM

Updated to beta 1. At this point, I'd consider it suitable for general use. I can't promise there won't be any compatibility-breaking changes before 1.0, but I don't expect any.

There have been several since alpha 3, however. Lots of things have been renamed, the font format has changed, and extended font characters now start at 256 instead of 127.

The biggest new features this time:
  • Characters can be inserted with @## or @(##) now; @26 is a line break, @(76)@(105)@(110)@(107) is "Link"
  • A flag for centered text
  • A flag to freeze the screen (but you'll have to provide your own implementation)
  • New options for loading text; you can append to existing text and load just part of a string
  • A function that will calculate custom function names and create constants for you
  • Font definitions for all complete Latin fonts
  • A lot more input validation and error handling
  • Much better documentation
Also, it turns out a lot of built-in fonts have useful characters all the way up to 255. I made a character list utility quest to browse them with.

#34 Jamian

Jamian

    ZC enthusiast

  • Members

Posted 02 December 2013 - 06:37 PM

I just wanted to say this is great stuff, that I certainly will be using when I start a new project.

 

Thumbs up!



#35 Mero

Mero

    Touch Fluffy Tail

  • Banned
  • Real Name:Tamamo No Mae
  • Location:Rainbow Factory

Posted 20 December 2013 - 03:16 PM

I wish to have the slot position set when needed based off Link's position on screen so he is never covered by the message box. Is this possible?



#36 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 20 December 2013 - 06:10 PM

You can use these functions I made:

const int TEXTBOX_HEIGHT = 0;
const int TEXTBOX_WIDTH = 0; //Set to the size of your text boxes
 
int MessageCenterScreenX(){
    return (SCREEN_WIDTH/2) - (TEXTBOX_WIDTH/2);
}

int MessageByLinkX(){
    return Link->X - TEXTBOX_WIDTH / 2;
}

int MessageByLinkY(){
    //Link in top half, box in bottom half
    if ( Link->Y <= SCREEN_VISIBLEHEIGHT/2 ){
        return Link->Y + 24;
    }
    
    //Link in bottom half, box in top half
    else
        return Link->Y - 8 - TEXTBOX_HEIGHT;
}

int ShowMessageByLink(int message, int style){
    return ShowMessage(message, TANGO_SLOT_NORMAL, style, MessageCenterScreenX(), MessageByLinkY());
}

int ShowStringByLink(int string, int style){
    return ShowString(string, TANGO_SLOT_NORMAL, style, MessageCenterScreenX(), MessageByLinkY());
}


#37 Mero

Mero

    Touch Fluffy Tail

  • Banned
  • Real Name:Tamamo No Mae
  • Location:Rainbow Factory

Posted 21 December 2013 - 10:55 PM

Thanks MM, I think I understand how to work with the slots now. :D



#38 Mero

Mero

    Touch Fluffy Tail

  • Banned
  • Real Name:Tamamo No Mae
  • Location:Rainbow Factory

Posted 06 January 2014 - 10:31 AM

How do you we go about making a string a continuation of a previous string. So that the tango strings behave like ZCs?



#39 Saffith

Saffith

    IPv7 user

  • ZC Developers

Posted 09 January 2014 - 03:46 PM

If you mean messages from Quest->Strings, use either @next(##) or @set(@next ##). There's currently no way to do the same with ZScript strings.

#40 Mero

Mero

    Touch Fluffy Tail

  • Banned
  • Real Name:Tamamo No Mae
  • Location:Rainbow Factory

Posted 21 January 2014 - 09:59 AM

I'm planning on writing some custom functions that function the control codes in zstrings. Also would you mine if I use some of your scripts you've provided in the demo?



#41 Saffith

Saffith

    IPv7 user

  • ZC Developers

Posted 21 January 2014 - 10:10 AM

Sure, go ahead.

#42 Zepinho

Zepinho

    Experienced Forumer

  • Members
  • Location:Trieste, Italy

Posted 23 January 2014 - 06:07 AM

Wow, this seems great.

I would like to start to use some of this stuff.

But, may be stupid question... how do I start?

I seem not to be able to download the demo file...

 

Any suggestion on a very simple "hello world" code to understand how this stuff works?

For instance, how do I write a global script to have a mesage box (center of the screen, black background, Link's Awakening font...) saying "Hello World" when pressing A?

 

Thanks in advance!



#43 Avaro

Avaro

    o_o

  • Members
  • Real Name:Robin
  • Location:Germany

Posted 23 January 2014 - 09:23 AM

I would really love to use this as well. Maybe, I should wait for a more stable version though. You guys keep giving me the impression that tango.zh could easily break the quest, so.. let me know when the issues are fixed.

#44 Saffith

Saffith

    IPv7 user

  • ZC Developers

Posted 23 January 2014 - 12:00 PM

Wow, this seems great.
I would like to start to use some of this stuff.
But, may be stupid question... how do I start?
I seem not to be able to download the demo file...
 
Any suggestion on a very simple "hello world" code to understand how this stuff works?
For instance, how do I write a global script to have a mesage box (center of the screen, black background, Link's Awakening font...) saying "Hello World" when pressing A?

Huh, not sure what happened to the demo. I re-uploaded it and added an alternate link just in case. It's helpful to look at examples, I think; Tango's a lot easier to use than it is to explain.

Here are the basic directions. I'll add this stuff to the usage file for future versions.

You need three functions in your global script: Tango_Start before the loop, Tango_Update1 before Waitdraw, and Tango_Update2 after Waitdraw.
You need to import at least one font definition and set up at least one style. That looks something like this:
import "tango/font/LA.zh"

const int STYLE_PLAIN = 0;

void SetUpPlainStyle()
{
    Tango_SetStyleAttribute(STYLE_PLAIN, TANGO_STYLE_BACKDROP_TYPE, TANGO_BACKDROP_COLOR);
    Tango_SetStyleAttribute(STYLE_PLAIN, TANGO_STYLE_BACKDROP_CSET, 0);
    Tango_SetStyleAttribute(STYLE_PLAIN, TANGO_STYLE_BACKDROP_COLOR, 15);
    Tango_SetStyleAttribute(STYLE_PLAIN, TANGO_STYLE_BACKDROP_WIDTH, 160);
    Tango_SetStyleAttribute(STYLE_PLAIN, TANGO_STYLE_BACKDROP_HEIGHT, 64);

    Tango_SetStyleAttribute(STYLE_PLAIN, TANGO_STYLE_TEXT_FONT, TANGO_FONT_LA);
    Tango_SetStyleAttribute(STYLE_PLAIN, TANGO_STYLE_TEXT_CSET, 0);
    Tango_SetStyleAttribute(STYLE_PLAIN, TANGO_STYLE_TEXT_COLOR, 1);
    Tango_SetStyleAttribute(STYLE_PLAIN, TANGO_STYLE_TEXT_X, 8);
    Tango_SetStyleAttribute(STYLE_PLAIN, TANGO_STYLE_TEXT_Y, 8);
    Tango_SetStyleAttribute(STYLE_PLAIN, TANGO_STYLE_TEXT_WIDTH, 144);
    Tango_SetStyleAttribute(STYLE_PLAIN, TANGO_STYLE_TEXT_HEIGHT, 48);
    Tango_SetStyleAttribute(STYLE_PLAIN, TANGO_STYLE_TEXT_SPEED, 5);
    Tango_SetStyleAttribute(STYLE_PLAIN, TANGO_STYLE_TEXT_SFX, 18);
}
That's a minimal definition; there are a lot more attributes you can set.

With that set up, displaying a message takes six steps:
1: Find a free text slot (Tango_GetFreeSlot())
2: Clear any data already in the slot (Tango_ClearSlot())
3: Load text into the slot (Tango_LoadString() or Tango_LoadMessage())
4: Set the style (Tango_SetSlotStyle())
5: Set the position (Tango_SetSlotPosition())
6: Activate the text slot (Tango_ActivateSlot())

You can combine all of that into one function easily. The demo has this:
int ShowMessage(int message, int type, int style, float x, float y)
{
    int slot=Tango_GetFreeSlot(type);
    if(slot==TANGO_INVALID)
        return TANGO_INVALID;
    
    Tango_ClearSlot(slot);
    Tango_LoadMessage(slot, message);
    Tango_SetSlotStyle(slot, style);
    Tango_SetSlotPosition(slot, x, y);
    Tango_ActivateSlot(slot);
    
    return slot;
}
Some of the concepts (particularly text slot definitions) require further explanation; those should all be covered in the usage file. Let me know if it's not clear enough.

That all sounds like a lot of work, but it's really not. It's mostly one-time stuff, and it's all simple. It just takes a lot of work to explain it all. :P
 

I would really love to use this as well. Maybe, I should wait for a more stable version though. You guys keep giving me the impression that tango.zh could easily break the quest, so.. let me know when the issues are fixed.

Nah, it's actually pretty stable at this point. I only know of one bug right now, and it's pretty minor. I don't expect any changes in subsequent releases to break compatibility.
  • OmegaX likes this

#45 Zepinho

Zepinho

    Experienced Forumer

  • Members
  • Location:Trieste, Italy

Posted 24 January 2014 - 05:31 AM

Great,

thanks a lot Saffith.

 

Quick question:

is it currently possible to include an arbitrary combo / tile inside a text frame?

It would be nice to have something like "You found a @combo(99)!", like in the old good GB zelda games...

Can you think at an easy way to implement this kind of functionality?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users