Stormworks: Build and Rescue

Stormworks: Build and Rescue

71 vurderinger
Compact Resizable Rotatable Custom Font
   
Pris
Føj til foretrukne
Gjort til foretrukken
Fjern som foretrukken
Filstørrelse:
Offentliggjort:
Opdateret:
249.220 KB
11. aug. 2021 kl. 14:58
11. aug. 2021 kl. 15:35
2 ændringsbemærkninger ( vis )

Abonner for at downloade
Compact Resizable Rotatable Custom Font

Beskrivelse
Compact Resizable Rotatable Custom Font
Compact LUA script to draw smaller (3x5 instead of 4x5), resizable, rotatable text.

Don't forget to like if you do :)



The script itself use 628/4096 char and need 2 property text box.

How to use
  1. Copy-Past the 2 property box in your MC.
  2. Copy-Pas everything below "Needed function below".
  3. Call the script with
    dst(x,y,text,size=1,rotation=1,is_monospace=false)
    x,y -> Display coordinates
    text -> Text to draw. (Non supported character will not be drawned.)
    size -> (optional) The font size or size of each pixel. (A size of 2 mean that each character will be 6x10)
    rotation -> (optional) 1-4 for UP RIGHT DOWN LEFT.
    is_monospace -> (optional) If true each character will have the same size.

Notes
  • You can create your own font by saving each character pixel in an hexadecimal code (4 symbol per character with the last bit (when converted to binary) telling if the character is only 1 pixel wide)
Populære diskussioner Vis alle (1)
1
21. okt. 2021 kl. 7:48
Other Fonts
puipuix
23 kommentarer
RedPug 26. aug. 2024 kl. 16:23 
fixed with the following change:

if FONT_D[ci]&p==p then
xx,yy=((i-1)%3)*s-((r>2 and FONT_D[ci]&1==1)and s*2 or 0),((i-1)//3)*s
if r%2==1 then
drf(x+xx,y+yy,s,s)
else
drf(x+5-yy,y+xx,s,s)
end
end

added "-((r>2 and FONT_D[ci]&1==1)and s*2 or 0)" to the xx term on line 2 of this portion of code.
RedPug 26. aug. 2024 kl. 14:46 
it appears that the 1-wide characters are being rendered inside the previous character.
RedPug 26. aug. 2024 kl. 14:36 
For whatever reason, one-wide characters (such as .,!) don't render with rotated to down or left. Everything else seems to be fine.
AVUMP 12. aug. 2024 kl. 8:06 
how do get numbers from outside input? I`m put R=getnumber(1) after functionTick and "text" change to R. It is'n work.
D_Bones 17. juli 2024 kl. 12:38 
Damn, exactly what I was looking for! A pure gem... Thank you for sharing :)
BobGrey 9. jan. 2024 kl. 20:16 
Nevermind. You need to add it in via tostring(variable).

For example, speed is being read through channel 4 to variable S, so in function onTick() I have S = input.getNumber(4) and in function onDraw () I have dst(x,y,tostring(S),size==1,rotation==1,is_monospace==false)
BobGrey 9. jan. 2024 kl. 20:08 
How to use variables? I want to use this for a speedometer, but when I enter the variable in for text, it says "25: Attempt to index a number value (local 'T')"
Xerxes 7. maj 2023 kl. 1:15 
you sir are a god
Shillelagh 11. feb. 2023 kl. 14:48 
You need to cast it to a string.
It also sounds like the error is on you, the error you described is a mix between two different ones. You either have t() if it's trying to call or t[] if you're trying to index.
Galactian 11. feb. 2023 kl. 12:31 
why would you spend so much time on this and not even let the value change