Search found 322 matches

by henvu50
Tue Nov 06, 2018 12:31 am
Forum: Ren'Py Questions and Announcements
Topic: How do I use & declare variables without the $ symbol?
Replies: 17
Views: 1330

Re: How do I use & declare variables without the $ symbol?

Guys, it turns out that variables declared with $ can be changed & saved.

I declared the following variable in a label:

Code: Select all


label testA:

    $ stats_test1 = 55   

I was able to change stats_test1 to 99, save the game and when I reloaded the variable retained the change to the value of 99.
by henvu50
Tue Nov 06, 2018 12:21 am
Forum: Ren'Py Questions and Announcements
Topic: How do I use & declare variables without the $ symbol?
Replies: 17
Views: 1330

Re: How do I use & declare variables without the $ symbol?

trooper6 wrote:
Tue Nov 06, 2018 12:18 am
How are you changing the variable?
I was using setvariable.

I figured it out. I have to use $ renpy.retain_after_load()
by henvu50
Tue Nov 06, 2018 12:19 am
Forum: Ren'Py Questions and Announcements
Topic: default declared variable not being saved after being changed.
Replies: 5
Views: 341

Re: default declared variable not being saved after being changed.

Okay, I had to add this one line of code and now it works: default test_var = 52 screen test_screen: # add this to make sure changes are saved on a character skills menu for example $ renpy.retain_after_load() $print (test_var) vbox: textbutton "test": action Return(1) hovered (SetVariable("test_var...
by henvu50
Tue Nov 06, 2018 12:08 am
Forum: Ren'Py Questions and Announcements
Topic: How do I use & declare variables without the $ symbol?
Replies: 17
Views: 1330

Re: How do I use & declare variables without the $ symbol?

It turns out you have to progress the game forward a little bit in order to get the changed variable to actually save. Renpy only does the save when the screen first loads. So if you have a character stat window, change strength from 50 to 60, that change won't save unless you progress the game forw...
by henvu50
Tue Nov 06, 2018 12:04 am
Forum: Ren'Py Questions and Announcements
Topic: default declared variable not being saved after being changed.
Replies: 5
Views: 341

Re: default declared variable not being saved after being changed.

Weird, I actually had to progress the game forward a little, then perform a save, now the stat gets saved. So if a player changes a stat in a screen, they have to skip a line of dialogue before the stats will get saved? That doesn't make sense. Let's say you have a character stat window. You change ...
by henvu50
Mon Nov 05, 2018 11:47 pm
Forum: Ren'Py Questions and Announcements
Topic: default declared variable not being saved after being changed.
Replies: 5
Views: 341

default declared variable not being saved after being changed.

I set the variable to 99 when the mouse hovers over the textbutton. I check console using Shift O to ensure the variable changed from 52 to 99. I save my game and reload. The value goes back to the default of 52? Why won't the new value of 99 get saved? default test_var = 52 screen test_screen: $pri...
by henvu50
Mon Nov 05, 2018 11:13 pm
Forum: Ren'Py Questions and Announcements
Topic: How do I use & declare variables without the $ symbol?
Replies: 17
Views: 1330

Re: How do I use & declare variables without the $ symbol?

It's not working.

I'm using default declared variable, then I change it's value & save, but the change doesn't get saved, it reverts to the default value.
by henvu50
Mon Nov 05, 2018 1:34 pm
Forum: Ren'Py Questions and Announcements
Topic: How do I use & declare variables without the $ symbol?
Replies: 17
Views: 1330

Re: How do I use & declare variables without the $ symbol?

trooper6 wrote:
Mon Nov 05, 2018 11:20 am
Yes it is bad.

Variables should be declared outside of any label using default if that variable will change (the most common situation) or define if the variable will not change.

Code: Select all

default color = “red”

label start:
    “Today my shirt is [red]”
Why is using $ everywhere bad though?
by henvu50
Mon Nov 05, 2018 8:12 am
Forum: Ren'Py Questions and Announcements
Topic: How do I use & declare variables without the $ symbol?
Replies: 17
Views: 1330

Re: How do I use & declare variables without the $ symbol?

I still can't get my head around define or default. I'm currently using $ for everything, is that bad?
by henvu50
Mon Nov 05, 2018 8:11 am
Forum: Ren'Py Questions and Announcements
Topic: How to use a label like a function?
Replies: 4
Views: 322

Re: How to use a label like a function?

Everything is working now. I had two minor errors at the same time.

I need coffee!

Thanks for your help.
by henvu50
Mon Nov 05, 2018 7:59 am
Forum: Ren'Py Questions and Announcements
Topic: How to use a label like a function?
Replies: 4
Views: 322

Re: How to use a label like a function?

The following code:

Code: Select all

$ globalVariable = testFunc(87)
results in the error:

Code: Select all

TypeError: testFunc() takes no arguments (1 given)
It seems I can't have the word "return" in a function name, so this is solved.
by henvu50
Mon Nov 05, 2018 7:58 am
Forum: Ren'Py Questions and Announcements
Topic: Why does my custom function only return the name of the function?
Replies: 3
Views: 206

Re: Why does my custom function only return the name of the function?

I want it to return the string "wtf", I can't even get it to return a simple string. It instead returns the name of the function.
by henvu50
Mon Nov 05, 2018 7:41 am
Forum: Ren'Py Questions and Announcements
Topic: How to use a label like a function?
Replies: 4
Views: 322

Re: How to use a label like a function?

Okay, I switched to python function, but the string value returned from the function always results in the name of the function, not the actual return value. Do you know why it's doing that? Instead of returning "wtf", it returns the name of the function: <function testFunc at 0x08390938> It doesn't...