| View previous topic :: View next topic |
| Author |
Message |
exohaxor Expert Cheater
Reputation: 1
Joined: 02 Sep 2018 Posts: 101
|
Posted: Wed Jan 15, 2020 7:05 am Post subject: different text colors in one memo or caption |
|
|
i want to make rainbow text but like every letter different color can i do that?
_________________
hi |
|
| Back to top |
|
 |
Dark Byte Site Admin
Reputation: 471
Joined: 09 May 2003 Posts: 25833 Location: The netherlands
|
Posted: Wed Jan 15, 2020 8:42 am Post subject: |
|
|
here's an example you can look at (CE 7.0)
| Code: |
function buildrandomcolorstringRGB(s)
local i=1
local r=''
for p,cnr in utf8.codes(s) do
local c=utf8.char(cnr)
local red=math.random(0,255)
local green=math.random(0,255)
local blue=math.random(0,255)
c=string.char(27)..'[38;2;'..red..';'..green..';'..blue..'m'..c
r=r..c
end
return r
end
function buildrandomcolorstring16(s)
local i
local r=''
for p,cnr in utf8.codes(s) do
local c=utf8.char(cnr)
if math.random(1,2)==1 then
c=string.char(27)..'['..math.random(90,97)..'m'..c
else
c=string.char(27)..'['..math.random(30,37)..'m'..c
end
r=r..c
end
return r
end
f=createForm()
pb=createPaintBox(f)
pb.Canvas.Font.Size=20
pb.Align='alClient'
t=createTimer(f)
t.Interval=250
t.Enabled=true
t.OnTimer=function(t)
local rect={}
rect.Left=0
rect.Top=0
rect.Right=pb.Width
rect.Bottom=pb.Height
-- local s=buildrandomcolorstring16('Hello')
local s=buildrandomcolorstringRGB('Hello')
pb.Canvas.clear()
pb.Canvas.textRect(rect,0,0,s)
end
|
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping
Last edited by Dark Byte on Fri Jan 17, 2020 2:45 pm; edited 2 times in total |
|
| Back to top |
|
 |
AylinCE Grandmaster Cheater Supreme
Reputation: 37
Joined: 16 Feb 2017 Posts: 1533
|
|
| Back to top |
|
 |
mgr.inz.Player I post too much
Reputation: 222
Joined: 07 Nov 2008 Posts: 4438 Location: W kraju nad Wisla. UTC+01:00
|
Posted: Wed Jan 15, 2020 3:49 pm Post subject: |
|
|
Interesting. I see my STARS do not render properly in recent CE
_________________
|
|
| Back to top |
|
 |
AylinCE Grandmaster Cheater Supreme
Reputation: 37
Joined: 16 Feb 2017 Posts: 1533
|
Posted: Thu Jan 16, 2020 1:00 am Post subject: |
|
|
| mgr.inz.Player wrote: | Interesting. I see my STARS do not render properly in recent CE
 |
Nice work. I tried it first, and when I saw it working, I shared the link.
Please consider processing this work in the "Lua Extensions" section.
It's sad and embarrassing to open the code without permission.
| Code: | math.randomseed( tonumber(tostring(os.time()):reverse():sub(1,6)))
form_onClose(UDF1,function ()
if animateTimer~=nil then
object_destroy(animateTimer)
animateTimer = nil
end
form_hide(UDF1)
closeCE()
return caFree
end)
function ClickedExitButton(x,y)
if (x>188 and x<267) and (y>233 and y<253)
then return true
else return false
end
end
...
... |
Thank you for your coding that makes a difference.
_________________
|
|
| Back to top |
|
 |
.lua Expert Cheater
Reputation: 1
Joined: 13 Sep 2018 Posts: 203
|
Posted: Fri Jan 17, 2020 12:03 am Post subject: |
|
|
| Dark Byte wrote: | | here's an example you can look at (CE 7.0 | I want to use wide characters, but it's ignored, | Code: | | local s=buildrandomcolorstringRGB('【Hello】-【Word】') | Wide characters are also ignored in d3dhook | Code: | | d3dhook_initializeHook() |
|
|
| Back to top |
|
 |
Dark Byte Site Admin
Reputation: 471
Joined: 09 May 2003 Posts: 25833 Location: The netherlands
|
Posted: Fri Jan 17, 2020 12:37 am Post subject: |
|
|
textRect should support mulibyte characters, so the problem is in buildrandomcolorstringRGB
perhaps the lua utf8 table can be used here
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
| Back to top |
|
 |
Dark Byte Site Admin
Reputation: 471
Joined: 09 May 2003 Posts: 25833 Location: The netherlands
|
Posted: Fri Jan 17, 2020 2:45 pm Post subject: |
|
|
I've updated the lua code above so it now supports UTF8
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
| Back to top |
|
 |
.lua Expert Cheater
Reputation: 1
Joined: 13 Sep 2018 Posts: 203
|
Posted: Fri Jan 17, 2020 11:07 pm Post subject: |
|
|
| Dark Byte wrote: | | I've updated the lua code above so it now supports UTF8 | I've tested it. I can show wide characters.
How to use wide characters in the game screen?
| Code: | d3dhook_initializeHook()
if font and fontmap and TextObject then
font.destroy()
fontmap.destroy()
TextObject.destroy()
end
font = createFont()
font.size = 30
font.color=0xff00
fontmap=d3dhook_createFontmap(font)
txt = '【Test】'
TextObject=d3dhook_createTextContainer(fontmap,200,300,txt) |
|
|
| Back to top |
|
 |
Dark Byte Site Admin
Reputation: 471
Joined: 09 May 2003 Posts: 25833 Location: The netherlands
|
Posted: Sat Jan 18, 2020 2:47 am Post subject: |
|
|
draw it to a bitmap or png and then show it as a Sprite
fontmaps won't work as they only generate characters for chars 32 to 255
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
| Back to top |
|
 |
.lua Expert Cheater
Reputation: 1
Joined: 13 Sep 2018 Posts: 203
|
Posted: Sat Jan 18, 2020 4:01 am Post subject: |
|
|
| Dark Byte wrote: | draw it to a bitmap or png and then show it as a Sprite
fontmaps won't work as they only generate characters for chars 32 to 255 | I've tried to create it as a sprite, but the bitmap or PNG is not a transparent background
|
|
| Back to top |
|
 |
Dark Byte Site Admin
Reputation: 471
Joined: 09 May 2003 Posts: 25833 Location: The netherlands
|
Posted: Sat Jan 18, 2020 4:31 am Post subject: |
|
|
use createTexture(picture, coloroftransparentbackground)
then set coloroftransparentbackground to a specific color you want as see through
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
| Back to top |
|
 |
.lua Expert Cheater
Reputation: 1
Joined: 13 Sep 2018 Posts: 203
|
Posted: Sat Jan 18, 2020 4:35 am Post subject: |
|
|
| Dark Byte wrote: |
then set coloroftransparentbackground to a specific color you want as see through | I want it to look colorless, like an internal image
I set to display wide characters and transparent codes as follows | Code: | | createTexture(picture,nil) |
|
|
| Back to top |
|
 |
Dark Byte Site Admin
Reputation: 471
Joined: 09 May 2003 Posts: 25833 Location: The netherlands
|
Posted: Sat Jan 18, 2020 6:01 am Post subject: |
|
|
if the background is white with colored text then do createTexture(picture,0xffffff) so only the text remains
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
| Back to top |
|
 |
.lua Expert Cheater
Reputation: 1
Joined: 13 Sep 2018 Posts: 203
|
Posted: Sat Jan 18, 2020 7:24 am Post subject: |
|
|
| Without a timer, when the form is minimized and restored, the color text will disappear. What should I do
|
|
| Back to top |
|
 |
|