How to make lint use 'default' variables.

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
Victorius
Regular
Posts: 30
Joined: Thu Jan 14, 2021 7:02 pm
Projects: Astral Lust
Github: Victorius-Astral
Contact:

How to make lint use 'default' variables.

#1 Post by Victorius »

Hey!

I wanted to check through lint some evals, but they use values that are defined with `default variable = 1`, the thing is that objects defined that way can't be seen by lint, I've tried running said lint function in main menu before starting game, and it worked correctly, but in lint it doesn't work. All `default` variables are non existent for it, is there a way to change it?

I would be grateful for any guidance.

Said lint function:

Code: Select all

init python:

    # Check if event list checks can be evaluated
    def lint_event_list_checks():
        global list_of_events

        for ev in list_of_events:

            # General check
            if ev[1] != None:
                try:
                    eval(ev[1])

                except:
                    print("Error running event list check! (general check), category: "\
                    + str(ev[0]) \
                    + " | category index: " \
                    + str(list_of_events.index(ev)))

            for ev_s in ev[2]:

                # Complex variant
                if isinstance(ev_s[0], list):

                    for ev_c in ev_s:

                        try:
                            eval(ev_c[1])

                        except:
                            print("Error running event list check! (complex check), category: " \
                                + str(ev[0]) \
                                + " | category index: " \
                                + str(list_of_events.index(ev)) \
                                + " | complex list index: " \
                                + str(ev[2].index(ev_s)) \
                                + " | item index: " \
                                + str(ev_s.index(ev_c)))


                # Simple variant
                else:

                    try:
                        eval(ev_s[1])

                    except:
                        print("Error running event list check! (simple check), category: " \
                            + str(ev[0]) \
                            + " | category index: " \
                            + str(list_of_events.index(ev)) \
                            + " | item index: " \
                            + str(ev[2].index(ev_s)))
        return

    config.lint_hooks.append(lint_event_list_checks)

Victorius
Regular
Posts: 30
Joined: Thu Jan 14, 2021 7:02 pm
Projects: Astral Lust
Github: Victorius-Astral
Contact:

Re: How to make lint use 'default' variables.

#2 Post by Victorius »

I've did something that achieves my needs, but I would still prefer to make lint work with default. I did:

Code: Select all

init offset = -1

define my_lint = []

init python:
    def mylint():
        global my_lint

        for x in my_lint:
            x()

        return

I then can run mylint() in console. I've appended my lint functions to my_lint.

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot]