Search found 13 matches

by jdlang
Wed Feb 19, 2020 3:50 pm
Forum: Ren'Py Questions and Announcements
Topic: Making Python take an argument or string as a variable name
Replies: 12
Views: 1054

Re: Making Python take an argument or string as a variable name

# Cell object definition default cell_A = Cell(objects=[], characters=[], exits=[]) # call the function with cell_A as parameter $ chars, objs, exits = xnode_prep(cell_A) Yup, that works. Wish the other approaches did as well, but oh well. Thank you all for your help! Let's hope I don't get stuck l...
by jdlang
Tue Feb 18, 2020 11:31 am
Forum: Ren'Py Questions and Announcements
Topic: Making Python take an argument or string as a variable name
Replies: 12
Views: 1054

Re: Making Python take an argument or string as a variable name

Well. Your suggested solution worked for the nested dictionary, but not for objects. I've defined a class Cell, with two instances for test purposes. Neither of these works: def xnode_prep(c): x = getattr(c, "objects") y = getattr(c, "characters") z = getattr(c, "exits"...
by jdlang
Tue Feb 18, 2020 6:37 am
Forum: Ren'Py Questions and Announcements
Topic: Making Python take an argument or string as a variable name
Replies: 12
Views: 1054

Re: Making Python take an argument or string as a variable name

You can't do it. The called iterator go crazy. Try this: def myfunc(c): x = cells[c]["characters"] y = cells[c]["objects"] z = cells[c]["whatever"] return x, y, z $ chara, obj, what = myfunc("a") That works! Thank you so much! Just out of curiosity, why does ...
by jdlang
Sun Feb 16, 2020 9:42 am
Forum: Ren'Py Questions and Announcements
Topic: Making Python take an argument or string as a variable name
Replies: 12
Views: 1054

Re: Making Python take an argument or string as a variable name

How and where are the player_locations variables defined? And how are you checking if they are being updated? I have a separate .rpy to set defaults for world state variables, in which I have defined them as lists with several items for test purposes. The items on these lists are correctly displaye...
by jdlang
Sun Feb 16, 2020 8:58 am
Forum: Ren'Py Questions and Announcements
Topic: Making Python take an argument or string as a variable name
Replies: 12
Views: 1054

Re: Making Python take an argument or string as a variable name

As for your original question, I still don't quite understand what are you trying to do or why python isn't doing what you want. You should at least show us the problematic section of your code so we can figure out what is wrong. Alright, here's a snippet of code. I hope that makes it clearer. init...
by jdlang
Sun Feb 16, 2020 7:06 am
Forum: Ren'Py Questions and Announcements
Topic: Making Python take an argument or string as a variable name
Replies: 12
Views: 1054

Re: Making Python take an argument or string as a variable name

I don't have a completely clear view of what exactly you are doing, but maybe put all of the dictionaries into a class and then have the class do the accessing and modifying? That would probably be somewhat more elegant generally, but it wouldn't solve my problem. Actually, I've already thought abo...
by jdlang
Sat Feb 15, 2020 12:43 pm
Forum: Ren'Py Questions and Announcements
Topic: Making Python take an argument or string as a variable name
Replies: 12
Views: 1054

Making Python take an argument or string as a variable name

Hey guys! I want to do something that should be very simple, but Python isn't having it. There has to be an easy solution, but ~8 hours of internet searches haven't turned it up, and this is slowly driving me crazy. Please help me! I'm making a turn-based game, where every minute is one turn. In ord...
by jdlang
Sun Mar 26, 2017 9:06 am
Forum: Ren'Py Questions and Announcements
Topic: [SOLVED] Text-based interaction: can't get screens to work
Replies: 1
Views: 2126

Re: Text-based interaction: can't get screens to work

Alright! After a lot of trial and error, I've gotten it to work. Lesson learned: if possible, try writing code from scratch instead of copypasting code written by someone who (unlike me) knows what they're doing. I'll post the code for anyone with a similar problem, but I still have a question. Ther...
by jdlang
Fri Mar 24, 2017 9:17 pm
Forum: Ren'Py Questions and Announcements
Topic: Optimising gui.nvl for different sized text entries
Replies: 6
Views: 1224

Re: Optimising gui.nvl for different sized text entries

Several lines of text should easily fit in an nvl window. You could try writing an example part, see how many entries you can have before you need a clear, and then adjust config.nvl_list_length accordingly. One advantage of using list length instead of manual clears is that it scrolls text up (thou...
by jdlang
Fri Mar 24, 2017 3:53 pm
Forum: Ren'Py Questions and Announcements
Topic: [SOLVED] Text-based interaction: can't get screens to work
Replies: 1
Views: 2126

[SOLVED] Text-based interaction: can't get screens to work

I'm trying to make an interface for text-based interaction with the player's environment. It's supposed to show the scene's background and scrollable text boxes with textbuttons representing all NPCs and objects players can interact with, jumping to the appropriate label when clicked. I want to keep...
by jdlang
Thu Mar 23, 2017 5:13 pm
Forum: Ren'Py Questions and Announcements
Topic: Disabling/Enabling Menu Items/Options
Replies: 17
Views: 3985

Re: Disabling/Enabling Menu Items/Options

Nice, working perfectly. Thanks so much!
by jdlang
Thu Mar 23, 2017 4:17 pm
Forum: Ren'Py Questions and Announcements
Topic: Disabling/Enabling Menu Items/Options
Replies: 17
Views: 3985

Re: Disabling/Enabling Menu Items/Options

Necroing because this solution isn't compatible with the current version of screens.rpy. I've tried some things, but it's been unresponsive so far. Anyone got an idea?
by jdlang
Wed Mar 22, 2017 3:46 pm
Forum: Ren'Py Questions and Announcements
Topic: Transforms inside AlphaMasks won't stay centered
Replies: 1
Views: 541

Transforms inside AlphaMasks won't stay centered

Hi guys! Coding noob here, sorry. I'm trying to make a dynamic kaleidoscope background using one source image and twelve masking images. The way it's supposed to work: AlphaMasks form 6 pairs of 2 equal triangles each, positioned and rotated to form a hexagon. Inside these AlphaMasks, images perform...