Thanks for your time and your reply. I've added the clockhand_dragged function as a property now:
Code: Select all
screen clock:
add "clock_screen.png"
draggroup:
drag:
drag_name "clockhand"
child "clockhand.png"
dragged "clockhand_dragged" # <---------here
droppable False
draggable True
xpos 100 ypos 100
drag:
drag_name "destination"
child "clockhand.png" #"circle2.png"
draggable False
droppable True
xpos 880 ypos 633
Now it seems to be snapping but I am getting an error:
Code: Select all
I'm sorry, but an uncaught exception occurred.
While running game code:
File "game/aesop script.rpy", line 361, in script
t "blah blah blah"
File "renpy/common/000statements.rpy", line 519, in execute_call_screen
store._return = renpy.call_screen(name, *args, **kwargs)
TypeError: 'unicode' object is not callable
Line 361 is the line before the screen clock is called. I'm guessing it is because it is not terminating the screen properly and the screen has nothing to do now?
Update: actually, I have tried a few more times, and I get the error no matter where I drop the dragged object, not just if I drop it on the destination. :/
Full traceback below.
Tried changing the python code a few different times:
Code: Select all
init python:
def clockhand_dragged(drags, drop):
if drop:
return
Code: Select all
init python:
def clockhand_dragged(drags, drop):
if not drop:
return
store.clockhand_dragged = drags[0].drag_name
return True
Code: Select all
init python:
def clockhand_dragged(drags, drop):
if drop:
drags[0].snap(drop.x,drop.y)
return
Code: Select all
init python:
def clockhand_dragged(drags, drop):
if drop:
drags[0].snap(drop.x,drop.y)
renpy.jump ('afterclock')
No success. The detectives example wants to store those values and use them in text. Here I just want the player to drag the piece to the only possible destination. Any idea what this true statement might look like? Does it actually need return true or is return sufficient in this case (since there is only one possible answer and no wrong answers)?
Perhaps at a later stage similar screens might want to drag to the correct destination or their might be multiple pieces (only one correct). But I suppose I better not get ahead of myself.
Thanks for your time!
Code: Select all
I'm sorry, but an uncaught exception occurred.
While running game code:
File "game/test script.rpy", line 361, in script
t "blah"
File "renpy/common/000statements.rpy", line 519, in execute_call_screen
store._return = renpy.call_screen(name, *args, **kwargs)
TypeError: 'unicode' object is not callable
-- Full Traceback ------------------------------------------------------------
Full traceback:
File "game/test script.rpy", line 361, in script
t "blah"
File "X:\games\renpy\renpy-7.1.3-sdk\renpy\ast.py", line 1861, in execute
self.call("execute")
File "X:\games\renpy\renpy-7.1.3-sdk\renpy\ast.py", line 1849, in call
return renpy.statements.call(method, parsed, *args, **kwargs)
File "X:\games\renpy\renpy-7.1.3-sdk\renpy\statements.py", line 203, in call
return method(parsed, *args, **kwargs)
File "renpy/common/000statements.rpy", line 519, in execute_call_screen
store._return = renpy.call_screen(name, *args, **kwargs)
File "X:\games\renpy\renpy-7.1.3-sdk\renpy\exports.py", line 2755, in call_screen
rv = renpy.ui.interact(mouse="screen", type="screen", roll_forward=roll_forward)
File "X:\games\renpy\renpy-7.1.3-sdk\renpy\ui.py", line 289, in interact
rv = renpy.game.interface.interact(roll_forward=roll_forward, **kwargs)
File "X:\games\renpy\renpy-7.1.3-sdk\renpy\display\core.py", line 2672, in interact
repeat, rv = self.interact_core(preloads=preloads, trans_pause=trans_pause, **kwargs)
File "X:\games\renpy\renpy-7.1.3-sdk\renpy\display\core.py", line 3477, in interact_core
rv = root_widget.event(ev, x, y, 0)
File "X:\games\renpy\renpy-7.1.3-sdk\renpy\display\layout.py", line 998, in event
rv = i.event(ev, x - xo, y - yo, cst)
File "X:\games\renpy\renpy-7.1.3-sdk\renpy\display\layout.py", line 998, in event
rv = i.event(ev, x - xo, y - yo, cst)
File "X:\games\renpy\renpy-7.1.3-sdk\renpy\display\layout.py", line 998, in event
rv = i.event(ev, x - xo, y - yo, cst)
File "X:\games\renpy\renpy-7.1.3-sdk\renpy\display\screen.py", line 697, in event
rv = self.child.event(ev, x, y, st)
File "X:\games\renpy\renpy-7.1.3-sdk\renpy\display\layout.py", line 998, in event
rv = i.event(ev, x - xo, y - yo, cst)
File "X:\games\renpy\renpy-7.1.3-sdk\renpy\display\dragdrop.py", line 816, in event
return super(DragGroup, self).event(ev, x, y, st)
File "X:\games\renpy\renpy-7.1.3-sdk\renpy\display\layout.py", line 998, in event
rv = i.event(ev, x - xo, y - yo, cst)
File "X:\games\renpy\renpy-7.1.3-sdk\renpy\display\dragdrop.py", line 706, in event
rv = run(drag.dragged, joined, drop)
File "X:\games\renpy\renpy-7.1.3-sdk\renpy\display\behavior.py", line 315, in run
return action(*args, **kwargs)
TypeError: 'unicode' object is not callable