*FuN Posted February 16, 2012 Share Posted February 16, 2012 hi guys I have a issue .... I have a hunter top times , but this script dont show the coloured name , someone know how to fix that? Link to comment
*FuN Posted February 16, 2012 Author Share Posted February 16, 2012 (edited) http://pastebin.com/QZFAAcqa Edited February 16, 2012 by Guest Link to comment
denny199 Posted February 16, 2012 Share Posted February 16, 2012 please use [lua ] /lua] tags Link to comment
Castillo Posted February 16, 2012 Share Posted February 16, 2012 The code is too long to use the Lua tags, it'll just appear as blank. @Fun: Post your script on http://www.pastebin.com/ and post the link here instead of your script. Link to comment
Castillo Posted February 16, 2012 Share Posted February 16, 2012 GUI labels doesn't allow HEX colors. You'll have to find the function: guiCreateColorLabel or something similar around the forums and implement it in the script. Link to comment
*FuN Posted February 16, 2012 Author Share Posted February 16, 2012 GUI labels doesn't allow HEX colors.You'll have to find the function: guiCreateColorLabel or something similar around the forums and implement it in the script. public class ColorLabelField extends LabelField{ private int color = 0x000000; private int bg; public ColorLabelField(){ super(); } public ColorLabelField(Object text){ super(text); } public ColorLabelField(Object text, int offset, int length, long style){ super(text, offset, length, style); } public ColorLabelField(Object text, long style){ super(text, style); } public ColorLabelField(ResourceBundleFamily rb, int key){ super(rb, key); } public void setColor(int newColor){ color = newColor; } public void setBackgroundColor(int newBG){ bg=newBG; } public void paint(Graphics graphics){ graphics.setColor(color); graphics.setBackgroundColor(bg); super.paint(graphics); } } this ? Link to comment
Castillo Posted February 16, 2012 Share Posted February 16, 2012 WHAT?! that's not even Lua, I said around the forums not in Google viewtopic.php?f=91&t=40275&p=408868&hilit=guiCreateColorLabel#p408868 Link to comment
*FuN Posted February 16, 2012 Author Share Posted February 16, 2012 WHAT?! that's not even Lua, I said around the forums not in Google viewtopic.php?f=91&t=40275&p=408868&hilit=guiCreateColorLabel#p408868 Appears buttons . WTF??? I want only the coloured names on top times not buttons . Link to comment
Castillo Posted February 16, 2012 Share Posted February 16, 2012 I sometimes wonder if people is just stupid or blind. I even leaved the highlighting to the function, you just had to scroll down the code. function guiCreateColorLabel(ax, ay, bx, by,str, parent, bool) local pat = "(.-)#(%x%x%x%x%x%x)" local s, e, cap, col = str:find(pat, 1) local last = 1 local labels = {} while s do if cap == "" and col then r,g,b = tonumber("0x"..col:sub(1, 2)), tonumber("0x"..col:sub(3, 4)), tonumber("0x"..col:sub(5, 6)) end if (s ~= 1) or cap ~= "" then local w = dxGetTextWidth(cap) lbl = guiCreateLabel(ax, ay, ax + w, by,cap,parent, bool) table.insert(labels, lbl) if (r == nil) then r = 255 end if (g == nil) then g = 255 end if (b == nil) then b = 255 end guiLabelSetColor(lbl,r,g,b) ax = ax + w r,g,b = tonumber("0x"..col:sub(1, 2)), tonumber("0x"..col:sub(3, 4)), tonumber("0x"..col:sub(5, 6)) 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) lbl2 = guiCreateLabel(ax, ay, ax + w, by,cap,parent, bool) table.insert(labels, lbl2) guiLabelSetColor(lbl2,r,g,b) end return labels end Link to comment
*FuN Posted February 16, 2012 Author Share Posted February 16, 2012 Ok , srry about that , and thankz I have another problem : -When i do /redo appears that - : 'Current map has been restarted by #000000FuN#FFFFFF* And i want make to disapere the code of colour is possible ? Link to comment
Castillo Posted February 16, 2012 Share Posted February 16, 2012 race has a function which removes HEX colors, they shouldn't appear. Link to comment
*FuN Posted February 16, 2012 Author Share Posted February 16, 2012 race has a function which removes HEX colors, they shouldn't appear. thankz Edit: I sometimes wonder if people is just stupid or blind.I even leaved the highlighting to the function, you just had to scroll down the code. function guiCreateColorLabel(ax, ay, bx, by,str, parent, bool) local pat = "(.-)#(%x%x%x%x%x%x)" local s, e, cap, col = str:find(pat, 1) local last = 1 local labels = {} while s do if cap == "" and col then r,g,b = tonumber("0x"..col:sub(1, 2)), tonumber("0x"..col:sub(3, 4)), tonumber("0x"..col:sub(5, 6)) end if (s ~= 1) or cap ~= "" then local w = dxGetTextWidth(cap) lbl = guiCreateLabel(ax, ay, ax + w, by,cap,parent, bool) table.insert(labels, lbl) if (r == nil) then r = 255 end if (g == nil) then g = 255 end if (b == nil) then b = 255 end guiLabelSetColor(lbl,r,g,b) ax = ax + w r,g,b = tonumber("0x"..col:sub(1, 2)), tonumber("0x"..col:sub(3, 4)), tonumber("0x"..col:sub(5, 6)) 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) lbl2 = guiCreateLabel(ax, ay, ax + w, by,cap,parent, bool) table.insert(labels, lbl2) guiLabelSetColor(lbl2,r,g,b) end return labels end When I do a hunter time dont show the coloured names ! Link to comment
Castillo Posted February 16, 2012 Share Posted February 16, 2012 Have you implemented the function? if so, post your script in pastebin.com and post the link. Link to comment
*FuN Posted February 16, 2012 Author Share Posted February 16, 2012 http://pastebin.com/7kzG179B Link to comment
Castillo Posted February 16, 2012 Share Posted February 16, 2012 Oh, so you think by just copy and paste the function in your script it'll magically work? Seriously, go back to the wiki and start learning from the basics. Link to comment
*FuN Posted February 16, 2012 Author Share Posted February 16, 2012 Oh, so you think by just copy and paste the function in your script it'll magically work?Seriously, go back to the wiki and start learning from the basics. OMG , you cant tell me ?? Link to comment
Castillo Posted February 16, 2012 Share Posted February 16, 2012 You don't want me to tell you, you want me to make it for you. Is not that easy, you'll have to change many things, because guiCreateColorLabel returns a table of gui-labels, not just one. Link to comment
*FuN Posted February 16, 2012 Author Share Posted February 16, 2012 omg, if I asking to someone do it for me is because I'm noob on scripting -.- Link to comment
GTX Posted February 16, 2012 Share Posted February 16, 2012 Some scripters may make it for you, but you will have to pay. Link to comment
Castillo Posted February 16, 2012 Share Posted February 16, 2012 And you can stop being "noob" by learning, do you think I was born with my knowledge? no, I learned everything I know by myself, you can do the same. We're not helping you when we give the working script. Link to comment
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