Author Topic: Change the message when adding a game to Favorites. [resolved]  (Read 5263 times)

Wenzon

  • Full Member
  • ***
  • Posts: 59
    • View Profile
I would like to change the message when adding a game to favorites. By default, it is displayed like this in AM ...

Add <game name> to Favourites?

I would like it to be displayed that way.

Add to Favourites?

Could someone help me with a script to solve this problem?
« Last Edit: May 04, 2020, 03:16:41 AM by Wenzon »

jedione

  • Hero Member
  • *****
  • Posts: 1135
  • punktoe
    • View Profile
Re: Change the message when adding a game to Favorites.
« Reply #1 on: April 30, 2020, 06:10:33 PM »
hope somone can help u ,,,would be nice to know how,

i just remove comferation through Am ,dont even like it asking weather it should add or remove......i know it is doing what is needed...
help a friend....

progets

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1274
    • View Profile
Re: Change the message when adding a game to Favorites.
« Reply #2 on: April 30, 2020, 09:17:15 PM »
Edit /attract/language/en.msg and add this on line #5

Code: [Select]
Add '$1' to Favourites?;Add to Favourites?

FYI - This is the file for English. If you're using a different language modify it's corresponding file.
« Last Edit: April 30, 2020, 09:22:09 PM by progets »

zpaolo11x

  • Hero Member
  • *****
  • Posts: 1245
    • View Profile
    • My deviantart page
Re: Change the message when adding a game to Favorites.
« Reply #3 on: April 30, 2020, 10:48:08 PM »
In your transition callback function check if Transition.ShowOvwrlay is triggered and if type is Overlay.Favourites you can change the text.msg field of your custom overlay controls. Of course this works if you are using custom overlay controls

progets

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1274
    • View Profile
Re: Change the message when adding a game to Favorites.
« Reply #4 on: April 30, 2020, 11:34:18 PM »
I love your passion and understand what you're saying but if this question needed to be asked, I assume they aren't coders. I was just giving a simple answer to the question.

This will also work across all layouts and not just one.
« Last Edit: April 30, 2020, 11:38:52 PM by progets »

zpaolo11x

  • Hero Member
  • *****
  • Posts: 1245
    • View Profile
    • My deviantart page
Re: Change the message when adding a game to Favorites.
« Reply #5 on: May 01, 2020, 03:03:11 AM »
I love your passion and understand what you're saying but if this question needed to be asked

You are right, your solution is better for non-coders, but sometimes even a coder is not aware of all the tricks you can play to make Attract Mode do what you really want ;D

Wenzon

  • Full Member
  • ***
  • Posts: 59
    • View Profile
Re: Change the message when adding a game to Favorites.
« Reply #6 on: May 01, 2020, 11:15:52 AM »
Edit /attract/language/en.msg and add this on line #5

Code: [Select]
Add '$1' to Favourites?;Add to Favourites?

FYI - This is the file for English. If you're using a different language modify it's corresponding file.

Excellent tip!

In your transition callback function check if Transition.ShowOvwrlay is triggered and if type is Overlay.Favourites you can change the text.msg field of your custom overlay controls. Of course this works if you are using custom overlay controls

Could you give an example using the method you mentioned?

zpaolo11x

  • Hero Member
  • *****
  • Posts: 1245
    • View Profile
    • My deviantart page
Re: Change the message when adding a game to Favorites.
« Reply #7 on: May 02, 2020, 12:06:40 AM »
This is the portion of transition callback you have to use in the Layout

Code: [Select]
fe.add_transition_callback( this, "on_transition" )

function on_transition( ttype, var0, ttime ) {

   if (ttype == Transition.ShowOverlay) {
      if (var0 == Overlay.Favourite) overlay_label.msg ="Your Message Here"
   }

}

and overlay_label, overlay_listbox is a text object and a listbox object defined as custom control using:

Code: [Select]
fe.overlay.set_custom_controls( overlay_label, overlay_listbox )
« Last Edit: May 02, 2020, 12:13:32 AM by zpaolo11x »

Wenzon

  • Full Member
  • ***
  • Posts: 59
    • View Profile
Re: Change the message when adding a game to Favorites.
« Reply #8 on: May 02, 2020, 08:38:54 AM »
This is the portion of transition callback you have to use in the Layout

Code: [Select]
fe.add_transition_callback( this, "on_transition" )

function on_transition( ttype, var0, ttime ) {

   if (ttype == Transition.ShowOverlay) {
      if (var0 == Overlay.Favourite) overlay_label.msg ="Your Message Here"
   }

}

and overlay_label, overlay_listbox is a text object and a listbox object defined as custom control using:

Code: [Select]
fe.overlay.set_custom_controls( overlay_label, overlay_listbox )

I tried to make changes based on your information but unfortunately it didn't work.
I don't understand programming and I have a little difficulty in the English language, but I am hardworking.
If you can help me with the code I'm using, I would appreciate it.

See below.

Code: [Select]
// Overall Surface
local overlaySurface = fe.add_surface(1920,1080);
overlaySurface.visible = false;

// create extra surface for the menu
local overlayMenuSur = overlaySurface.add_surface(661,581);
overlayMenuSur.set_pos(284,160);
overlayMenuSur.add_image("images/screen.png", 0, 40, 660, 541);

local overlay_lb = overlayMenuSur.add_listbox(1,150,661,380);
overlay_lb.rows = 9;
overlay_lb.charsize  = 40;
overlay_lb.set_rgb( 128, 128, 128 );
overlay_lb.font="Ledsitex St";
overlay_lb.set_sel_rgb( 255, 255, 255 );
overlay_lb.set_selbg_rgb( 0, 0, 0 );
overlay_lb.selbg_alpha = 0;

local overlayMenuTitle = overlayMenuSur.add_text("",0,80,660,35);
overlayMenuTitle.charsize=50;
overlayMenuTitle.font="Ledsitex St";
overlayMenuTitle.set_rgb(255,165,0);


fe.add_transition_callback( "orbit_transition" );

function orbit_transition( ttype, var, ttime )

{
switch ( ttype )
{

  case Transition.ShowOverlay:
overlaySurface.visible = true;
if ( ttime < 255 )
{
overlaySurface.alpha = ttime;
return true;
}
else
{
overlaySurface.alpha = 255;
}
break;

case Transition.HideOverlay:
if ( ttime < 255 )
{
overlaySurface.alpha = 255 - ttime;
return true;
}
else
{
local old_alpha;
old_alpha = overlaySurface.alpha;
overlaySurface.alpha = 0;

if ( old_alpha != 0 )
return true;
}
overlaySurface.visible = false;
break;

}
return false;
}

// tell Attractmode we are using a custom overlay menu
fe.overlay.set_custom_controls( overlayMenuTitle, overlay_lb );

zpaolo11x

  • Hero Member
  • *****
  • Posts: 1245
    • View Profile
    • My deviantart page
Re: Change the message when adding a game to Favorites.
« Reply #9 on: May 04, 2020, 12:57:13 AM »
I tried to make changes based on your information but unfortunately it didn't work.

I took a look at your code, the menu works fine but in my test it shows "behind" the usual UI of Attract Mode (the plain list with the snap background). I don't know why it happens, probably because your layout doesn't have any element besides that layout surface.

By the way if you change your case like this, adding just that single line:

Code: [Select]
case Transition.ShowOverlay:
overlaySurface.visible = true;
      if (var == Overlay.Favourite) overlayMenuTitle.msg = "CUSTOM MESSAGE"
if ( ttime < 255 )
{
overlaySurface.alpha = ttime;
return true;
}
else
{
overlaySurface.alpha = 255;
}
break;

you can have the custom message when add favourite is shown

Wenzon

  • Full Member
  • ***
  • Posts: 59
    • View Profile
Re: Change the message when adding a game to Favorites. [resolved]
« Reply #10 on: May 04, 2020, 03:16:01 AM »
I tried to make changes based on your information but unfortunately it didn't work.

I took a look at your code, the menu works fine but in my test it shows "behind" the usual UI of Attract Mode (the plain list with the snap background). I don't know why it happens, probably because your layout doesn't have any element besides that layout surface.

By the way if you change your case like this, adding just that single line:

Code: [Select]
case Transition.ShowOverlay:
overlaySurface.visible = true;
      if (var == Overlay.Favourite) overlayMenuTitle.msg = "CUSTOM MESSAGE"
if ( ttime < 255 )
{
overlaySurface.alpha = ttime;
return true;
}
else
{
overlaySurface.alpha = 255;
}
break;

you can have the custom message when add favourite is shown


Thank you!!! It worked perfectly zpaolo11x:D
I thank you and progets for taking the time to try to solve this problem. In both cases, the code works perfectly.