• SimpleText / SimpleTextOutlined. - Problem? ---> G:MOD 13.
    5 replies, posted
Hey guys. I just got my fonts working for G:MOD 13. But now I have another problem. I get this error in console: [CODE][lua/includes/modules/draw.lua:75] attempt to perform arithmetic on local 'w' (a nil value) 1. lua/includes/modules/draw.lua:75 (SimpleText) 2. lua/includes/modules/draw.lua:121 (SimpleTextOutlined) 3. gamemode/vgui/load.lua:112 <unknown>[/CODE] This is the line it says have an error: [CODE]draw.SimpleTextOutlined(math.Clamp(math.Round(percDone * 100), 0, 100) .. "%", "HUDFont", ScrW() * .5, ScrH() * .5, Color(0, 0, 0, 255), 1, 1, 1, Color(255, 255, 255, 255));[/CODE] And if I look in "draw.lua" at line 75. It tells my this: [CODE]x = x - w/2[/CODE] And in "draw.lua" on line 121: [CODE]SimpleText(text, font, x + (_x), y + (_y), outlinecolour, xalign, yalign)[/CODE] I got no idea what could cause this problem? Anyone know how to fix this?
I had this problem yesterday when porting a gamemode over to GMod 13. You're using a non-existant font. Either make sure that the font is made using font.Create, or make sure that the font actually exists in GMod already. Keep in mind that a lot of fonts have been removed in GMod 13.
[QUOTE=Jocken300;37924481]I had this problem yesterday when porting a gamemode over to GMod 13. You're using a non-existant font. Either make sure that the font is made using font.Create, or make sure that the font actually exists in GMod already. Keep in mind that a lot of fonts have been removed in GMod 13.[/QUOTE] Okay this is what I got: [CODE]surface.CreateFont( "HintFont", { font = "Tahoma", size = ScreenScale(8), weight = 1000, antialias = true, shadow = false })[/CODE] Do I just do "Font.Create" instead of "CreateFont". I have the font in my content under "resource"?
You must not be creating the font properly, or not at all. By the way, Garry's Mod is a whole, it's not 'G:Mod'.
I've had the same problem too, and it only happens when you have both an x-align/y-align and an invalid font. I think it has to do with surface.GetTextSize() giving an error when an invalid font is put in (i.e. something I should create a bug report for but I'm too lazy to :v:)
It's fixed now. Thanks all. :)
Sorry, you need to Log In to post a reply to this thread.