Search found 60 matches

by theCodeCat
Fri Feb 24, 2017 5:13 pm
Forum: Ren'Py Questions and Announcements
Topic: [Solved] Basic Python
Replies: 5
Views: 613

Re: Basic Python

You need to put your python function definitions into a "init python:" block. You are mostly correct about the global variables thing, but you only need to add the "global ..." line if you are modifying the value of the variable. If you are just reading from it, the "global ..." line is not necessary.
by theCodeCat
Thu Aug 04, 2016 10:03 pm
Forum: Ren'Py Questions and Announcements
Topic: Need Fresh eyes on Choice code
Replies: 5
Views: 274

Re: Need Fresh eyes on Choice code

This is just a guess but I think this line might be causing problems:

Code: Select all

action action
Try renaming the action variable to something like "choiceAction".
by theCodeCat
Thu Jul 28, 2016 6:32 pm
Forum: We are offering Paid Work
Topic: Looking for a good/new programmer (paid)
Replies: 6
Views: 1514

Re: Looking for a good/new programmer (paid)

SM_Team wrote:
Cypher wrote:What language.
PM sent.
Why would you want to keep the language being used a secret?
Potential applicants can't know if they are qualified if they don't know which language is required of them.
by theCodeCat
Mon Jul 25, 2016 4:36 pm
Forum: Ren'Py Questions and Announcements
Topic: Limiting amount of choices from menu that can be selected
Replies: 2
Views: 242

Re: Limiting amount of choices from menu that can be selecte

You could do something like: label start: "content leading into choice" python: # 0 = Not toured, 1 = Toured touredSpotA = 0 touredSpotB = 0 touredSpotC = 0 touredSpotD = 0 label tourChoice: # Count how many locations have been visited and check if that number is above some threshold if touredSpotA ...
by theCodeCat
Mon Jul 25, 2016 10:37 am
Forum: Ren'Py Questions and Announcements
Topic: [Solved]Return to main menu after jumping to another label
Replies: 6
Views: 351

Re: Return to main menu after jumping to another label

Use 'call labelName' instead of 'jump labelName' if you want to return to that line at some point.
by theCodeCat
Sat Jul 23, 2016 7:56 am
Forum: Ren'Py Questions and Announcements
Topic: the sprite expression wont change??
Replies: 2
Views: 163

Re: the sprite expression wont change??

The problem is that showing "rblush" doesn't hide "rhappy" or vice versa. "show rblush" probably just covered your rhappy image so it looked correct, and "show rhappy" doesn't do anything since "rhappy" is already on screen. One way to fix this would be to manually hide the last image like: hide rha...
by theCodeCat
Thu Jul 21, 2016 7:29 pm
Forum: Ren'Py Questions and Announcements
Topic: Attribute error i'm having trouble solving
Replies: 1
Views: 309

Re: Attribute error i'm having trouble solving

I'm pretty sure that this line is the problem: SetVariable(currentoverlay[x][y].unit_present, deployment_list[0].name) I assume you want this action, when executed, to do the same as the python statement: currentoverlay[x][y].unit_present = deployment_list[0].name The problem is that "SetVariable" i...
by theCodeCat
Tue Jul 12, 2016 5:49 pm
Forum: Ren'Py Questions and Announcements
Topic: Remembering random coin drops
Replies: 5
Views: 461

Re: Remembering random coin drops

"renpy.random.randint(15, 40)" is the part that generates the random number, "randcoin" is just the variable used to hold the value. Whenever you need a new random value you'll need to call "renpy.random.randint(15, 40)" again. Ex: label start: $ money = 0 $ randcoin = renpy.random.randint(15, 40) $...
by theCodeCat
Mon Jul 11, 2016 12:30 am
Forum: Ren'Py Questions and Announcements
Topic: why my game detected as virus ?
Replies: 5
Views: 664

Re: why my game detected as virus ?

False positive. I've had the same issue with another Renpy game I worked on.

Antivirus programs can only really guess whether a program is harmful and sometimes they guess incorrectly.
by theCodeCat
Mon Jul 11, 2016 12:27 am
Forum: Ren'Py Questions and Announcements
Topic: Problem with cache and sound
Replies: 4
Views: 268

Re: Problem with cache and sound

I think it might work if you move the "renpy.sound.play("sound/effects/shock2.ogg")" line into the __init__ function of the 'Shaker' class.
So something like:

Code: Select all

def __init__(self, start, child, dist):
    renpy.sound.play("sound/effects/shock2.ogg")
    <rest of code>
by theCodeCat
Sun Jul 10, 2016 6:02 pm
Forum: Ren'Py Questions and Announcements
Topic: Problem with cache and sound
Replies: 4
Views: 268

Re: Problem with cache and sound

Can you show the code for how you added the sound effect to 'Shake'?

You might have added it in such a way that the sound is triggered when the object is created, and not necessarily when the visual effect is executed.
by theCodeCat
Sat Jul 09, 2016 1:07 am
Forum: Ren'Py Questions and Announcements
Topic: creating a next page function
Replies: 6
Views: 943

Re: creating a next page function

I actually don't have much experience working with set objects in python, but it looks like the set class doesn't have an "items" property, so chest.items is meaningless. At any rate, the screen code I gave assumes its been given a list and I would recommend using a list structure anyways since it a...
by theCodeCat
Fri Jul 08, 2016 6:33 pm
Forum: Ren'Py Questions and Announcements
Topic: creating a next page function
Replies: 6
Views: 943

Re: creating a next page function

I would suggest something like this: screen shop(itemList,page=0): python: # Ideally the total number of pages should be calculated based off of # the number if items in the itemList, but to keep this simple I've hardcoded # the page count totalPages = 4 # Grabs which items should be displayed on th...
by theCodeCat
Tue Jul 05, 2016 5:26 pm
Forum: Ren'Py Questions and Announcements
Topic: Fix Code?
Replies: 3
Views: 311

Re: Fix Code?

A simple improvement would be to change your If/else statements a little bit. # Instead of if result == "Group 1" and group1 == False: jump Group1v1 elif result == "Group 1" and group1 == True: jump Group1v2 # I would write if result == "Group 1": if group1 == False: jump Group1v1 else: jump Group1v...
by theCodeCat
Mon Jul 04, 2016 8:50 pm
Forum: Ren'Py Questions and Announcements
Topic: Would it be the best idea to update code?
Replies: 6
Views: 271

Re: Would it be the best idea to update code?

The reason I think it's likely negligible is because creating a new style is likely a one-time occurrence that happens during the game's initialization, and it probably takes less than 1/100th of a second even when done inefficiently. Given those time estimates, even if this new style made the creat...