[Resolved] Using the '@' code per the Ren'Py Documentation

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
WhiteFog
Newbie
Posts: 13
Joined: Mon Jul 01, 2019 11:40 pm
Contact:

[Resolved] Using the '@' code per the Ren'Py Documentation

#1 Post by WhiteFog »

Hey all-

I've been tearing my hair out over at this for awhile and finally broke down to ask for some assistance. It's entirely possible that it's something that I'm missing in my understanding of how something is supposed to work, or perhaps it doesn't work as written, or some combination thereof. But the main thing I'm referring to is this code on this page.

define e = Character("Eileen", image="eileen")

label start:

show eileen mad
e "I'm a little upset at you."

e @ happy "That's funny."

e "But don't think it gets you out of hot water."


The way I'm understanding it- if you have images defined for a specific character, as long as you've defined the image to use for that character, you can use the @ symbol while showing speech in order to make a temporary change.

In the game I'm working on, we've got multiple outfits, poses, and expression changes for each character. As such, presently, one such group of definitions for a character looks like:

image jack uniform flustered 1 = "JackFlustered1Uniform.png"
image jack uniform happy 1 = "JackHappy1Uniform.png"
image jack uniform neutral 1 = "JackNeutral1Uniform.png"
image jack uniform neutral 2 = "JackNeutral2Uniform.png"
image jack uniform sad 1 = "JackSad1Uniform.png"


So in my assumptions, jack is the image tag, and then uniform, flustered/happy/neutral/sad and 1/2 are attributes for jack.

With that being said, even if I define jack with-

define ja = Character("Jack", image="jack")

I cannot, for the life of me, get the @ thing to work.

I don't mind writing out

show jack uniform neutral 1
mc "blah blah"
show jack uniform neutral 2
ja "blah blah blah"
show jack uniform neutral 1


But man if I didn't have to I would really like to not, that would be fantastic.

Thank you all in advance for any ideas/help/tips/tricks/etc!
Last edited by WhiteFog on Wed Jul 03, 2019 10:10 pm, edited 1 time in total.

trajano
Regular
Posts: 60
Joined: Sun Jun 16, 2019 7:59 pm
Github: trajano
Contact:

Re: Using the '@' code per the Ren'Py Documentation

#2 Post by trajano »

show jack uniform neutral 1
mc "blah blah"
ja @ uniform neutral 2 "blah blah blah"
ja "Something's a foot"

would this work?

WhiteFog
Newbie
Posts: 13
Joined: Mon Jul 01, 2019 11:40 pm
Contact:

Re: Using the '@' code per the Ren'Py Documentation

#3 Post by WhiteFog »

Not as far as I know : /

I've tried-

ja @ 2
ja @ neutral 2
ja @ uniform neutral 2


And it comes back with 'expected statement'

So for now I'll just toggle it with

show jack 2
ja blah blah
show jack 1


I suppose. It also didn't seem to work (I copied it verbatim) for the example listed so maybe the function's simply no longer available in Ren'py?

User avatar
Per K Grok
Miko-Class Veteran
Posts: 882
Joined: Fri May 18, 2018 1:02 am
Completed: the Ghost Pilot, Sea of Lost Ships, Bubbles and the Pterodactyls, Defenders of Adacan Part 1-3, the Phantom Flyer
itch: per-k-grok
Location: Sverige
Contact:

Re: Using the '@' code per the Ren'Py Documentation

#4 Post by Per K Grok »

WhiteFog wrote: Wed Jul 03, 2019 1:53 am Not as far as I know : /

I've tried-

ja @ 2
ja @ neutral 2
ja @ uniform neutral 2


And it comes back with 'expected statement'

So for now I'll just toggle it with

show jack 2
ja blah blah
show jack 1


I suppose. It also didn't seem to work (I copied it verbatim) for the example listed so maybe the function's simply no longer available in Ren'py?

Have you tried writing your three attribute as one? i.e.

image jack uniform_flustered_1 = "JackFlustered1Uniform.png"

I have no knowledge on how this function works, but that would be something I would test.

User avatar
Remix
Eileen-Class Veteran
Posts: 1628
Joined: Tue May 30, 2017 6:10 am
Completed: None... yet (as I'm still looking for an artist)
Projects: An un-named anime based trainer game
Contact:

Re: Using the '@' code per the Ren'Py Documentation

#5 Post by Remix »

As you have alluded, some of your attributes are effectively groups (yes, using a LayeredImage would suit your naming conventions a lot better as LayeredImages natively supports groups)... By that, I mean jack can have attribute flustered OR neutral OR happy OR sad, jack can have attribute 1 OR 2 not 1 AND 2

As such, when you are changing those (without using LayeredImage) you would need to remove the old one then add the new

show jack uniform neutral 1
ja @ 2 "words"
# would make it look for attributes ( uniform, neutral, 1 AND 2 ) which is ambiguous (it finds 2 matches that both score 3 out of 4)

show jack uniform neutral 1
ja @ -1 2 "words"
# -1 removes the attribute 1 (for one line as it is to the right of the @ symbol) then 2 adds the attribute 2

Untested, though that is how I understand tag attributes working.

Note: LayeredImage... yes, it is a lot to get your head around, it is worth it though...
Frameworks & Scriptlets:

philat
Eileen-Class Veteran
Posts: 1912
Joined: Wed Dec 04, 2013 12:33 pm
Contact:

Re: Using the '@' code per the Ren'Py Documentation

#6 Post by philat »

On latest ren'py the following works without issue.

Code: Select all

image jack = Solid("#444", xysize=(50,50))
image jack black = Solid("#000", xysize=(50,50))
image jack black big = Solid("#000", xysize=(100,100))
image jack white = Solid("#fff", xysize=(50,50))
image jack white small = Solid("#fff", xysize=(30,30))

define j = Character("Jack", image="jack")

label start:
    show jack at truecenter

    j "blah1"
    j small white "blah2"
    j "blah3"
    j @black big "blah4"
    j "blah5"
Unsure what your problem may be without knowing more. However, note that j white small and j small white both work, but j small does not. Might be the problem. *shrug*

WhiteFog
Newbie
Posts: 13
Joined: Mon Jul 01, 2019 11:40 pm
Contact:

Re: Using the '@' code per the Ren'Py Documentation

#7 Post by WhiteFog »

philat wrote: Wed Jul 03, 2019 6:02 am On latest ren'py
Y'know I hadn't considered updating. How weird is it that such fixed it?

Nothing to see here folks, just a poor dev who didn't see the forest for the trees.

Thanks for all who responded- sorry I missed the very obvious. :oops:

Post Reply

Who is online

Users browsing this forum: Semrush [Bot]