VBPXKSMI / Open-CYOAI-Project

Colab frontend to play the different modded versions of AI Dungeon 2. Also main Wiki of the game with info gathered from 4chan's Anons.
GNU Affero General Public License v3.0
66 stars 6 forks source link

halp! #172

Closed machiavel23 closed 4 years ago

machiavel23 commented 4 years ago

So, the Customizator is currently stucked in the dev hell. Most of the ui works (except a tab glitched caused by google not fully supporting widgets but it's irrelevant for now), but there's ONE fucking huge problem I just don't understand

Take a look here https://colab.research.google.com/github/VBPXKSMI/Open-CYOAI-Project/blob/beta/dev_customizator.ipynb

The first cell is not really useful, it's just a paste of the main cell to have the customization code near my hand.

The important cell is the second one, it's where the customizator is.

Actually, clicking on the validate button, bottom left, is supposed to set the variables to what you selected (which apparently work according to some print() ), then call another function ( previewer() ), to show you an output built the same way the drawfag cell is built (drawfag cell works).

However, for some fucking reason, previewer() raise a KeyError.

If anybody is brave enough to lurk at this and help, I'll appreciate.

apparently, KeyError is because it doesn't found the called variable.

Rioghasarig commented 4 years ago

I think you have to escape the brackets of the CSS code (i.e. you should write {{ }} (not { }) ) . Python thinks that they're the inputs of the string format.

Edit: I was wrong. The proper way to escape braces in python string formats is with double braces not a backslash.

machiavel23 commented 4 years ago

makes sense. will try. meanwhile question

why doesn't it raise th eerror at the first var then?

Rioghasarig commented 4 years ago

I think there may be a misunderstanding here. You need the double braces for braces that are supposed to be part of the CSS code. NOT for the braces that are referencing the inputs of the format string (like {0}). For instance, you should write

html {{
    --font-render: {2};
     --font-inputbox: {3};
    }}

for the html part of the CSS code. Similarly for the others.

It raised the error at the first improper use of the braces.

machiavel23 commented 4 years ago

hmmm ok. considering 0 and 1 are actual strings, it makes sense. Thanks!

machiavel23 commented 4 years ago

It apparently solved the issue, I managed to go further in the script before next error (an eoferror on the input...)

Thx for the hand mate!

Rioghasarig commented 4 years ago

hmmm ok. considering 0 and 1 are actual strings, it makes sense. Thanks!

It has nothing to do with the fact that 0 and 1 are strings. You'd get the same result even if they weren't strings.