She’s waiting… ready to tease you LIVE — come play. Join Now!
x

Problem: Warping to line

petertavy

Member
Aug 21, 2020
108
21
86
Trying to do a warp to line. Manual says:

Code:
   renpy.warp_to_line(warp_spec)
When I type this into a .rpy file I get a mysterious error:

View attachment traceback.txt

I tried many variations on that command, also typing them into the console,
& got many other errors, all mysterious. Eventually I think I have found
something that works (sometimes): In a .rpy file:

Code:
            $ warp_spec = "script.rpy:200"
            $ renpy.warp.warp_spec = warp_spec
            $ renpy.warp.warp()
Please is there a less messy way to do this?
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
12,777
21,014
1,026
Trying to do a warp to line. Manual says:

Code:
   renpy.warp_to_line(warp_spec)
When I type this into a .rpy file I get a mysterious error:
It's because you did two errors, writing the line like renpy.warp_to_line "script.rpy:100".

The first error is that you used Python code without telling it to Ren'Py:
" "

The second error is that you didn't called the function, just addressing it and addressing another value. As shown by the doc, to call a function the syntax is functionName( arguments ), with the parenthesis.

Therefore, you should have written $ renpy.wrap_to_line( "script.rpy:100" )

As for the error itself:
Code:
  File "C:\Users\john\Downloads\Ring of Lust [v0.6.1a]\Altered\renpy\exports.py", line 1373, in say
    who(what, *args, **kwargs)
TypeError: warp_to_line() got an unexpected keyword argument 'interact'
Due to the wrong syntax (something quoted_string) Ren'Py understand this as a dialog line (sayer dialog) and obviously it didn't ended well at all.


Eventually I think I have found something that works (sometimes): In a .rpy file:
I'll not go into the details, but the sometimes is due to the way Ren'Py deal with the code once in memory. For the command to works you must know precisely where you want to end and what is at this line.


Please is there a less messy way to do this?
Surely, but without knowing what "this" is, it will be difficult to answer.

The renpy.warp_to_line() function is for developers, in order to facilitate their debugging sessions.
Like by example when they want to test a change in a label, but the change happen in the middle of it. Skipping already seen lines wouldn't stop where the change happened (unless the change the dialog line every single time), while passing the line by line would need times lost uselessly. So there's this function, that make them jump directly into the line they want, and therefore directly test the change.
But there's really near to no use outside of this.
 
  • Like
Reactions: Mattock

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
12,777
21,014
1,026
Did... did homeboy just invent GOTO spaghetti all over again?
Well, technically it can serve for that, but with the addition of local labels it became totally useless.

Python:
label main:
    [...]
    if something:
        jump .whatever
    [...]
    label .whatever:
        [...]

label anotherOne:
    [...]
    jump main.whatever