This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2013-01-30 19:08:39

rpglurker
New Scratcher
Registered: 2013-01-17
Posts: 24

non run-time type binding

My apologies for reposting this, but this is apparently an advanced topic.  I am trying to figure out what is the proper way to call a local method of a remote object at run-time.  It will not resolve at compile time, which is giving me problems with the "method of object" block.  I tried the tell object block from the BYOB toolkit which works but generates local copies of all of the functions in the C area of the remote sprite even though it appears to call the correct run-time methods of the correct sprite.  I have tried the run/launch/call methods as well and I am unable to find anything that works correctly.  So far the best solution is to use the tell object block and ignore the turds generated in the initiating sprite (all variables and methods referenced in the c-area).

Any ideas?

Here is an example:

when gf clicked
script variables (a)
set (a v) to <object [sprite1 v]>
run ((function1 v) of (sprite1 v))
If you try to use the variable that is set to an object of that type it is not recognized and will not let you access the local method to the remote sprite (object).

when gf clicked
script variables (a)
set (a v) to <object [sprite1 v]>
run ((         v) of (a))

Offline

 

Board footer