Zelda: Book of Mudora

Started by wizard_wizzle (aka ZeldaHistorian), August 08, 2014, 01:53:58 AM

Previous topic - Next topic
Quote from: MetalZelda on April 11, 2017, 03:07:47 PM
First we need to fix the spacing issue that occurs when giving the text a different color in the textbox script

I agree, but I have no idea of how that could be fixed now.
(Probably the new functions "drawable:get_pixels()" of Solarus 1.6 will allow us to find a solution to get the correct number of spaces needed. But until then, no idea.)
"If you make people think they're thinking, they'll love you. But if you really make them think, they'll hate you."

Can you tell me again what was wrong and why detecting two-byte characters did not work?

I switched to a monospace font with the new version. I haven't encountered any more spacing issues with the English version.

-Link of the issue in github:
https://github.com/MetalES/Project-Zelda/issues/46

(Note that I have not worked directly on the code to solve this problem.)

Summary of what we already know: our current scripts only work correctly for monospaced fonts with no multi-byte characters (accents and other characters, like Japanese characters, are giving problems since their lenght is not gotten correctly with Lua functions like "string:lenght()", etc).

-Christopho suggested to use "text_surface:get_size()". I didn't understand what he meant at that moment, but now I think I understand what he meant, and his idea is probably the solution that may solve this problem. Of course, part of the code has to be rewritten in a different manner. At first I thought that the size of a text surface was something fixed, like a bounding box, but that's not true, since the API says: "The size is determined by the text and the font".

I think we have two possibilities:

1) One solution should be to get the position and size of the last text surface to obtain the position of the new text surface to be created (when we make a color change).

2) Another solution is to get the size of the text surface and use it to compute the number of spaces that we need to add in the other overlapping surfaces.

Remark: The second solution may be slightly simpler, maybe, but for that one we need to know before the size of a space character, which may depend on the font and size. An easy way to get this is to compute it once (maybe when the script is started), which can be done in this way: create a text surface, write a space, get the size, and then destroy the surface.

@MetalZelda: if you have time these days, could you try some of these two solutions to test if this solves the problem?
"If you make people think they're thinking, they'll love you. But if you really make them think, they'll hate you."

3) Just use a monospaced font and detect characters that use two bytes.

In my Cythera project I was able to colorize words that the player can click on to advance the dialog with no problems, and I was using a ttf font that was not monospaced. My dialog script is pretty complicated, but it probably wouldn't be too hard to extract just the part where I colorized the text.

My method was to write all the text to text surfaces, one text surface per line of text. I kept track of the starting and ending position of each word to colorize using text_surface:get_text(), querying it as I added each word to the text_surface. Then I had one regular surface to draw the text on, and moving left to right for each text_surface I redrew the text_surface onto the surface up until the point where the color changed, then changed the color of the text_surface and redrew the next text onto the main surface until the next color change, etc.

I think llamazing's solution is solution "1)". It has the advantage of working with non-monospaced fonts.
"If you make people think they're thinking, they'll love you. But if you really make them think, they'll hate you."

We should probably make a new version of the script using that technic (which works with any type of font and size, including non-monospaced fonts), and make it "official".

Another question is: should we use the same syntax as the "official" one to change colors or maybe use a different one? The syntax I used was ${surface_name} to change surface, and $[color_name] or $[(r, g, b)] to change color of the current surface; the initial surface has "default" as name. We could use instead a syntax more similar to LaTeX if you prefer, with another $ at the end of each command, etc.

This is probably a bad place of the forum to discuss about this.
"If you make people think they're thinking, they'll love you. But if you really make them think, they'll hate you."

Haha, yeah, we could start a new topic to discuss in more depth. I stuck with the $[color_name] syntax and defined any of the colors I used in the scripts. I preferred this method because then all of my colors and tags were consistent and I didn't have to remember RGB values. Adding another $ just seems unnecessary to me, and it's more to parse out in the script.

Maybe we can continue in this old topic where this discussion began:
http://forum.solarus-games.org/index.php/topic,312.msg1201.html#msg1201
"If you make people think they're thinking, they'll love you. But if you really make them think, they'll hate you."

July 03, 2017, 05:54:56 PM #145 Last Edit: July 04, 2017, 07:33:18 PM by joptimus
Hi guys,

first thanks for making this great game, it's a lot of fun!

I'm a bit stuck on a side quest though - the bottle thief in Kakariko village. I got the bottle, but when I talk to the shop keeper, nothing happens. The quest is still active, but there is no description. What do I do?

Edit:
Also about the trading sequence:
I have the odd potion but cannot find a Deku to give it to...? There are only two in the forest and they only talk about the library.

Edit 2:
I think I've found a bug:
In the dungeon below Lake Hylia I cannot open the third locked door. Basically I opened the locked doors in the wrong sequence and now the required key is behind the last locked door. That should not happen since the player cannot know the correct order before.

Thank you - glad you're enjoying it!

For the bottle side quest, was there an error.txt file generated? Also, could you send me your save file? This shouldn't have an effect on the game in general - if you were able to get the bottle, that's the only purpose this side quest serves.

As far as the trading sequence - there is more than one forest :) PM me if you want the spoiler version.

Concerning the Lakebed Lair temple, you should be able to get to the boss and beat the temple still, right? If that's the case then do so, and if you re-enter the dungeon an NPC will give you the extra key.

July 05, 2017, 07:09:08 AM #147 Last Edit: July 05, 2017, 04:35:25 PM by joptimus
Quote from: wrightmat on July 05, 2017, 01:37:52 AM
Thank you - glad you're enjoying it!

For the bottle side quest, was there an error.txt file generated? Also, could you send me your save file? This shouldn't have an effect on the game in general - if you were able to get the bottle, that's the only purpose this side quest serves.

As far as the trading sequence - there is more than one forest :) PM me if you want the spoiler version.

Concerning the Lakebed Lair temple, you should be able to get to the boss and beat the temple still, right? If that's the case then do so, and if you re-enter the dungeon an NPC will give you the extra key.

Thanks for the fast reply!


  • I don't see an error.txt file (I'm on Mac, though). What file do I need to send? Generally speaking: What about the quests with three dots as a quest symbol - for instance the master ore quest. That, too, seems to be active, but I have the upgraded sword already. Is there more than one upgrade and the quest continues?
  • I'll figure it out myself :D
  • Never mind, the NPC was there.

Is there a walkthrough of some kind? I'm a bit stuck after beating the 7 dungeons and now I'm in the northern continent without a map and don't know what to do...

If you have two rows of hearts already, which I am assumin you do, ther is a villager in the southeast corner of the southern continent who will give a map to you. If you need more help, just ask.

Quote from: Ezka on July 05, 2017, 05:31:10 PM
If you have two rows of hearts already, which I am assumin you do, ther is a villager in the southeast corner of the southern continent who will give a map to you. If you need more help, just ask.

Thanks, that worked. Now I have the map, Zelda was kidnapped but I cannot find the last dungeon. Perhaps it has to do something with the graveyard in Northern Hyrule?

Also I still didn't find the forest where to give the odd potion to some Deku...maybe some hint please?