Formatting in choicescript

I know it’s possible to do italics with [ i ] [ / i ] (sans spaces) and bold with [ b ] [ / b ].

I had a few instances in my current game where I wanted to have crossed-out text, though, and I was wondering if there’s currently any way to use strikethrough.

Thanks!

2 Likes

I don’t think there’s an officially supported way to do it.
So first you need to ask yourself is do you really need those strike throughs, keeping in mind it won’t be supported in a finished game. (Unless you ask very nicely and they say yes.)

Similar question I think implementing strike throughs would be similar.

4 Likes

Ah, okay, thank you. Yes, ‘need’ is awfully relative, isn’t it? I’d like to have strikethrough and I think it’d add to the effect. On the other side of things, I’m certainly happy to write around the section where I’d use it, rather than having to just take it out later if I submit as a Hosted Game. Much obliged.

1 Like

Personally, I’d implement the strike throughs, because it’s fun to make those sorts of tweaks and you learn by doing so. :slight_smile: Then I’d worry about the finished game when that time comes. It seems such a little thing, and an easy thing to implement and one that would have little effect on readability.

Hm, I see what you mean. And yes, I agree, it’d be fun; plus, it’s for a humour scene. Maybe I will give it a go. Thanks!

1 Like

You could always do the “image for text” workaround. Strike it out yourself in a graphics program, then include that paragraph as an image.

While that’s certainly a solution, I’d generally suggest against it because image as text would make the game inaccessible to blind players. (I don’t think just striking through would.)

2 Likes

Also, the images wouldn’t compile during beta testing, right? So it’d be both simpler for beta testing and better for accessibility to use @CJW 's solution linked above.

Thanks for the suggestion, though!

Edit: Too, the image might be an option if I did need to eventually remove the strikethrough and write around the dilemma. So that would be helpful.

1 Like

I would certainly recommend the above method over images to begin with, but there is a way you can include images in a compiled game.

Visit this website (or any other online image to data uri converter):
http://websemantics.co.uk/online_tools/image_to_data_uri_convertor/

Upload your image as per the instructions and when the process is complete, copy the ‘raw data’ to your clipboard, it should look something like this… (…only it will be A LOT longer!)

data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAsoAAAHiCAYAAADxgeqGAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAFCOSURBVHhe7d1djB7Xfef53O9i52aBzV7s7GBBYfYmwQL7crebuVhgBiRv9momwQabZBEHE2OHpJFxxpm82vECmUWsSOQoTuDNmHIkc7zJ2KHohkVFkiVGNCmZTTebFBWxqRdKtvnafJ8MkEnO1v

You can then paste that raw data as the *image command’s parameter (instead of a path or url).
data_uri’s are extremely long however, so I suggest always making a seperate scene for each image and using *gosub_scene to include it (so you never have to open it again and it doesn’t bloat your normal scenes).

so in myimage.txt:

*image data:image/png;base64,iVBORw0KGgoAAAAN...etc...
*return

and where you want the image to appear:

*gosub_scene myimage.txt


This is a perfectly acceptable and valid method for displaying images on the web, so don’t be afraid to use it.
It can make images take up more a bit more space though, so it’s worth making sure they’re well optimized before converting them.

Time and ability permitting I would very much like to eventually make the compiler automatically convert any images included in the game to data_uris so you wouldn’t have to this manually.

5 Likes

@CJW
max size: 32768 Bytes
png, jpg or gif only

That is a tiny file size, not big enough for the cover art, I guess.

There’s plenty out there, look for another, I just picked out the first one google gave me.

1 Like

Hi Everyone, just wondering if anyone knows what I might be doing wrong? I’m trying to get an image to work in a compiled text but if I use the method outlined by @CJW, it just seems to give a blank page where it goes on thinking for ever.

The image text looks like this:
*image data:image/jpeg;base64,/9j/4AAQSkZJRgABAQ…(Haven’t copied it all as it’s very long).

Alternatively someone told me they got the image to work by changing it from the normal image command to

*image PreConfigured%20CS/web/mygame/waternymphscropped.jpg center\r

but I still seem to get a broken picture. Any help appreciated! Thank you :slight_smile:

1 Like

Answered you over on the CSIDE thread…if that doesn’t suit, maybe try removing the / after ‘base64’ and putting in a space instead?

And just to be sure, is the image in its own scene and is being called with a *gosub_scene? Oh, and if it is in a subscene, you might try putting the scene name on the scene list.

If that’s not it, not sure what else to suggest, sorry. ):

1 Like

Hello, I tried this method but it says “too much recursion” as an error on firefox.
I tried with the last version of choicescript. Also tried putting the raw data inside the normal scene, without the gosub_scene command.

The size of the image is also small, not even 1Mb.

Is it a known issue? Is there a solution?

Thanks

Sounds like you’ve got an endless loop, i.e. too many gosubs and not enough returns?

Thanks for the answer. Uhm, actually there’s only the gosub_scene that goes to the image.txt, and the one return at the end of the raw image data.

No loops causing the gosub_scene line to be called repeatedly? I’d be happy to take a look if you’re happy to PM a link to download your scene files.