Chapter splitting screen

Started by Chomba, Fri 07/05/2021 22:22:36

Previous topic - Next topic

Chomba

Hello again!

I'm having trouble making an interlude with a Monkey Island style chapter split screen.

(like this)


I could do it without problems with an image and that's it, but I want the text not to be pre-rendered so I can change it later according to the translations that the game has.

For now I'm using "Display" as placeholder. But I can't figure out the right way to do it.

I tried to do it with text overlay, as shown in the following video, but it didn't work:



Maybe the question is a bit silly, but I couldn't find the way to solve it neither looking in the manual, nor in the forum (maybe because I don't know how I should look for it either)

Snarky

Quote from: Chomba on Fri 07/05/2021 22:22:36
I tried to do it with text overlay, as shown in the following video, but it didn't work

If you're asking for help, don't just say "it didn't work." Tell us what you did, what happened, and what you wanted/expected to happen. (If you think about it, I'm sure you'll realize why.)

Anyway, in this case, a text overlay is probably not the best approach. I would suggest creating a full-screen GUI with a text label (or, in the MI example given, two labels). Then you simply set the text on the label to what you want, and display the GUI.

Khris

The manual entry for  Overlay.CreateTextual  has this example code:

Code: ags
  Overlay* myOverlay = Overlay.CreateTextual(50,80,120, Game.SpeechFont, 15,"This is a text overlay");
  Wait(40);
  myOverlay.Remove();


This will show the text for a second while blocking the game.

Like Snarky said, debugging code we can't see is kind of hard.

It should also be noted that it is pretty easy to display one of several sprites based on the current translation. You could even write code so you can state the sprite slot as text  "123"  and "translate" the number right in the translation file.

Chomba

QuoteIf you're asking for help, don't just say "it didn't work." Tell us what you did, what happened, and what you wanted/expected to happen. (If you think about it, I'm sure you'll realize why.)

You're right, except for the part where I realize why it didn't work  :-D
I did exactly the same as shown in the video, but nothing happened in the room when playing, just a black screen (had no background).

QuoteAnyway, in this case, a text overlay is probably not the best approach. I would suggest creating a full-screen GUI with a text label (or, in the MI example given, two labels). Then you simply set the text on the label to what you want, and display the GUI.

Yes! this was the approach I tried to do at first, but I didn't know how to call the gui in the room or make it visible only there (I made an exclusive room for the screen, I don't know if it's necessary - probably not - but it helps the organization).

Chomba

QuoteLike Snarky said, debugging code we can't see is kind of hard.
I understand that. Unfortunately, as I was trying for a long time and in the end I was tyred and left with the transitional solution of using "Display", I got rid of the code I had written before. That's why I can't put it here to be analyzed and just try to illustrate with words what I tried to do

Quotet should also be noted that it is pretty easy to display one of several sprites based on the current translation. You could even write code so you can state the sprite slot as text  "123"  and "translate" the number right in the translation file.
That's good to know. I have no idea, I'm new to this and don't have a programming background.
I still haven't been able to learn how the whole translation thing works and what can and can't be done, but I've internalized enough on the subject to know that some things are better to keep in mind from the early stages.

QuoteThe manual entry for  Overlay.CreateTextual  has this example code:
thanks, I was looking for hours and couldn't find it (or just didn't see it). Although I think the solution Snarky said would be the best for this situation (or what you said about the sprites, but for now it's easier for me to do it the other way - although it's very interesting how can I look that up in the manual?).

The only part i´m missing now is how to make visible the gui when i want to (or call it)

PD: English is not my mother tongue, so sometimes I have a hard time finding the way to look up some things in the manual, many times I find that I should have looked it up with a variation of words to say the same thing I was trying to put in  :P

Crimson Wizard

Quote from: Chomba on Fri 07/05/2021 22:58:19
The only part i´m missing now is how to make visible the gui when i want to (or call it)

GuiName.Visible = true; // turn on
GuiName.Visible = false; // turn off

I really recommend reading a list of available functions for every object that you use, just to be aware what functionality do they have:
https://adventuregamestudio.github.io/ags-manual/GUI.html
you may see the list of functions and properties in the leftmost column on that page.

Quote from: Chomba on Fri 07/05/2021 22:43:42
I did exactly the same as shown in the video, but nothing happened in the room when playing, just a black screen (had no background).

Does your room have any background?
One possible reason room may not be displayed is if you place any blocking action inside "room load" event, as opposed to "room after fade-in" event.

Snarky

If you're having trouble finding stuff in the manual and you're using AGS 3.5, I recommend downgrading to version 3.4.3. The latest version breaks the navigation; in 3.4.3 (and all versions prior to 3.5.0) you can just scroll through the table of contents on the left and find what you're looking for quite easily.

Chomba

#7
Thanks to all for your answers and your time! Talking to you turn on some lightbulb and I could figure it out :D

thank you very much Crimson Wizard! that's what I needed. I saw it right after I discovered the solution  :-D

QuoteIf you're having trouble finding stuff in the manual and you're using AGS 3.5, I recommend downgrading to version 3.4.3. The latest version breaks the navigation; in 3.4.3 you can just scroll through the table of contents on the left and find what you're looking for quite easily

Yes, I'm using version 3.5.0, it's mostly a language barrier, I'm not trying to do anything too crazy, so for now I'm finding everything :). I'm going to keep it in mind.

QuoteI really recommend reading a list of available functions for every object that you use, just to be aware what functionality do they have:

I finally found the command I needed in the "Editing GUIs" section of the manual (I don't know how I was looking for it, but I hadn't seen it before).
https://adventuregamestudio.github.io/ags-manual/EditingGUIs.html?highlight=visible

I will put the solution in case someone needs it in the future:

To do something like this:



* 1
I made a new Gui with the text labels required.
Popup style: normal

* 2
I created a new room

* 3
This is the code i use

Code: ags


function room_AfterFadeIn()
{
//This is the music that souds during the screen
  aChapter_Screen.Play(eAudioPriorityLow, eOnce);
  
// This makes the Gui visible
       gCapituloI.Visible = true;

// I wanted to exit with a clean cut
    SetNextScreenTransition(eTransitionInstant);

// This is the during time of the song (i am using the one from MI as a placeholder)
    Wait(440);
    
// This turn the Gui Off
    gCapituloI.Visible = false;
    
// The character leaves the room
cRoger.ChangeRoom(3, 160, 159, eDirectionDown);
}


4*
At this moment, the gui appeared as soon as the game started. So I went to the global script and:

Code: ags

// main global script file

// called when the game starts, before the first room is loaded
function game_start()
{
// I ADDED THIS LINE
  gCapituloI.Visible = false;
  
  // register a GUI to use for the inventory bar
  TwoClickHandler.InventoryGUI = gInventoryBar;

  // register a Label to use for action text
  TwoClickHandler.ActionLabel = lblAction;

  // optionally set the popup distance for the inventory bar
  //TwoClickHandler.PopupProportional = 0.5;
  //TwoClickHandler.PopupDistance = 50;

  // optionally reverse the left and right mouse buttons
  //TwoClickHandler.ReversedClicks = true;
}


Now the Gui shows only when i enter that room :D

I´m shure there must be a neater solution, but at least this works :D!
Thanks to all of you!

PD: I'm not going to leave that screen like that, I'm going to beautify it later haha.

PD2:
QuoteIt should also be noted that it is pretty easy to display one of several sprites based on the current translation. You could even write code so you can state the sprite slot as text  "123"  and "translate" the number right in the translation file.

This is really intresting, can someone tell me how to look for it in the manual? or some orientation of where to find how it works?

Snarky

Quote from: Chomba on Sat 08/05/2021 00:51:33
This is really intresting, can someone tell me how to look for it in the manual? or some orientation of where to find how it works?

If you have no clue where in the manual to look, the right thing to do is to search for "translation."
One of the hits will be a page called "Translations," which should be the obvious place to start. You will find that it's a short article about how translations work, ending with a list of various related API functions and properties. That list is the important part, because those are the ways you can interact with translations in your script. Check out each of them to see what it does. It turns out that the one we want is Game.TranslationFileName. The entry for that function has a an example that shows you how to use it.

Chomba

QuoteIf you have no clue where in the manual to look, the right thing to do is to search for "translation."
One of the hits will be a page called "Translations," which should be the obvious place to start. You will find that it's a short article about how translations work, ending with a list of various related API functions and properties. That list is the important part, because those are the ways you can interact with translations in your script. Check out each of them to see what it does. It turns out that the one we want is Game.TranslationFileName. The entry for that function has a an example that shows you how to use it.

Great! Thank you. I will!

Khris

Regarding using "123", you'd do something like:

Code: ags
  String spriteSlot = "123";
  int slot = spriteSlot.AsInt;
  chapterOverlay = Overlay.CreateGraphical(50, 50, slot, true);


Now you can "translate" the sprite slot into another language, since "123" should appear in the translation source.

Snarky

That's clever, but since you have to update the project to add the sprite regardless (right?), wouldn't it be more transparent to branch directly in the code rather than via the translation file?

SMF spam blocked by CleanTalk