[SOLVED] define, default, $ xxx =

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
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.
Post Reply
Message
Author
felsenstern
Regular
Posts: 72
Joined: Tue Jul 11, 2017 2:13 am
Contact:

[SOLVED] define, default, $ xxx =

#1 Post by felsenstern »

Hiya,

what is the difference between:

define bob = "bob the builder"
and
$ bob = "bob the builder"

or

define kate = Character("kate"...)
and
$ kate = Character("kate"...)
? is there any explanation when to use what or if there is something behind define that $ = doesn't do, or the other way around? Must say for all the time I use Renpy until one or two months ago, I didn't even had the idea that "define bob = Character("bob"...)" would just put a class reference into the bob variable, I just knew that I could use bob afterwards as a say command imagining that define would do something more...
Last edited by felsenstern on Sun Dec 26, 2021 4:51 am, edited 1 time in total.
---
Yes, I've Read The F*cking Manual
Yes, I've used the f*cking search function
Yes, I've used a site search
No, I don't need a reminder that search functions exist
No, I don't need your astonished outbreak that I couldn't find the information
No, I don't need your answer if you can't just give it without all the BS around it

User avatar
Ocelot
Lemma-Class Veteran
Posts: 2434
Joined: Tue Aug 23, 2016 10:35 am
Github: MiiNiPaa
Discord: MiiNiPaa#4384
Contact:

Re: define, default, $ xxx =

#2 Post by Ocelot »

Did you read documentation?
https://www.renpy.org/doc/html/python.html

define x = y is completely equivalent to

Code: Select all

init python:
    x = y
# or
init:
    $ x = y
And should be used for variables you don't change during the game

default is more complex, one main difference is that defaulted variables are always saved, so it solves some problems with saving of complex objects.
< < insert Rick Cook quote here > >

felsenstern
Regular
Posts: 72
Joined: Tue Jul 11, 2017 2:13 am
Contact:

Re: define, default, $ xxx =

#3 Post by felsenstern »

I read the documentation and more than once, but why would I find "Statement Equivalents" not on the page that was named so but on a page named "Python Statements" that I would consider having a Reference of Python Statements valid inside of Ren'py eludes my very simple mind. Not to forget that variable definition would be the first thing you would learn in any other language. So any sane person would expect to learn on how to set a variable up in the earliest and most basic part of a documentation. Here instead we learn about $ bob = ... and define bob = ... without any word that both things are doing the same or what define is really doing. But thanks anyway I wouldn't have found it on my own.
---
Yes, I've Read The F*cking Manual
Yes, I've used the f*cking search function
Yes, I've used a site search
No, I don't need a reminder that search functions exist
No, I don't need your astonished outbreak that I couldn't find the information
No, I don't need your answer if you can't just give it without all the BS around it

User avatar
Ocelot
Lemma-Class Veteran
Posts: 2434
Joined: Tue Aug 23, 2016 10:35 am
Github: MiiNiPaa
Discord: MiiNiPaa#4384
Contact:

Re: define, default, $ xxx =

#4 Post by Ocelot »

felsenstern wrote: Sun Dec 26, 2021 4:50 am Not to forget that variable definition would be the first thing you would learn in any other language. So any sane person would expect to learn on how to set a variable up in the earliest and most basic part of a documentation. Here instead we learn about $ bob = ... and define bob = ... without any word that both things are doing the same or what define is really doing.
The variable definition is technically in quickstart documentation, which is the first thing you read.
Knowledge that "define is for characters, default for flags/counters/other variables declaration and $ x is for ingame changes" is enough for majority of games made in RenPy. In-depth knowledge of what it is doing is needed if you are going to heavily rely on Python, in which case you would have to read whole Python chapter of documentation. If you just want to know for sake of curiosity, documentation search (or using keyword reference page in documentation) usually works well.
< < insert Rick Cook quote here > >

felsenstern
Regular
Posts: 72
Joined: Tue Jul 11, 2017 2:13 am
Contact:

Re: [SOLVED] define, default, $ xxx =

#5 Post by felsenstern »

Yes, there are many ways to search, many ways to spend time just to search for one information that could have been provided in just a few words or even lines and in so many cases. Ren'Py is full of it and everyone who learned Ren'Py is aware of this crap so what are we talking about? How many developers jumped ship and starting over in Unity, not because they would use any 3D-Function there, no - same 2D game but with less digging and searching for the next command for the next understanding how to use a simple command, that yeah is anyway so obvious to use, why waste a word or line more to make things clear, when you can have fun with those people begging on the Newbie forum again and again, to get another bit and always with the RTFM comment... thank you very much!
---
Yes, I've Read The F*cking Manual
Yes, I've used the f*cking search function
Yes, I've used a site search
No, I don't need a reminder that search functions exist
No, I don't need your astonished outbreak that I couldn't find the information
No, I don't need your answer if you can't just give it without all the BS around it

Post Reply

Who is online

Users browsing this forum: Amazon [Bot], Semrush [Bot]