Puma Posted June 20, 2012 Posted June 20, 2012 My script gets the text from a .txt file (using fileOpen, fileRead). The text: http://pastebin.com/Q1Z33af6 I put some colorcodes in it and since the colorcoded-bool in dxDrawText only works from 1.3.1 on (and as far as I know, 1.3.1 isn't released yet), I used Aibo's dxDrawColorText-function https://wiki.multitheftauto.com/wiki/DxDrawColorText Ingame, it looks like this: Without using dxDrawColorText, just dxDrawText, it looks like this (and this is how it should look): Anyone who got an explanation and/or solution for this problem? "The total IQ of the world is a constant. The more people, the more idiots." - Anonymous.
TwiX! Posted June 20, 2012 Posted June 20, 2012 function dxDrawColorText(str, ax, ay, bx, by, color, scale, font,alignX,alignY,clip, wordBreak, postGUI) if not str then return false end str = " "..str ax= ax - dxGetTextWidth(" ", scale, font) local pat = "(.-)#(%x%x%x%x%x%x)" local s, e, cap, col = str:find(pat, 1) local last = 1 while s do if s ~= 1 or cap ~= "" then local w = dxGetTextWidth(cap, scale, font) dxDrawText(cap, ax, ay, ax + w, by, color, scale, font,alignX,alignY,clip, wordBreak, postGUI) ax = ax + w color = tocolor(tonumber("0x"..string.sub(col, 1, 2)), tonumber("0x"..string.sub(col, 3, 4)), tonumber("0x"..string.sub(col, 5, 6)), 255) end last = e+1 s, e, cap, col = str:find(pat, last) end if last <= #str then cap = str:sub(last) local w = dxGetTextWidth(cap, scale, font) dxDrawText(cap, ax, ay, ax + w, by, color, scale, font,alignX,alignY,clip, wordBreak, postGUI) end end you need edit dxDrawColorText - Working on [php/HTML/Mysql/Lua/Java Scripts/Web Design/3D Modeling]
Puma Posted June 20, 2012 Author Posted June 20, 2012 Your version didn't work either. "The total IQ of the world is a constant. The more people, the more idiots." - Anonymous.
UAEpro Posted June 21, 2012 Posted June 21, 2012 "/n" is not working with dxDrawColorText or more than 1 line things تيم سبيك بروجيمر ts3server://ts.pg.sa
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now