Jump to content

Photo

tango.zh


  • Please log in to reply
398 replies to this topic

#121 Mero

Mero

    Touch Fluffy Tail

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

Posted 05 June 2015 - 01:28 PM

Do Ghost_Waitframe routines automatically wait for Tango routines to finish if we freeze the FFCs?



#122 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 05 June 2015 - 06:18 PM

Are you freezing the FFCs wit a FreezeAll combo, as you can use FreezeAll(Except FFCs) + SuspendGhostZHScripts(); and then instruct ResumeGhostZHScripts(); when you remove the Data from your tango freeze flag.

 

I believe that SuspendGhostZHScripts(); throws in a special Waitframe loop for ghost.zh, but I haven't looked at the source for a while.



#123 Mero

Mero

    Touch Fluffy Tail

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

Posted 05 June 2015 - 09:27 PM

That's the only way to freezes ffcs; for now as there's no script function for it yet, So yes that's what I'm doing. My question still stands though, will ghost.zh routines wait? SInce some of those are ran by the global script.



#124 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 05 June 2015 - 10:40 PM

Let me re-clarify: I believe that all actions run by the compound ghost functions, CleanUpGhostFFCs(), AutoGhost(), and DrawGhostFFCs(); or their modern equivalents, are halted by calling a single repeating Watiframe() instead of their normal instructions, while the ghost freeze flag is true. You might want to look at the functions, but that's how I would have set it up, because it's clean/tidy.

 

Thus, no routine stemming from those (aside for something trying to unset the evaluation condition--should run, but you should check the basecode to see exactly what setting the flag does, in the event that my way of doing that != The Saffith method.

 

If i hadn't already been awake, and working, for 26 hours, I'd look now, but for the present I'll post this, and dig into Ghost afterwards; so if Saffith responds furst, or you find the code that suspends ghost/autoghost in the interim, fantastic. If not, I'll report what I find from the version that I'm using, which although dated, should still be similar.

 

----

 

Skimming, and looking at the functions, it seems that many routines do still run. It's looking as if the freeze flag only affects portions of the routines in the standard functions.

 

If you need to fully suspend ghost, what you could do, is add a nested statement in your main active infinite loop:

do {
   GhostFunctions(); }
   while ( !condition )

Setting up a condition of your own. For example, a custom inherent script flag might work, or an FFC that triggers any global boolean. You;d need to ensure that you modify the ghost resume function, to usdet that variable, but that would fully disable ghost.zh, without freezing all FFCs, if that's your goal.

 

The flags are all bitwise, so finding what each does requires more extensive examination, but I'm rather certain that quite a few routines are always running. I certainly don;t see any perpetual Waitframes(), which makes sense in a fashion, as that would also throw more Waitframe() instructions into a loop that is desirable.

 

It might be useful to document any anticipated conflict over which you're raising the question.


Edited by ZoriaRPG, 05 June 2015 - 10:55 PM.


#125 Saffith

Saffith

    IPv7 user

  • Members

Posted 06 June 2015 - 04:03 PM

SuspendGhostZHScripts() stops UpdateEWeapon() and AutoGhost() from running. Everything else continues normally. I didn't know that without looking, by the way. :P

#126 accela2me

accela2me

    Illustrious

  • Members
  • Real Name:Juliano
  • Location:Minas Gerais, Brazil

Posted 04 July 2015 - 06:31 PM

People, I need to create a quest with texts in portuguese, but I didn't understand how to put accentuation...

What's the difference between the LA.zh and the Link's Awakening font in characterlist.qst?

 

import "std.zh"
import "string.zh"

import "tango.zh"
import "tango/font/LA.zh"

// -----------------------------------------------------------------------------------------------------------------------

global script Slot_2
{
    void run(){

        SetUpStyles();
        Tango_Start();

        while(true){

            Tango_Update1();

            Waitdraw();

            Tango_Update2();

            Waitframe();

        }
    }
}

// -----------------------------------------------------------------------------------------------------------------------

// Uses Tango to display a ZC message (Quest > Strings). Returns the number of
// the text slot used or TANGO_INVALID if the message could not be displayed.
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);
    
    // If a message contains '%', only the portion after that is loaded.
    Tango_LoadMessage(slot, message,  '%');
    Tango_SetSlotStyle(slot, style);
    Tango_SetSlotPosition(slot, x, y);
    Tango_ActivateSlot(slot);
    
    return slot;
}

// -----------------------------------------------------------------------------------------------------------------------

const int STYLE_PLAIN = 0;


void SetUpStyles()
{
    SetUpPlainStyle();
}


void SetUpPlainStyle()
{
    Tango_SetStyleAttribute(STYLE_PLAIN, TANGO_STYLE_TEXT_FONT, TANGO_FONT_LA);
    Tango_SetStyleAttribute(STYLE_PLAIN, TANGO_STYLE_TEXT_X, 8);
    Tango_SetStyleAttribute(STYLE_PLAIN, TANGO_STYLE_TEXT_Y, 6);
    Tango_SetStyleAttribute(STYLE_PLAIN, TANGO_STYLE_TEXT_WIDTH, 144);
    Tango_SetStyleAttribute(STYLE_PLAIN, TANGO_STYLE_TEXT_HEIGHT, 52);
    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_SPEED, 5);
    Tango_SetStyleAttribute(STYLE_PLAIN, TANGO_STYLE_TEXT_SFX, 18);
    
    Tango_SetStyleAttribute(STYLE_PLAIN, TANGO_STYLE_FLAGS,
        TANGO_FLAG_ENABLE_SPEEDUP | TANGO_FLAG_ENABLE_SUPER_SPEED);
}

Edited by accela2me, 04 July 2015 - 06:43 PM.


#127 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 04 July 2015 - 07:04 PM

People, I need to create a quest with texts in portuguese, but I didn't understand how to put accentuation...
What's the difference between the LA.zh and the Link's Awakening font in characterlist.qst?
 
 

import "std.zh"
import "string.zh"

import "tango.zh"
import "tango/font/LA.zh"

// -----------------------------------------------------------------------------------------------------------------------

global script Slot_2
{
    void run(){

        SetUpStyles();
        Tango_Start();

        while(true){

            Tango_Update1();

            Waitdraw();

            Tango_Update2();

            Waitframe();

        }
    }
}

// -----------------------------------------------------------------------------------------------------------------------

// Uses Tango to display a ZC message (Quest > Strings). Returns the number of
// the text slot used or TANGO_INVALID if the message could not be displayed.
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);
    
    // If a message contains '%', only the portion after that is loaded.
    Tango_LoadMessage(slot, message,  '%');
    Tango_SetSlotStyle(slot, style);
    Tango_SetSlotPosition(slot, x, y);
    Tango_ActivateSlot(slot);
    
    return slot;
}

// -----------------------------------------------------------------------------------------------------------------------

const int STYLE_PLAIN = 0;


void SetUpStyles()
{
    SetUpPlainStyle();
}


void SetUpPlainStyle()
{
    Tango_SetStyleAttribute(STYLE_PLAIN, TANGO_STYLE_TEXT_FONT, TANGO_FONT_LA);
    Tango_SetStyleAttribute(STYLE_PLAIN, TANGO_STYLE_TEXT_X, 8);
    Tango_SetStyleAttribute(STYLE_PLAIN, TANGO_STYLE_TEXT_Y, 6);
    Tango_SetStyleAttribute(STYLE_PLAIN, TANGO_STYLE_TEXT_WIDTH, 144);
    Tango_SetStyleAttribute(STYLE_PLAIN, TANGO_STYLE_TEXT_HEIGHT, 52);
    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_SPEED, 5);
    Tango_SetStyleAttribute(STYLE_PLAIN, TANGO_STYLE_TEXT_SFX, 18);
    
    Tango_SetStyleAttribute(STYLE_PLAIN, TANGO_STYLE_FLAGS,
        TANGO_FLAG_ENABLE_SPEEDUP | TANGO_FLAG_ENABLE_SUPER_SPEED);
}


LA.zh is a Tango font, that is identical in appearance to the in-quest font. I don't believe it includes any non-standard (ASCII) characters.

If you want to add special characters, you'll need to build a custom tile font (to use with Tango) for them, which isn't hard, just tedious.

#128 Saffith

Saffith

    IPv7 user

  • Members

Posted 04 July 2015 - 08:02 PM

For characters after ~, use @### or @(###). For instance, in the Link's Awakening font, t@218nica or t@(218)nica would become túnica.

#129 accela2me

accela2me

    Illustrious

  • Members
  • Real Name:Juliano
  • Location:Minas Gerais, Brazil

Posted 04 July 2015 - 10:09 PM

I tried this before, but the character conversion doesn't happen and I don't know what is missing :/

For instance, I want to show the string "Voc@(234) @(233) o her@(250)i desta hist@(250)ria, Link!" (Você é o herói desta história, Link!) using the OneTimeMessage script

bool stringnewloc[256];

ffc script OneTimeMessage_NewLocations
{
    void run(int message, int boolean){
        if(!stringnewloc[boolean]){
            Screen->Message(message);
            stringnewloc[boolean] = true;
        }
    }
}

 

but I think this script must be changed first, right?



#130 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 04 July 2015 - 11:19 PM

Yeah, you'll have to swap out the Screen->Message() call with a call to Tango's functions.

 

Use the convenience method ShowMessage() in the code for the Tango demo quest.



#131 accela2me

accela2me

    Illustrious

  • Members
  • Real Name:Juliano
  • Location:Minas Gerais, Brazil

Posted 05 July 2015 - 05:05 PM

Yeah, but how would the script using tango?
I couldn't relate these 2 lines:

Screen->Message(message);
int slot=ShowMessage(message, TANGO_SLOT_NORMAL, STYLE_PLAIN, 32, 32);



#132 Saffith

Saffith

    IPv7 user

  • Members

Posted 05 July 2015 - 05:19 PM

How about this, instead:

int ShowMessage(int message)
{
    int slot=Tango_GetFreeSlot(TANGO_SLOT_ANY);
    if(slot==TANGO_INVALID)
        return TANGO_INVALID;
    
    Tango_ClearSlot(slot);
    Tango_LoadMessage(slot, message);
    Tango_SetSlotStyle(slot, STYLE_PLAIN);
    Tango_SetSlotPosition(slot, 56, 32);
    Tango_ActivateSlot(slot);
    
    return slot;
}
Then you can just use ShowMessage(message).

#133 accela2me

accela2me

    Illustrious

  • Members
  • Real Name:Juliano
  • Location:Minas Gerais, Brazil

Posted 06 July 2015 - 04:06 PM

ok, I did a test file to show what I need:
https://dl.dropboxus...472/tangoBR.rar

 

the NPC script is working very well (by the way, I'll use the GUI font instead of the Link's Awakening, because the accentuation of the LA font is "bugged")

about the One Time Message script, I still don't get how to change the script :( sorry.



#134 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 07 July 2015 - 08:54 AM

bool stringnewloc[256];

ffc script OneTimeMessage_NewLocations
{
    void run(int message, int boolean){
        if(!stringnewloc[boolean]){
            ShowMessage(message);
            stringnewloc[boolean] = true;
        }
    }
}

int ShowMessage(int message)
{
    int slot=Tango_GetFreeSlot(TANGO_SLOT_ANY);
    if(slot==TANGO_INVALID)
        return TANGO_INVALID;
    
    Tango_ClearSlot(slot);
    Tango_LoadMessage(slot, message);
    Tango_SetSlotStyle(slot, STYLE_PLAIN);
    Tango_SetSlotPosition(slot, 56, 32);
    Tango_ActivateSlot(slot);
    
    return slot;
}
It would look like that, presuming that you are using STYLE_PLAIN as your definition, and are not hardcoding a string into the FFC.

ShowMessage(id) is a global function, so you simply call it instead of Screen->Message(id). Replace any instance of Screen->Message(id) (where id is the number of the string to display) with ShowMessage(id), and your message will be parsed by Tango, instead of the normal internal string display (message) handler.

Edited by ZoriaRPG, 07 July 2015 - 08:56 AM.


#135 accela2me

accela2me

    Illustrious

  • Members
  • Real Name:Juliano
  • Location:Minas Gerais, Brazil

Posted 07 July 2015 - 02:49 PM

Friends, my question about the OneTimeMessage script is because of this error:

 

Pass 1: Parsing
Pass 2: Preprocessing
Pass 3: Building symbol tables
Pass 4: Type-checking/Completing function symbol tables/Constant folding
tangoBR/scripts.z, line 29: Error T21: Could not match type signature ShowMessage(float).

 

 

edit: I found the problem to the error above (a conflict with the NPC script that uses the "int ShowMessage()" from the tangodemo.qst) but now the OneTimeMessage script doesn't work with the ShowMessage(id) function.


Edited by accela2me, 07 July 2015 - 03:33 PM.



0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users