Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!brux From: brux@cs.utexas.edu (Mark Brucks) Newsgroups: comp.sys.mac.hypercard Subject: scope rules for scripts Keywords: hypertalk, messages, scope Message-ID: <16488@cs.utexas.edu> Date: 4 Jan 91 04:39:06 GMT Organization: UTexas CS Dept, Austin, Texas Lines: 25 I want to send a message from card "two" to card "one", and have card "one" update information in its fields. Here is an simple card script for card "one" (the card receiving the doit message): on doit arg1, arg2 put arg1 & arg2 after card field "field 1" of card "one" put card field "field 1" of card "one" & "foobar" into card field "field 2" end doit The first line of the script works perfectly. However, the second line generates an error message "No such card". What gives? I realize that the current card doesn't change when a message is sent, so that means that references to field "field 1" in the above script default to fields of card "two" (the card sending the message). That is why I have referenced card "one" explicitly, even though the script belongs to card "one". This kind of scoping seems a bit bizarre to me, and I can't find any explanation in the HC Script Lang. Guide. This notion of the current card not changing when a message is sent seems to suspend the usual scoping rules. Is this right? If so, is there some mysterious advantage to this that I haven't discovered? Anyone care to explain this to an experienced programmer who is new to HyperTalk. Thanks.