Imagebuttons

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
burnt_offering
Regular
Posts: 107
Joined: Sun Feb 23, 2014 4:21 pm
Completed: The Stroke of Midnight
Organization: Ace Of Spades
IRC Nick: burnt_offering or TheTapDancer
Skype: aceofspadesvn
itch: aceofspadesvn
Location: London
Contact:

Imagebuttons

#1 Post by burnt_offering »

I'm trying to get an imagemap to show some images depending on the characters in the player's party. To do this, I've got a player class which contains the party members as an array.

When I'm calling the image, i used:

Code: Select all

imagebutton you.team[0].pic action Null() align (.3,.2)
but I think imagebutton wants a string for the image, so I'm not sure what to do.

For clarification, this is the error message:

Code: Select all

File "game/screens.rpy", line 23: u'you' is not a keyword argument or valid child for the imagebutton statement.
    imagebutton you.team[0].pic action Null() align (.3,.2)
Thanks
Dave
[url]http:\\aceofspades@vnovel.com[/url]
Or just follow me at @AceOfSpades_VN

User avatar
GreyWolfXx
Regular
Posts: 68
Joined: Fri Jun 05, 2015 1:00 am
IRC Nick: Grey
Skype: GreyWolfXxII
Contact:

Re: Imagebuttons

#2 Post by GreyWolfXx »

Hey, Dave, I think you should take a different approach to this character dependent image problem.
You could easily use variables and save yourself the trouble! x)

Best,
Grey

"We have been to the moon, we have charted the depths of the ocean and the heart of the atom,
but we have a fear of looking inward to ourselves because we sense that is where
all the contradictions flow together." -- Terrence Mckenna

User avatar
burnt_offering
Regular
Posts: 107
Joined: Sun Feb 23, 2014 4:21 pm
Completed: The Stroke of Midnight
Organization: Ace Of Spades
IRC Nick: burnt_offering or TheTapDancer
Skype: aceofspadesvn
itch: aceofspadesvn
Location: London
Contact:

Re: Imagebuttons

#3 Post by burnt_offering »

Same program, new problem :D :'(

I've got a class with an attribute pic, and I'm calling that class to form a style so my imagebuttons work. However, I don't know how Ren'Py's If function works, so it keeps calling pic from Null objects when the party isn't full.

I tried fixing it with this:
style batyou1:
if you.team[1] is unit:
background you.team[1].pic

but that gave me:
File "game/screens.rpy", line 20: end of line expected.
if you.team[1] is unit:

And I haven't been able to find a page for the if is function on the renpy documentation.
[url]http:\\aceofspades@vnovel.com[/url]
Or just follow me at @AceOfSpades_VN

User avatar
trooper6
Lemma-Class Veteran
Posts: 3712
Joined: Sat Jul 09, 2011 10:33 pm
Projects: A Close Shave
Location: Medford, MA
Contact:

Re: Imagebuttons

#4 Post by trooper6 »

You might want to put your code inside the [ code][ /code] tags (without the extra space) so people can see your indentation.
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?)
Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978

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

Re: Imagebuttons

#5 Post by philat »

Imagebuttons need at least ground and hover images. They don't take one image directly.

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: Imagebuttons

#6 Post by mobychan »

trooper6 wrote:You might want to put your code inside the [ code][ /code] tags (without the extra space) so people can see your indentation.
jup that definitely would be better^^
philat wrote:Imagebuttons need at least ground and hover images. They don't take one image directly.
I think it's idle and hover?

User avatar
burnt_offering
Regular
Posts: 107
Joined: Sun Feb 23, 2014 4:21 pm
Completed: The Stroke of Midnight
Organization: Ace Of Spades
IRC Nick: burnt_offering or TheTapDancer
Skype: aceofspadesvn
itch: aceofspadesvn
Location: London
Contact:

Re: Imagebuttons

#7 Post by burnt_offering »

Thanks, I managed to get it to work by making it a textbutton.
[url]http:\\aceofspades@vnovel.com[/url]
Or just follow me at @AceOfSpades_VN

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot]