Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

replaceAll() and images

 
Taylor Swift
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
http://evercube.net/forum/ftb2meme.php

Take a look a that generator. You will notice there is a code table for it.



I need it so when the input {tri} it displays as down in "This is how it'll look in game:". Image: http://evercube.net/images/trianglebutton.png.


I have been able to do text replacement color using the following:


Here is an example image:


Any ideas for images to replace text?

 
Piet Verdriet
Ranch Hand
Posts: 266
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why are you including those curly brackets ('{' and '}') in your patterns?
Why not just use String's replace(...) method?

But what "real" problem are you trying to solve here?
 
Taylor Swift
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Piet Verdriet wrote:Why are you including those curly brackets ('{' and '}') in your patterns?
Why not just use String's replace(...) method?

But what "real" problem are you trying to solve here?


http://evercube.net/forum/ftb2meme.php

When they put in {*0} Color is generated as how it will look in game. I need it to do the same when they put in {tri} but instead of color it is an image.
 
Piet Verdriet
Ranch Hand
Posts: 266
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Taylor Swift wrote:
Piet Verdriet wrote:Why are you including those curly brackets ('{' and '}') in your patterns?
Why not just use String's replace(...) method?

But what "real" problem are you trying to solve here?


http://evercube.net/forum/ftb2meme.php

When they put in {*0} Color is generated as how it will look in game. I need it to do the same when they put in {tri} but instead of color it is an image.


I really have no idea what you're trying to do. What text are you working with? I thought you wanted to replace the underlined part from the text:

http://evercube.net/images/trianglebutton.png

If this is not the case, try explaining your problem again.

Good luck.
 
Taylor Swift
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
http://evercube.net/forum/ftb2meme.php

Take a look a that generator. Going to spell this one out. You will notice this:




When you input {*1}hello into the generator. It gives you a code for that text for the game. At the bottom, it also shows you how the code looks in game: hello

I need it so when the input {tri} it displays this image: http://evercube.net/images/trianglebutton.png.

 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I see "innerHTML" , which looks like JavaScript to me. "replaceAll", on the other hand, is a Java method - is this question about Java or JavaScript?

Curly braces and stars have special meaning in regular expressions (which is what replaceAll uses), so you'll need to escape them. Try "\\{\\*1\\}" instead of "{*1}".
 
Taylor Swift
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ulf Dittmer wrote:I see "innerHTML" , which looks like JavaScript to me. "replaceAll", on the other hand, is a Java method - is this question about Java or JavaScript?

Curly braces and stars have special meaning in regular expressions (which is what replaceAll uses), so you'll need to escape them. Try "\\{\\*1\\}" instead of "{*1}".


I updated the main thread.

The colors work fine. Try the generator. You will notice on "This is how it'll look in game:" when you put in {tri}, it comes out as {tri} instead of showing an image. When you put in {*1} it shows the text in the color it is suppose too.

Just to clear it up:

COLOR IS NOT THE PROBLEM. I NEED TO REPLACE {tri} TEXT WITH AN IMAGE WHEN PUT INTO THE GENERATOR.

Drew you kids a picture:
 
Taylor Swift
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
any ideas?
 
Piet Verdriet
Ranch Hand
Posts: 266
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Taylor Swift wrote:any ideas?


No, because I don't know what exactly you're trying to do and in what language you're doing this. You also didn't answer many of the questions asked to you to clarify your problem.
Perhaps someone else has an idea.
Best of luck though.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic