Char input sneak peek

Started by Zefk, October 07, 2016, 04:16:13 AM

Previous topic - Next topic
October 18, 2016, 10:33:52 PM #15 Last Edit: October 19, 2016, 12:56:44 AM by Zefk
Quote from: MetalZelda on October 18, 2016, 08:43:45 PM
What's weird in your last post is that the box is drawn bellow entities, otherwize there is nothing more to say except it's a nice feature

@MetalZelda
I grabbed the black tile and made the black box for the gif. The purple text would be hard to see and I did not want to make a black image.

QuoteIt is good to see that you have progressed a lot with this script. Your work looks promising and may be useful to other people.

@Diarandor
It was very tricky for the first 10 minutes with this script, but due to that I can add more features.  Without "string.reverse" the text would be backwards and I can make the text look like a slash or a diagonal line. These features might be useful for some puzzles or looped animation and were done by accident.

EX:
zefk
kfez

z
  e
    f
     k
       i
        s
          g
            r
             a
               n
                 d

This could be made to pass values too, but that is a bit tricky to make. I would probably use this char  ``````. That would be for 6 places. 999,999. I would probably do that if I make this into a dialog box.

Quote from: MetalZelda on October 18, 2016, 08:43:45 PM
One thing the moderator should do is, add a new subforum where there would be only scripts for Solarus

Actually it already exists: isn't it the Development subforum ?  :)

October 19, 2016, 12:55:40 AM #17 Last Edit: October 19, 2016, 01:10:21 AM by Zefk
I added the diagonal line, reverse text feature, and a third line. The gif proves that special characters can be used too. !#@

I mentioned this before, but any images can be used.

EX:
Apple.png can appear for the 'a' and/or orange.png can appear for 'o'. Names will have to be changes in the script or a.png can be an apple image.



Quote from: Neovyse on October 19, 2016, 12:53:50 AM
Quote from: MetalZelda on October 18, 2016, 08:43:45 PM
One thing the moderator should do is, add a new subforum where there would be only scripts for Solarus

Actually it already exists: isn't it the Development subforum ?  :)

@Neovyse
I believe the description of the Development subforum is examples of scripts, help questions, tips, etc. It is not a place for "only" working scripts submissions for Solarus v1.x.x, but I honestly do not mind either way. I post my scripts here when finished.

As this is a scripting development 'project.' I am just getting feedback here until the script is good enough to release. I will actually release it in one script and 3 separate scripts because maybe they only want to use one part of the naming process (Nameplate, input text, and picking names.) or so they can make it compatible with their project.

All that is left for me to do is add cancel, add comments/clean up, and package this project.

Quote from: Neovyse on October 19, 2016, 12:53:50 AM
Quote from: MetalZelda on October 18, 2016, 08:43:45 PM
One thing the moderator should do is, add a new subforum where there would be only scripts for Solarus

Actually it already exists: isn't it the Development subforum ?  :)

Yes but the development subforum is mostly about the API scripts, there is user-made scripts, but they are a bit dispatched over the whole subforum, between some help threads.
A "script" subforum should be better, as it would contain scripts for solarus, and only scripts.
Plus, it could be useful to add in the "help" section of the Quest Editor a "Script" box which will redirect to this subforum

I don't know what do you think


I agree we should maybe create sort of a "library" of user scripts, now that Solarus have more users!

Ok I just created a new forum section "Your scripts".


I haven't seen your script, but you should avoid using string.reverse() for text displayed on-screen because it is not compatible with multi-byte utf-8 strings (used in non-english text). If you really need to reverse a string, I guess you could write a custom reverse function that is utf-8 friendly.

I think I can do it without string.reverse().

Code ( lua) Select
local test = "test"
local test_split = {}

for char in string.gmatch(test, "%w") do
  table.insert(test_split, char)
end


It does the opposite of my previous code. (Which is normal order.) I use reverse to make the text not reversed because they are reverse to begin with. Not sure if it makes a difference, but any alphabetical character can refer to any png image font character.

I decided to extend this script a little further. I will be adding a sol.text_surface.create option. That is for people that want to use font packages. It will actually be very little change in the scripts.