Stormworks: Build and Rescue

Stormworks: Build and Rescue

71 个评价
Compact Resizable Rotatable Custom Font
   
奖励
收藏
已收藏
取消收藏
文件大小
发表于
更新日期
249.220 KB
2021 年 8 月 11 日 下午 2:58
2021 年 8 月 11 日 下午 3:35
2 项改动说明 ( 查看 )

订阅以下载
Compact Resizable Rotatable Custom Font

描述
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)
热门讨论 查看全部(1)
1
2021 年 10 月 21 日 上午 7:48
Other Fonts
puipuix
23 条留言
RedPug 2024 年 8 月 26 日 下午 4: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 2024 年 8 月 26 日 下午 2:46 
it appears that the 1-wide characters are being rendered inside the previous character.
RedPug 2024 年 8 月 26 日 下午 2: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 2024 年 8 月 12 日 上午 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 2024 年 7 月 17 日 下午 12:38 
Damn, exactly what I was looking for! A pure gem... Thank you for sharing :)
BobGrey 2024 年 1 月 9 日 下午 8: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 2024 年 1 月 9 日 下午 8: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 2023 年 5 月 7 日 上午 1:15 
you sir are a god
Shillelagh 2023 年 2 月 11 日 下午 2: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 2023 年 2 月 11 日 下午 12:31 
why would you spend so much time on this and not even let the value change