Re: Go To Commands (AppleScript)
Re: Go To Commands (AppleScript)
- Subject: Re: Go To Commands (AppleScript)
- From: email@hidden
- Date: Thu, 18 Jul 2002 14:49:35 EDT
I've got a TI-86+ with datalink; want send me the code to
look at? I've never heard of the game.
Meanwhile, any calculator game could be done without go
to's, in the same fashion most mac (and many windoze)
programs are: a main loop, with various triggers to assorted
handlers instead of direct GOTO's... There
really isn't much difference between writing:
If x=45 then goto [label_blue]
if x>45 the goto [line 520]
if x<45 and x >0 then goto [destination1]
go to [destination2]
and saying (in AS):
if x > 45 then
-- do whatever is at [label_blue]
-- or redirect to handler label_blue
else if x=45 then
-- do whatever is at [line 520]
else if x<45 AND x>0 then
-- do whatever is at [destination1]
else
-- do whatever is at [destination2]
end if
only 1 extra line of code in the decisions (and 5 lines saved in labels).
Meanwhile, you probably want to look at the use of handlers instead of GoTo's
for your purposes:
if x=45 then
my LabelBlue
end if
which may be able to be written as simply as (I think):
if x=45 then my LabelBlue
=-= Marc
In a message dated 7/18/02 1:20:18 PM, email@hidden writes:
>
The game I'm planning to write is a computer version of the
>
calculator game "Drugwars." This game, when programmed on
>
a calculator, absolutely needs gotos. If not, the entire
>
thing would be an incredibly complex if...then statement.
>
Gotos aren't necessarily bad programming if they're managed
>
correctly and written in a way that optimizes performance.
>
Jumping from end to end of code, however, is stupid. I
>
just need jumps for certain areas.
>
>
Dave
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.