Page 1 of 1

Imagebuttons

Posted: Mon Aug 10, 2015 6:56 am
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

Re: Imagebuttons

Posted: Mon Aug 10, 2015 12:30 pm
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

Re: Imagebuttons

Posted: Wed Aug 12, 2015 8:39 am
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.

Re: Imagebuttons

Posted: Wed Aug 12, 2015 8:41 am
by trooper6
You might want to put your code inside the [ code][ /code] tags (without the extra space) so people can see your indentation.

Re: Imagebuttons

Posted: Wed Aug 12, 2015 8:48 am
by philat
Imagebuttons need at least ground and hover images. They don't take one image directly.

Re: Imagebuttons

Posted: Wed Aug 12, 2015 9:44 am
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?

Re: Imagebuttons

Posted: Wed Aug 12, 2015 10:07 am
by burnt_offering
Thanks, I managed to get it to work by making it a textbutton.