I'd like to be able to pass a variable into a User Defined Displayable (or call an external variable from a UDD class) such that I can change a UDD on the fly without having to hard code it each time (or at least plug it in upon definition or screen initiation so I don't have to copy/paste code each time.)
For example, perhaps passing in a set of 2 coordinate pairs to draw a line displayable, such that at different points in my game the line could connect different pairs of points. I know this is trivially easy to achieve by just resizing and reorienting the line as a normal displayable, but I'd like to be able to do it as a UDD to better understand UDD and achieve more complex renders.
If anyone could explain (or better show me) how, I would be really grateful.
[Resolved] Passing a variable into User Defined Displayable
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.
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.
[Resolved] Passing a variable into User Defined Displayable
Last edited by Unin on Sun Feb 16, 2014 10:59 pm, edited 1 time in total.
-
- Eileen-Class Veteran
- Posts: 1258
- Joined: Fri Sep 21, 2007 7:13 am
- Projects: a battle engine
- Contact:
Re: Passing a variable into a User Defined Displayable
I haven't tried this, but surely you can just modify fields in the UDD object on the fly?
$udd = UDD()
$ui.add(udd)
...
$udd.variable = 1
$udd = UDD()
$ui.add(udd)
...
$udd.variable = 1
Re: Passing a variable into a User Defined Displayable
interesting. I was displaying my UDD on separate screens, and did not even consider ui.add
looks like this will work. thank you.
looks like this will work. thank you.
Who is online
Users browsing this forum: Bing [Bot], Google [Bot], Semrush [Bot]