Search found 40 matches

by Discostar
Sat Jul 04, 2020 3:34 pm
Forum: Ren'Py Questions and Announcements
Topic: [SOLVED] How do you get the attribute (?) of an item?
Replies: 10
Views: 622

Re: How do you get the attribute (?) of an item?

If "item" is defined in a screen, the way you would check the "fruit" attribute of "item" is: if item.fruit == True: ## action or, if you're just checking for it being true: if item.fruit: ## action Aaahhh, okay, that was missing piece #1... First of all, self.fruit = ...
by Discostar
Fri Jul 03, 2020 4:40 pm
Forum: Ren'Py Questions and Announcements
Topic: [SOLVED] How do you get the attribute (?) of an item?
Replies: 10
Views: 622

Re: How do you get the attribute (?) of an item?

Like someone else said, we'd need to see more of your code to know what is going on. Also, as far as I can tell, the lunch() screen should be throwing errors whenever you show it because it's not initializing or importing "item" from anywhere. Thank you for the reply, but that isn’t my is...
by Discostar
Fri Jul 03, 2020 4:21 pm
Forum: Ren'Py Questions and Announcements
Topic: [SOLVED] How do you get the attribute (?) of an item?
Replies: 10
Views: 622

Re: How do you get the attribute (?) of an item?

We'd need to see your entire Item class, not just the first line... Ok ok (T^T) Thanks for taking a look! It’s pretty simple. class Item(store.object): def __init__(self,name,fruit=False): global inventory self.name = name self.fruit = False label start: python: inventory = Inventory() apple = Item...
by Discostar
Fri Jul 03, 2020 3:12 pm
Forum: Ren'Py Questions and Announcements
Topic: [SOLVED] How do you get the attribute (?) of an item?
Replies: 10
Views: 622

Re: How do you get the attribute (?) of an item?

Alex wrote: Fri Jul 03, 2020 3:09 pmWhat your Item class attributes are?
Is it looks like

Code: Select all

class Item(name, fruit):
I knew that was going to be the very first question.

My class looks like:

Code: Select all

class Item(name, fruit=False):
That’s not the problem. I need it on an individual bases.

Thanks for the reply!
by Discostar
Fri Jul 03, 2020 2:43 pm
Forum: Ren'Py Questions and Announcements
Topic: [SOLVED] How do you get the attribute (?) of an item?
Replies: 10
Views: 622

[SOLVED] How do you get the attribute (?) of an item?

Start: Python: apple = Item(“Apple”, fruit=True) eggs = Item(“Eggs”, fruit=False) screen lunch(): if item.fruit == True: $ Jump(“eatfruit”) Doesn’t work. And neither does: If hasattr(item,’fruit’) == True: $ Jump(“eatfruit”) (Typed on phone so ignore the obvious, it’s about getting renpy to discern...
by Discostar
Sun Dec 08, 2019 2:05 pm
Forum: Ren'Py Questions and Announcements
Topic: [SOLVED] Return a Function with a variable name?
Replies: 5
Views: 769

Re: [SOLVED] Return a Function with a variable name?

@strayerror: That does the trick! Thank you.
by Discostar
Mon Dec 02, 2019 1:22 pm
Forum: Ren'Py Questions and Announcements
Topic: [SOLVED] Return a Function with a variable name?
Replies: 5
Views: 769

Re: Return a Function with a variable name?

I'm not sure if this is in line with what you want to do, but you could have a parameter to your base function that could determine what other function would be called. def PushTheButton(a): if a==0: Cool_Func() elif a==1: Awesome_Func() else: Hella_Func() return I should have mentioned, I did this...
by Discostar
Mon Dec 02, 2019 12:08 pm
Forum: Ren'Py Questions and Announcements
Topic: [SOLVED] Return a Function with a variable name?
Replies: 5
Views: 769

[SOLVED] Return a Function with a variable name?

I'm not even sure how to search for the answer to this question. I have a cool function that returns another function. def PushTheButton(): Cool_Func() return Works great. BUT what I want to do is have multiple iterations of Cool_Func with different names: def Cool_Func(): #whatever... return def Aw...
by Discostar
Mon Nov 04, 2019 1:06 pm
Forum: Ren'Py Questions and Announcements
Topic: [SOLVED] Passing Variable Values to a Text Image?
Replies: 4
Views: 803

Re: Passing Variable Values to a Text Image?

philat wrote: Mon Oct 28, 2019 10:32 pm Additionally, what is gained by using the Text() image rather than just showing text?

Code: Select all

screen popup(n):
    text str(n) at transform
seems like it would do basically the same thing...
I may want to do some fancy things later.

"Developer's prerogative"? :lol:
by Discostar
Mon Oct 28, 2019 4:55 pm
Forum: Ren'Py Questions and Announcements
Topic: [SOLVED] Passing Variable Values to a Text Image?
Replies: 4
Views: 803

Re: Passing Variable Values to a Text Image?

The Text image is getting created when the “image” line is evaluated, which happens at “init” time. It doesn’t get rebuilt when it’s then used in the screen. If you moved the Text declaration into your screen, as part of the “add” statement, I think you’d get what you want. That was it! It seems so...
by Discostar
Mon Oct 28, 2019 10:54 am
Forum: Ren'Py Questions and Announcements
Topic: [SOLVED] Passing Variable Values to a Text Image?
Replies: 4
Views: 803

[SOLVED] Passing Variable Values to a Text Image?

I have a function that calls a label that calls (or shows?) a screen- the screen shows a text image which is set to display the numerical value of a variable. This is my basic set up: init: def MyFunc(): if random == 1: popup = 1 return if random == 2: popup = 2 $ popup = 0 image popuppic01 = At(Tex...
by Discostar
Wed Feb 20, 2019 12:29 am
Forum: Ren'Py Questions and Announcements
Topic: Run Function Multiple Times? Over and Over again, in a loop?
Replies: 4
Views: 486

Re: Run Function Multiple Times? Over and Over again, in a loop?

I saw some things about the "while loop", but I didn't understand how to properly use it.

I ended up experimenting with repeat.

Thank you both!
by Discostar
Mon Feb 18, 2019 10:15 pm
Forum: Ren'Py Questions and Announcements
Topic: Run Function Multiple Times? Over and Over again, in a loop?
Replies: 4
Views: 486

Run Function Multiple Times? Over and Over again, in a loop?

Is there a way to run a Function multiple times? Let's say I have a little function def MyFunc(): x = 0 if x > 5: y = 5 return Let's just say, hypothetically, the above code works. I want to trigger MyFunc() 10 times in a row. Just... over and over and over again. Like a madman! In a loop, if you wi...
by Discostar
Sun Jan 07, 2018 2:28 pm
Forum: Ren'Py Questions and Announcements
Topic: Custom Transform Repeats
Replies: 3
Views: 743

Re: Custom Transform Repeats

Sadly, "on start" had no effect.
by Discostar
Sat Jan 06, 2018 2:18 pm
Forum: Ren'Py Questions and Announcements
Topic: Custom Transform Repeats
Replies: 3
Views: 743

Custom Transform Repeats

I *think* I'm having this problem: https://github.com/renpy/renpy/issues/1243 I have a screen button with a custom transform. transform my_moveintop: on show: alpha .0 ypos -5 parallel: linear .3 alpha 1.0 parallel: linear .5 ypos 0 on hide: alpha 1.0 parallel: linear .3 alpha .0 parallel: linear .5...