Stormworks: Build and Rescue

Stormworks: Build and Rescue

64 ratings
Compact Resizable Rotatable Custom Font
   
Award
Favorite
Favorited
Unfavorite
File Size
Posted
Updated
249.220 KB
Aug 11, 2021 @ 2:58pm
Aug 11, 2021 @ 3:35pm
2 Change Notes ( view )

Subscribe to download
Compact Resizable Rotatable Custom Font

Description
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)
Popular Discussions View All (1)
1
Oct 21, 2021 @ 7:48am
Other Fonts
puipuix
23 Comments
RedPug Aug 26 @ 4:23pm 
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 Aug 26 @ 2:46pm 
it appears that the 1-wide characters are being rendered inside the previous character.
RedPug Aug 26 @ 2:36pm 
For whatever reason, one-wide characters (such as .,!) don't render with rotated to down or left. Everything else seems to be fine.
AVUMP Aug 12 @ 8:06am 
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 Jul 17 @ 12:38pm 
Damn, exactly what I was looking for! A pure gem... Thank you for sharing :)
BobGrey Jan 9 @ 8:16pm 
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 Jan 9 @ 8:08pm 
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 May 7, 2023 @ 1:15am 
you sir are a god
Shillelagh Feb 11, 2023 @ 2:48pm 
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 Feb 11, 2023 @ 12:31pm 
why would you spend so much time on this and not even let the value change