trying to make a task list

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
rayminator
Miko-Class Veteran
Posts: 754
Joined: Fri Feb 09, 2018 12:05 am
Location: Canada
Contact:

trying to make a task list

#1 Post by rayminator » Wed Aug 11, 2021 2:30 am

trying to make a task list so player can keep track on what todo but getting a error


here is my code

Code: Select all

init python:
    import renpy.store as store
    import renpy.exports as renpy

    class Task(store.object):
        list = []
        def __init__(self, name):
            self.name = name
            self.done = False
            self.fail = False
            self.on = False
            self.get = False
            Task.list.append(self)

label tasks_list:
    python:
        learn_admission = Task(_("Learn about college admission"))
        learn_massage = Task(_("Learn how to do a massage"))
        TASK = Task.list

label after_load:
    python:
        TASK = [learn_admission,
            learn_massage]

label addtsk(task):
    if task.get:
        $ task.on = True
        $ task.get = True
        tip "[ntsk!t][tsk.name!t][col]" with dissolve
    return


Code: Select all

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/core/script.rpy", line 61, in script call
    call addtsk (learn_admission)
  File "game/core/task_core.rpy", line 25, in script call
    label addtsk(task):
  File "game/core/task_core.rpy", line 25, in script
    label addtsk(task):
Exception: Required parameter task has no value.

-- Full Traceback ------------------------------------------------------------

Full traceback:
  File "game/core/script.rpy", line 61, in script call
    call addtsk (learn_admission)
  File "game/core/task_core.rpy", line 25, in script call
    label addtsk(task):
  File "game/core/task_core.rpy", line 25, in script
    label addtsk(task):
  File "R:\renpy\renpy-7.4.6-sdk/renpy/ast.py", line 864, in execute
    values = apply_arguments(self.parameters, renpy.store._args, renpy.store._kwargs)
  File "R:\renpy\renpy-7.4.6-sdk/renpy/ast.py", line 159, in apply_arguments
    return parameters.apply(args, kwargs, ignore_errors)
  File "R:\renpy\renpy-7.4.6-sdk/renpy/ast.py", line 123, in apply
    raise Exception("Required parameter %s has no value." % name)
Exception: Required parameter task has no value.

Windows-10-10.0.19041
Ren'Py 7.4.8.1895
Progerialust_Family V1
Wed Aug 11 02:27:02 2021

User avatar
hell_oh_world
Miko-Class Veteran
Posts: 777
Joined: Fri Jul 12, 2019 5:21 am
Projects: The Button Man
Organization: NILA
Github: hell-oh-world
Location: Philippines
Contact:

Re: trying to make a task list

#2 Post by hell_oh_world » Wed Aug 11, 2021 3:12 am

i dont see the error in here, maybe we can see more of the code? at the part where you called the label?
in the meantime, you could try to add default values to the parameter.

Code: Select all

label addtsk(task=None):
  if task is not None and task.get:
    ...

rayminator
Miko-Class Veteran
Posts: 754
Joined: Fri Feb 09, 2018 12:05 am
Location: Canada
Contact:

Re: trying to make a task list

#3 Post by rayminator » Wed Aug 11, 2021 3:35 am

here the start label with call addtsk (learn_admission)

Code: Select all

label start:
    call girls_list
    $ day = 1
    $ ds = 1
    $ dtime = 1
    show screen phone
    play music "audio/BGM001.ogg"
    scene david with dissolve
    dd "Hello My name is David..."
    dd "I am [david_age] Years Old."
    $ got_msg += 1    
    dd "I work at the family Spa and at the Library downtown."
    scene anna with dissolve
    call addtsk (learn_admission)
    $ anna.show = True
    $ love(anna,2)

rayminator
Miko-Class Veteran
Posts: 754
Joined: Fri Feb 09, 2018 12:05 am
Location: Canada
Contact:

Re: trying to make a task list

#4 Post by rayminator » Wed Aug 11, 2021 4:00 am

it's working fine for now
screenshot0005.png

Post Reply

Who is online

Users browsing this forum: No registered users