[SOLVED] "Expected word not found" error when changing font

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.
Post Reply
Message
Author
User avatar
Keryee
Regular
Posts: 25
Joined: Wed Jun 03, 2015 12:14 pm
Location: Hong Kong
Contact:

[SOLVED] "Expected word not found" error when changing font

#1 Post by Keryee » Sun Nov 08, 2015 6:58 pm

Struggling to figure out Ren'py, here-- I've been trying to change the default font, and it's been giving me this error:

Code: Select all

I'm sorry, but errors were detected in your script. Please correct the
errors listed below, and try again.


File "game/script.rpy", line 5: expected 'word' not found.
    style . default.font = "Mordred.ttf"
          ^

File "game/script.rpy", line 6: expected 'word' not found.
    style . default.size = 20
          ^

Ren'Py Version: Ren'Py 6.99.6.739
My code looks like this:

Code: Select all

init:
    style.default.font = "Mordred.ttf"
    style.default.size = 20
I have no idea what I'm doing wrong! Ahahaha...
Last edited by Keryee on Mon Nov 09, 2015 1:10 pm, edited 1 time in total.

User avatar
mobychan
Veteran
Posts: 275
Joined: Fri Apr 24, 2015 6:31 am
Projects: The Chosen - Sakura Pink & Gentian Blue
Organization: Foresoft
Location: Germany
Contact:

Re: "Expected word not found" error when changing font

#2 Post by mobychan » Mon Nov 09, 2015 3:51 am

the statements you're trying to use are python statements, so you either have to wrap them in a python block:

Code: Select all

init:
    python:
        style.default.font = "Mordred.ttf"
        style.default.size = 20
or start the lines with $:

Code: Select all

init:
    $ style.default.font = "Mordred.ttf"
    $ style.default.size = 20

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: "Expected word not found" error when changing font

#3 Post by PyTom » Mon Nov 09, 2015 12:05 pm

Or what's preferred:

Code: Select all

style default:
    font "Mordred.ttf"
    size 20
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
Keryee
Regular
Posts: 25
Joined: Wed Jun 03, 2015 12:14 pm
Location: Hong Kong
Contact:

Re: "Expected word not found" error when changing font

#4 Post by Keryee » Mon Nov 09, 2015 1:08 pm

PyTom wrote:Or what's preferred:

Code: Select all

style default:
    font "Mordred.ttf"
    size 20
Oh, wow! Thank you both so much, that's really helpful.

Post Reply

Who is online

Users browsing this forum: _ticlock_