Jump to content

Photo

tango.zh


  • Please log in to reply
398 replies to this topic

#271 Gégé

Gégé

    Senior

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

Posted 27 February 2016 - 11:53 AM

I try to have 2 fonts for Popup message. TANGO_FONT_LTTP_OUTLINE and TANGO_FONT_LTTP_SMALL.
 
Spoiler


Spoiler

Is it possible please ?

Edited by Gégé, 27 February 2016 - 11:54 AM.


#272 Saffith

Saffith

    IPv7 user

  • Members

Posted 27 February 2016 - 10:12 PM

I didn't include @font for some reason. I'll have to add that for the next version. It's a bit ugly, but you can add it as a custom variable.
In the main file:
const int VAR_FONT = 0.2911;

void Tango_SetCustomVar(int var, float value)
{
    if(var==VAR_FONT)
    {
        int style=Tango_GetSlotStyle(Tango_GetCurrentSlot());
        Tango_SetStyleAttribute(style, TANGO_STYLE_TEXT_FONT, value);
        __Tango_Data[__TDIDX_REFRESH_STYLE]=1;
    }
    // Any others...
    else
        Tango_LogUndefinedVariable(var);
}
And the popup script:
    void run()
    {
        int slot=Tango_GetFreeSlot(TANGO_SLOT_POPUP);
        if(slot==TANGO_INVALID)
            Quit();
        
        // Item obtained, font change
        // Partial item name
        // Followed by commands to move up, wait, and move back down
        int obtained[]="OBJET TROUVE@26@set(@font @a0)";
        int itemName[64];
        int movement[]="@while(@greater(@y 120) @inc(@y -3))@delay(120)@while(@less(@y 168) @inc(@y 3))";
        
        this->GetName(itemName);
        
        Tango_ClearSlot(slot);
        
        Tango_SetStyleAttribute(STYLE_POPUP, TANGO_STYLE_TEXT_FONT, TANGO_FONT_LTTP_OUTLINE);
        Tango_SetSlotVar(slot, TANGO_VAR_A0, TANGO_FONT_LTTP_SMALL);
        
        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, 64, 168);
        Tango_ActivateSlot(slot);
    }


#273 Gégé

Gégé

    Senior

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

Posted 28 February 2016 - 10:44 AM

Thank you it's perfect :love:. Before, I used @Char ()
 
At the same position as "obtained", can we put DmapName ? I managed to display but not in the same position nor with the second font.


Edited by Gégé, 28 February 2016 - 10:45 AM.


#274 Saffith

Saffith

    IPv7 user

  • Members

Posted 28 February 2016 - 11:08 PM

Instead of that, you mean?
 
    void run()
    {
        int slot=Tango_GetFreeSlot(TANGO_SLOT_POPUP);
        if(slot==TANGO_INVALID)
            Quit();
        
        // DMap name, font change
        // Partial item name
        // Followed by commands to move up, wait, and move back down
        int dmap[21];
        Game->GetDMapTitle(Game->GetCurDMap(), dmap);
        int fontChange[]="@26@set(@font @a0)";
        int itemName[64];
        int movement[]="@while(@greater(@y 120) @inc(@y -3))@delay(120)@while(@less(@y 168) @inc(@y 3))";
        
        this->GetName(itemName);
        
        Tango_ClearSlot(slot);
        
        Tango_SetStyleAttribute(STYLE_POPUP, TANGO_STYLE_TEXT_FONT, TANGO_FONT_LTTP_OUTLINE);
        Tango_SetSlotVar(slot, TANGO_VAR_A0, TANGO_FONT_LTTP_SMALL);
        
        Tango_LoadString(slot, dmap);
        Tango_AppendString(slot, fontChange);
        Tango_AppendString(slot, itemName, '%'); // Only display the part of the name after '%'
        Tango_AppendString(slot, movement);
        
        Tango_SetSlotStyle(slot, STYLE_POPUP);
        Tango_SetSlotPosition(slot, 64, 168);
        Tango_ActivateSlot(slot);
    }


#275 Gégé

Gégé

    Senior

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

Posted 29 February 2016 - 02:04 AM

Thank you very much ;).
I did not put it on a new line :
Tango_AppendString(slot, fontChange);

Edited by Gégé, 29 February 2016 - 02:04 AM.


#276 Gégé

Gégé

    Senior

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

Posted 22 March 2016 - 12:14 PM

Hello, I'm looking to change Screen->DrawInteger for using tango.
I try with
Tango_DrawString(int str, int font, int cset, int color, int x, int y, int layer)
But it does not work. I am wrong function ?

Edited by Gégé, 22 March 2016 - 12:15 PM.


#277 Saffith

Saffith

    IPv7 user

  • Members

Posted 22 March 2016 - 12:49 PM

You have to convert the number to a string first.
void Tango_DrawInteger(int num, int font, int cset, int color, int x, int y, int layer)
{
    int numStr[13];
    itoa(numStr, 0, num;)
    Tango_DrawString(numStr, font, cset, color, x, y, layer);
}
That will only draw an integer, mind. If you want floats, that's slightly different.

#278 Gégé

Gégé

    Senior

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

Posted 22 March 2016 - 01:58 PM

It's exactly what I was looking for. Thank you very much :love:.



#279 Shadowblitz16

Shadowblitz16

    Illustrious

  • Members

Posted 18 May 2016 - 06:37 PM

I can't get tangoQuickStart to work

I changed some things and it says 

Spoiler

Edited by Shadowblitz16, 18 May 2016 - 07:33 PM.


#280 Saffith

Saffith

    IPv7 user

  • Members

Posted 18 May 2016 - 11:47 PM

You need to import std.zh and tango.zh, too.

#281 Shadowblitz16

Shadowblitz16

    Illustrious

  • Members

Posted 19 May 2016 - 12:36 PM

k so I imported std.zh, Tango.zh, and TangoQuickStart.zh  in my InstantMessage.z script

however it gives me this

Spoiler


#282 Saffith

Saffith

    IPv7 user

  • Members

Posted 19 May 2016 - 01:50 PM

It needs string.zh, too.

#283 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 25 June 2016 - 06:04 PM

I have a shop script, that I made on request, and I'm considering making it available to everyone. One issue, is that it uses a menu, that I made for Tango b1.0.0.

 

I'm going to post it here, and what I need to know, is if the changes between Tango b1.0.0 and Tango b1.1.0 will require me to make alterations to the menu function; and if so, what need I change/update?

 

The menu itself is contained in the function int BuyYesNo(int msg).

 

Script



#284 Saffith

Saffith

    IPv7 user

  • Members

Posted 25 June 2016 - 10:42 PM

It shouldn't need any changes.

#285 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 26 June 2016 - 02:15 AM

It shouldn't need any changes.


Good, good. I know that you added menu-specific things, such as adding options in slots, and things to do with the cursor states, but I didn't know if that deprecated the older method of menu building; so I'll release it after I thouroughly test the latest (and I hope, final) rendition of the script.


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users