Jump to content




How to make a word with two changing colors


  • You cannot reply to this topic
31 replies to this topic

#21 SuicidalSTDz

    Permutator of Strings

  • Members
  • 1,308 posts
  • LocationPennsylvania

Posted 12 April 2013 - 01:58 PM

View PostremiX, on 03 April 2013 - 01:03 AM, said:

Why not rainbow text!
I had recently made a program to do this in the programs section. Go check it out :) It can also be a substitution for this code as it can handle any amount of colours. Didn't realize you posted this, i've been very busy :P

#22 Popeye

  • Members
  • 46 posts

Posted 14 April 2013 - 09:35 AM

I have an Error: "Color:8: Colour not supported"

My Code:
[color=#000088]local[/color][color=#000000] word [/color][color=#666600]=[/color][color=#000000] [/color][color=#008800]"Insert your word here "[/color][color=#000000] [/color][color=#666600]--[/color][color=#660066]Leave[/color][color=#000000] one space so the cursor doesnt obscure the word
[/color][color=#000088]local[/color][color=#000000] firstCol [/color][color=#666600]=[/color][color=#000000] colours[/color][color=#666600].[/color][color=#000000]red
[/color][color=#000088]local[/color][color=#000000] secondCol [/color][color=#666600]=[/color][color=#000000] colours[/color][color=#666600].[/color][color=#000000]blue
[/color][color=#000088]
for[/color][color=#000000] len [/color][color=#666600]=[/color][color=#000000] [/color][color=#006666]1[/color][color=#666600],[/color][color=#880000]#word do[/color]
[color=#000000] [/color][color=#000088]if[/color][color=#000000] bit[/color][color=#666600].[/color][color=#000000]band[/color][color=#666600]([/color][color=#000000]len[/color][color=#666600],[/color][color=#006666]1[/color][color=#666600])[/color][color=#000000] [/color][color=#666600]==[/color][color=#000000] [/color][color=#006666]0[/color][color=#000000] [/color][color=#000088]then[/color][color=#000000] [/color][color=#666600]--[/color][color=#660066]This[/color][color=#000000] line will detect [/color][color=#000088]if[/color][color=#000000] the current [/color][color=#000088]char[/color][color=#000000] [/color][color=#000088]is[/color][color=#000000] on an odd [/color][color=#000088]or[/color][color=#000000] even column[/color][color=#666600].[/color][color=#000000] [/color][color=#660066]Odd[/color][color=#000000] will be red [/color][color=#000088]and[/color][color=#000000] [/color][color=#660066]Even[/color][color=#000000] will be blue [/color][color=#000088]in[/color][color=#000000] [/color][color=#000088]this[/color][color=#000000]  [/color][color=#000088]case[/color]
[color=#000000]  term[/color][color=#666600].[/color][color=#000000]setTextColour[/color][color=#666600]([/color][color=#000000]firstCol[/color][color=#666600])[/color]
[color=#000000] [/color][color=#000088]else[/color]
[color=#000000]  term[/color][color=#666600].[/color][color=#000000]setTextColour[/color][color=#666600]([/color][color=#000000]secondCol[/color][color=#666600])[/color]
[color=#000000] [/color][color=#000088]end[/color]
[color=#000000] term[/color][color=#666600].[/color][color=#000000]write[/color][color=#666600]([/color][color=#000088]string[/color][color=#666600].[/color][color=#000088]sub[/color][color=#666600]([/color][color=#000000]word[/color][color=#666600],[/color][color=#000000]len[/color][color=#666600],[/color][color=#000000]len[/color][color=#666600]))[/color][color=#000000] [/color][color=#666600]--[/color][color=#660066]Sub[/color][color=#000000] the [/color][color=#000088]string[/color][color=#000000] to the current character
[/color][color=#000088]end[/color]
Could anyone Help?

#23 SuicidalSTDz

    Permutator of Strings

  • Members
  • 1,308 posts
  • LocationPennsylvania

Posted 14 April 2013 - 11:31 AM

Are you using a non-advanced computer?

#24 Spongy141

  • Members
  • 526 posts
  • Location'Merica

Posted 14 April 2013 - 03:14 PM

^
He has to be, since that is the only way he can get that error, but nice tutorial!

#25 SuicidalSTDz

    Permutator of Strings

  • Members
  • 1,308 posts
  • LocationPennsylvania

Posted 14 April 2013 - 03:26 PM

View PostSpongy141, on 14 April 2013 - 03:14 PM, said:

-snippity snip snip-
nice tutorial!
Thanks ^_^

#26 Popeye

  • Members
  • 46 posts

Posted 15 April 2013 - 06:23 AM

I was using a Normal Computer. Also awesome Tutorial!

#27 Popeye

  • Members
  • 46 posts

Posted 15 April 2013 - 06:38 AM

Are you Supposed to enter your own Word?
This is what happen's for Me:

Posted Image

#28 SuicidalSTDz

    Permutator of Strings

  • Members
  • 1,308 posts
  • LocationPennsylvania

Posted 15 April 2013 - 06:43 AM

You must change the string in the word variable to your own word:

local word = "Test " --Leave one space so the cursor doesnt obscure the word 


#29 Popeye

  • Members
  • 46 posts

Posted 15 April 2013 - 06:49 AM

Ah okay. Thank's!

#30 Spongy141

  • Members
  • 526 posts
  • Location'Merica

Posted 15 April 2013 - 05:11 PM

View PostBill4788, on 15 April 2013 - 06:38 AM, said:

Are you Supposed to enter your own Word?
This is what happen's for Me:

Posted Image
Looks like you shovel and sword are about to break... you might want to repair them. :P

#31 SuicidalSTDz

    Permutator of Strings

  • Members
  • 1,308 posts
  • LocationPennsylvania

Posted 15 April 2013 - 05:19 PM

View PostSpongy141, on 15 April 2013 - 05:11 PM, said:

Looks like you shovel and sword are about to break... you might want to repair them. :P
local function foo()
 if yourAttentionToDetails > myAttentionSpan then
  return true
 else
  return false
 end
end

local ok,err = pcall(foo)
if not ok then
 print(err)
end
>attempt to compare number to nil
See what I did there :P

#32 Spongy141

  • Members
  • 526 posts
  • Location'Merica

Posted 15 April 2013 - 05:23 PM

^
Lol





2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users