Too many arguments in call

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
User avatar
Weiss-
Newbie
Posts: 6
Joined: Wed Jan 03, 2018 12:45 am
Projects: Over the Starlit Sky
Location: Philippines
Contact:

Too many arguments in call

#1 Post by Weiss- » Thu Feb 22, 2018 11:11 pm

Hello again,
I'm trying to make a scrollable text to put lessons in it.

But when I enter this code:

Code: Select all

label showlesson(lesson=None, paper=None):
    if lesson == None:
        return
    window hide

    if paper:
        show screen lessons(lesson, paper=paper)
    else:
        show screen lessons(lesson)

    window auto
    return
it gave me this error:

Code: Select all

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/script.rpy", line 12, in script call
    call ch01
  File "game/ch01.rpy", line 103, in script
    h "So, Are you Excited?"
Exception: Too many arguments in call (expected 0, got 1).

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

Full traceback:
  File "game/script.rpy", line 12, in script call
    call ch01
  File "game/ch01.rpy", line 103, in script
    h "So, Excited ka na ba?"
  File "C:\Programs\renpy-6.99.14-sdk\renpy\ast.py", line 643, in execute
    renpy.exports.say(who, what, interact=self.interact, *args, **kwargs)
  File "C:\Programs\renpy-6.99.14-sdk\renpy\exports.py", line 1175, in say
    who(what, *args, **kwargs)
  File "C:\Programs\renpy-6.99.14-sdk\renpy\character.py", line 1013, in __call__
    self.do_display(who, what, cb_args=self.cb_args, **display_args)
  File "C:\Programs\renpy-6.99.14-sdk\renpy\character.py", line 817, in do_display
    **display_args)
  File "C:\Programs\renpy-6.99.14-sdk\renpy\character.py", line 566, in display_say
    rv = renpy.ui.interact(mouse='say', type=type, roll_forward=roll_forward)
  File "C:\Programs\renpy-6.99.14-sdk\renpy\ui.py", line 287, in interact
    rv = renpy.game.interface.interact(roll_forward=roll_forward, **kwargs)
  File "C:\Programs\renpy-6.99.14-sdk\renpy\display\core.py", line 2620, in interact
    repeat, rv = self.interact_core(preloads=preloads, trans_pause=trans_pause, **kwargs)
  File "C:\Programs\renpy-6.99.14-sdk\renpy\display\core.py", line 2925, in interact_core
    root_widget.visit_all(lambda i : i.per_interact())
  File "C:\Programs\renpy-6.99.14-sdk\renpy\display\core.py", line 511, in visit_all
    d.visit_all(callback)
  File "C:\Programs\renpy-6.99.14-sdk\renpy\display\core.py", line 511, in visit_all
    d.visit_all(callback)
  File "C:\Programs\renpy-6.99.14-sdk\renpy\display\core.py", line 511, in visit_all
    d.visit_all(callback)
  File "C:\Programs\renpy-6.99.14-sdk\renpy\display\screen.py", line 401, in visit_all
    callback(self)
  File "C:\Programs\renpy-6.99.14-sdk\renpy\display\core.py", line 2925, in <lambda>
    root_widget.visit_all(lambda i : i.per_interact())
  File "C:\Programs\renpy-6.99.14-sdk\renpy\display\screen.py", line 411, in per_interact
    self.update()
  File "C:\Programs\renpy-6.99.14-sdk\renpy\display\screen.py", line 592, in update
    self.screen.function(**self.scope)
  File "C:\Programs\renpy-6.99.14-sdk\renpy\ast.py", line 152, in apply_arguments
    return parameters.apply(args, kwargs, ignore_errors)
  File "C:\Programs\renpy-6.99.14-sdk\renpy\ast.py", line 134, in apply
    raise Exception("Too many arguments in call (expected %d, got %d)." % (len(self.positional), len(args)))
Exception: Too many arguments in call (expected 0, got 1).

Windows-8-6.2.9200
Ren'Py 6.99.14.3135
Over the Starlit Sky 1.1
Here's the full code:

Code: Select all

init python:
    class Lesson:
        def __init__(self, text=""):
            self.text = text

    lesson_h1 = Lesson(
        text = """\
Lorem ipsum dolor sit amet, consectetur adipiscing elit. In eget lorem consequat, aliquet quam sit amet, 
viverra quam. Praesent tincidunt erat tincidunt feugiat faucibus. 
Aliquam dictum nibh sit amet dolor pretium maximus. 
Duis scelerisque, est et pharetra tincidunt, arcu dolor aliquam urna, eget efficitur neque erat id nunc. 
Mauris ac ultrices nibh. 
Aliquam interdum est augue, non rhoncus ante finibus vel. 
Cras dictum suscipit libero vitae convallis. 
Aliquam at tellus ornare, semper magna non, pellentesque nulla. 
Proin finibus est iaculis eros condimentum rhoncus. 
Mauris elementum maximus est, non auctor felis ultricies et. 
Curabitur id auctor ante, ac rutrum velit. Nulla elementum eget purus eget pharetra. 
Nulla quis suscipit erat. 
Nunc accumsan a ante vel finibus. In hac habitasse platea dictumst. 
Sed viverra odio sed fermentum molestie.\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nYeah scrolling works"""
        )



image paper = "images/paper.jpg"

transform paper_in:
    truecenter
    alpha 0
    linear 1.0 alpha 1

transform paper_out:
    alpha 1
    linear 1.0 alpha 0


screen lessons():
    vbox:
        add paper
    viewport id "vp":
        child_size (710, None)
        mousewheel True
        draggable True
        has vbox
        null height 40


    vbar value YScrollValue(viewport="vp") style "lesson_vbar"




style lesson_vbox:
    xalign 0.5
style lesson_viewport:
    xanchor 0
    xsize 720
    xpos 280
style lesson_vbar is vscrollbar:
    xpos 1000
    yalign 0.5

    ysize 700

style lesson_text:
    font "gui/font/Aller_Rg.ttf"
    size 32
    color "#000"
    outlines []


label showlesson(lesson=None, paper=None):
    if lesson == None:
        return
    window hide

    if paper:
        show screen lessons(lesson, paper=paper)
    else:
        show screen lessons(lesson)

    window auto
    return
Any help will be appreciated. Sorry again,for my bad english :c Thanks in Advanced :D

irredeemable
Regular
Posts: 78
Joined: Thu Feb 08, 2018 7:57 am
Contact:

Re: Too many arguments in call

#2 Post by irredeemable » Thu Feb 22, 2018 11:17 pm

You need to add a parameter to your screen definition.

Code: Select all

screen lessons(paper):
(or remove the argument from your show screen statement if you are intending to use the global variable).

User avatar
Weiss-
Newbie
Posts: 6
Joined: Wed Jan 03, 2018 12:45 am
Projects: Over the Starlit Sky
Location: Philippines
Contact:

Re: Too many arguments in call

#3 Post by Weiss- » Fri Feb 23, 2018 4:37 am

irredeemable wrote:
Thu Feb 22, 2018 11:17 pm
You need to add a parameter to your screen definition.

Code: Select all

screen lessons(paper):
(or remove the argument from your show screen statement if you are intending to use the global variable).
Thank you very much for the quick reply! I added a parameter and it now works! Thanks!!!

Post Reply

Who is online

Users browsing this forum: No registered users