Search found 1576 matches

by philat
Mon May 20, 2019 10:28 pm
Forum: Ren'Py Questions and Announcements
Topic: How to run python commands as the result of a screen language action?
Replies: 9
Views: 148

Re: How to run python commands as the result of a screen language action?

Hadn't looked at the whole thing, but. https://www.renpy.org/doc/html/screen_a ... l#Function

Code: Select all

init python:
    def foo(bar):
        print bar

screen screen_foo():
    textbutton "Test" action Function(foo, "print this")
by philat
Mon May 20, 2019 9:47 pm
Forum: Ren'Py Questions and Announcements
Topic: Interporlating {w=3.0} or {p=1.0}
Replies: 2
Views: 75

Re: Interporlating {w=3.0} or {p=1.0}

No, it should work (assuming the typo is fixed).
by philat
Wed May 15, 2019 9:00 pm
Forum: Ren'Py Questions and Announcements
Topic: Local labels and from clause in calls
Replies: 6
Views: 155

Re: Local labels and from clause in calls

Looks like a bug. PyTom does look at this forum but it may be faster to flag this on the github.
by philat
Tue May 14, 2019 9:09 pm
Forum: Ren'Py Questions and Announcements
Topic: [SOLVED] Capping a random integer
Replies: 6
Views: 170

Re: Capping a random integer

It means take the smaller of 12 and the result of the random roll. max() does the opposite (take the larger number).
by philat
Tue May 14, 2019 9:07 pm
Forum: Ren'Py Questions and Announcements
Topic: how to get character name?
Replies: 2
Views: 71

Re: how to get character name?

Just plain p or p.name should both return "Peter".
by philat
Tue May 07, 2019 9:39 pm
Forum: Ren'Py Questions and Announcements
Topic: [Solved] How to make a history of screens?
Replies: 8
Views: 128

Re: [Not yet solved] How to make a history of screens?

Hard to offer much other than general comments as it's not testable, but perhaps set a variable for the back button when you're showing the new screen. In other words, screen A has a button that 1) shows screen B, 2) sets a variable called previous_screen to "A". screen B has a back button that basi...
by philat
Tue May 07, 2019 9:20 pm
Forum: Ren'Py Questions and Announcements
Topic: Inline IF possible in a sayer string?
Replies: 3
Views: 72

Re: Inline IF possible in a sayer string?

If you prefer, you can also use python rather than renpy statements.

Code: Select all

$myCharacter("There {0} {1} apple{2} in the basket.".format("are" if apple==0 or apple>=2 else "is", apple, "s" if apple==0 or apple>=2 else ""))
by philat
Tue Apr 23, 2019 2:21 am
Forum: Ren'Py Questions and Announcements
Topic: how to parse a variable in image text [solved]
Replies: 4
Views: 127

Re: how to parse a variable in image text

The problem is the image is defined once taking the value of name at the time of definition and isn't updated. (Also possibly the order the variable being defined -- have you added a default name = None or something at the beginning?) I'd try ParameterizedText (https://www.renpy.org/doc/html/text.ht...
by philat
Tue Apr 23, 2019 1:55 am
Forum: Ren'Py Questions and Announcements
Topic: Checking number of options selected in a check menu [Solved]
Replies: 11
Views: 214

Re: Checking number of options selected in a check menu

You can just refer to each clue by its index in the all_clues or all_deductions list (refer to all_clues[0].create("The butler was having an affair with the housekeeper.") ). You could also manually assign more convenient names for them, but I didn't, because I'm lazy. It's not very different from u...
by philat
Mon Apr 22, 2019 10:41 pm
Forum: Ren'Py Questions and Announcements
Topic: Checking number of options selected in a check menu [Solved]
Replies: 11
Views: 214

Re: Checking number of options selected in a check menu

How you do this is honestly up to you, but this is one way that I would imagine going about it. It may be overkill if the game is simpler, but it would be easier to add/modify clues and deductions on the fly, since all you have to do is create a few new objects and link them together. It's also easy...
by philat
Mon Apr 22, 2019 9:54 pm
Forum: Ren'Py Questions and Announcements
Topic: Rollback Causing Issues with Random Events (Solved)
Replies: 5
Views: 189

Re: Rollback Causing Issues with Random Events

pop returns and removes the item from the list. If that's not what you need, then of course you can use some other method.

Again, renpy.random should not affect rollback in your first example anyway; I don't know what you're doing to make it behave otherwise.
by philat
Mon Apr 22, 2019 6:04 am
Forum: Ren'Py Questions and Announcements
Topic: Checking number of options selected in a check menu [Solved]
Replies: 11
Views: 214

Re: Checking number of options selected in a check menu

Eh... there are a lot of ways to do this, but I wouldn't write it out all long hand -- using a list and some predefined objects should be cleaner in the long run (although writing it all out may be simpler if there aren't that many clues). Leaving a comment to remind myself to get back to you in the...
by philat
Sun Apr 21, 2019 10:40 pm
Forum: Ren'Py Questions and Announcements
Topic: Rollback Causing Issues with Random Events (Solved)
Replies: 5
Views: 189

Re: Rollback Causing Issues with Random Events

Besides the fact that I don't believe the random event resets (it shouldn't, because renpy.random is designed to work through rollback), wouldn't using persistent in this manner only allow one playthrough anyway? If the only thing you're trying to is ensure that there are no duplicates, you could ju...