NitPicking within myself, but I have always isolated variables in “do” constructions: do "set the myProperty of" && tCardName && "to" && tValue
Craig > On Oct 24, 2023, at 1:59 PM, Craig Newman <cr...@starfirelighting.com> wrote: > > Paul. > > Having a more complete description seems right to me. You are essentially > saying that if you use the moniker “the currentCard” that LC should know what > you are intending, the is, the current “card”, and not the current “something > else”. > > It has to be one of those cases where, as Danny Goodman once said, “If a line > of code seem like it ought to work but does not, try using a “do” > construction to force another layer of resolution; > > on mouseUp > put the currentCard of stack "Untitled 1" into tCardName > > do "set the myProperty of" && tCardName && "to tValue" > > end mouseUp > > This works, and shows that the referencing of these sorts of things in LC, > like in HC, is not quite as they read like. > > Craig > > >> On Oct 24, 2023, at 1:00 PM, Paul Dupuis via use-livecode >> <use-livecode@lists.runrev.com> wrote: >> >> I think I found a oddity in the "currentCard" property. >> >> The documentation states that the currentCard property return the short name >> of the current card of a stack: >> >> for example: put the currentCard of stack "Untitled 1" into tCardName >> >> You can then execute code such as: set the myProperty of cd tCardName of >> stack "Untitled 1" to tValue >> >> However, if the card does not have a name set, then current card returns >> "card id <idnumber>", example: card id 1002 and the above 2 lines of code >> return a runtime error of 'can't find card' >> >> put the currentCard of stack "Untitled 1" into tCardName >> set the myProperty of cd tCardName of stack "Untitled 1" to tValue >> >> WORKS for cards with a name >> FAILS for cards without a name (where currentCard returns 'card id <number') >> >> I think currentCard should just return 'id 1002' rather than 'card id 1002' >> if a card has no name. >> >> Trying to execute: set the myProperty of cd tCardName of stack "Untitled 1" >> to tValue WHEN tCardName contain 'card id 1002' produces a run time error >> >> But trying to execute: set the myProperty of cd id 1002 of stack "Untitled >> 1" to tValue works. >> >> Oddly, set the myProperty of cd tCardName of stack "Untitled 1" to tValue >> FAILS if tCardName contains "id 10001" (and yes that card with that ID >> exists) >> >> Oddly again, set the myProperty of the currentCard of stack "Untitled 1" to >> tValue DOES WORK whether they have a name or not >> >> But again, breaking that example above (set the myProperty of the >> currentCard of stack "Untitled 1" to tValue) into 2 lines: >> put the currentCard of stack "Untitled 1" into tCardName >> set the myProperty of cd tCardName of stack "Untitled 1" to tValue >> FAILS if the card has no name. >> >> Something just seems off here? >> >> _______________________________________________ >> use-livecode mailing list >> use-livecode@lists.runrev.com >> Please visit this url to subscribe, unsubscribe and manage your subscription >> preferences: >> http://lists.runrev.com/mailman/listinfo/use-livecode > _______________________________________________ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode