Inserting graphics into the text in NVL mode.

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Message
Author
Scott
Regular
Posts: 35
Joined: Thu Sep 13, 2007 6:11 am
Contact:

Inserting graphics into the text in NVL mode.

#1 Post by Scott » Sat Sep 15, 2007 10:45 am

If I were to make images containing, for example, custom characters, is there a way to insert them into the normal text in NVL mode?

User avatar
PyTom
Ren'Py Creator
Posts: 15893
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Inserting graphics into the text in NVL mode.

#2 Post by PyTom » Sat Sep 15, 2007 10:55 am

Sure. That's what the {img=character.png} text tag is for.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
"Silly and fun things are important." - Elon Musk
Software > Drama • https://www.patreon.com/renpytom

Scott
Regular
Posts: 35
Joined: Thu Sep 13, 2007 6:11 am
Contact:

Re: Inserting graphics into the text in NVL mode.

#3 Post by Scott » Sun Sep 16, 2007 12:16 am

I went a little nuts trying to figure out why that didn't work until I was finally able to find the appropriate page of documentation: http://www.renpy.org/wiki/renpy/doc/reference/Text#tags

It's {image=file}.

That said, is there a way to change the height/width in the tag itself, or should I make separate images?

User avatar
PyTom
Ren'Py Creator
Posts: 15893
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Inserting graphics into the text in NVL mode.

#4 Post by PyTom » Sun Sep 16, 2007 1:24 am

IIRC, the width is the width of the image, and the height is fixed to the height of the current line of text. (So it should automatically do the right thing.)
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
"Silly and fun things are important." - Elon Musk
Software > Drama • https://www.patreon.com/renpytom

Scott
Regular
Posts: 35
Joined: Thu Sep 13, 2007 6:11 am
Contact:

Re: Inserting graphics into the text in NVL mode.

#5 Post by Scott » Sun Sep 16, 2007 1:37 am

No, I mean... for example, if I have an image that's the height of the text and one pixel wide -- and I put a white pixel in it, can I adjust the width of the image like I could in an HTML tag to create a dash?

Scott
Regular
Posts: 35
Joined: Thu Sep 13, 2007 6:11 am
Contact:

Re: Inserting graphics into the text in NVL mode.

#6 Post by Scott » Sun Sep 16, 2007 3:20 am

Also, is it possible to do a global replace within all NVL text to replace a character with an image? For example, if I use a hyphen (-) in the text, the engine would replace it with {image=dash.png}...

User avatar
monele
Lemma-Class Veteran
Posts: 4101
Joined: Sat Oct 08, 2005 7:57 am
Location: France
Contact:

Re: Inserting graphics into the text in NVL mode.

#7 Post by monele » Sun Sep 16, 2007 4:56 am

If you want a dash, you'll need an image with a dash in it... it just pastes the image in and there's no post processing such as enlarging it.
But your last question is something I've been wondering about : could there be an easier way to put images in the text? Such as... using alias codes or something?

Scott
Regular
Posts: 35
Joined: Thu Sep 13, 2007 6:11 am
Contact:

Re: Inserting graphics into the text in NVL mode.

#8 Post by Scott » Sun Sep 16, 2007 4:59 am

Yeah, I figured as much after messing with the code. I ended up making a couple different dashes, heh. And some ellipses.

Scott
Regular
Posts: 35
Joined: Thu Sep 13, 2007 6:11 am
Contact:

Re: Inserting graphics into the text in NVL mode.

#9 Post by Scott » Mon Sep 17, 2007 5:30 pm

I'm going to guess that's a no to both the aliasing and being able to adjust image width in the tag a la HTML tags.

User avatar
monele
Lemma-Class Veteran
Posts: 4101
Joined: Sat Oct 08, 2005 7:57 am
Location: France
Contact:

Re: Inserting graphics into the text in NVL mode.

#10 Post by monele » Mon Sep 17, 2007 5:54 pm

*wonders if PyTom has a trigger on his username*....

I think he just missed the post ^_^. Let's wait some more :)... or if needed, we/you can pm him.

User avatar
PyTom
Ren'Py Creator
Posts: 15893
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Inserting graphics into the text in NVL mode.

#11 Post by PyTom » Mon Sep 17, 2007 9:11 pm

No, no trigger on my username. There's no way of resizing images, or of aliasing images to give them shorter names. Image inclusion is meant to be a rare thing... if you really need lots of special characters, you should look at editing your font to include them. (For example, most fonts already include ‐, –, ‒, —, and ― characters, which should take care of the dashes.)
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
"Silly and fun things are important." - Elon Musk
Software > Drama • https://www.patreon.com/renpytom

User avatar
Criptych
Regular
Posts: 87
Joined: Sat Jun 23, 2007 9:19 am
Projects: ALICE.NET
Location: The other end of the internet.
Contact:

Re: Inserting graphics into the text in NVL mode.

#12 Post by Criptych » Mon Sep 17, 2007 10:04 pm

I suppose this is related:

You mentioned "editing your font to include" special characters; is there a way to temporarily switch fonts to get those special characters from another font?

For example, "What the {font=pottymouth.ttf}abcd{/font}!?"
(Not exactly my intent, but just an example. :P)
Computers are useless. They can only give you answers. —Pablo Picasso

Image

User avatar
PyTom
Ren'Py Creator
Posts: 15893
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Inserting graphics into the text in NVL mode.

#13 Post by PyTom » Mon Sep 17, 2007 10:22 pm

Yes, simply use the {font=foo.ttf}text{/font} text tag.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
"Silly and fun things are important." - Elon Musk
Software > Drama • https://www.patreon.com/renpytom

User avatar
monele
Lemma-Class Veteran
Posts: 4101
Joined: Sat Oct 08, 2005 7:57 am
Location: France
Contact:

Re: Inserting graphics into the text in NVL mode.

#14 Post by monele » Tue Sep 18, 2007 7:42 am

Mhhhh... so I guess an actual solution would be to create an SFont with regular characters AND special characters you wouldn't use otherwise assigned to little pictures... Like having Arial combined with Wingdings or something? ^^;

User avatar
Criptych
Regular
Posts: 87
Joined: Sat Jun 23, 2007 9:19 am
Projects: ALICE.NET
Location: The other end of the internet.
Contact:

Re: Inserting graphics into the text in NVL mode.

#15 Post by Criptych » Tue Sep 18, 2007 10:19 am

PyTom wrote:Yes, simply use the {font=foo.ttf}text{/font} text tag.
...Undocumented feature? Or did I just not read carefully enough? :?

Thanks a lot, though. :D
Computers are useless. They can only give you answers. —Pablo Picasso

Image

Post Reply

Who is online

Users browsing this forum: _ticlock_