Hypertalk is the programming language used in the mac software Hypercard.
Hypertalk can be emulated easily using a Macintosh emulator, the default Hypercard canvas size is 512x342.
For most basic operations including mathematical computations, HyperTalk favored natural-language ordering of predicates over the ordering used in mathematical notation. For example, in HyperTalk's put assignment command, the variable was placed at the end of the statement:
put 5 * 4 into theResult
The go command can be used in two ways. It can allow the user to go to any card in the stack that it is in or to any card of any other stack that is available.
visual effect dissolve go to card id 3807
To change the text value, or textstyle of a field:
on mouseUp put random(100) into card field "target" set the textstyle of card field "Title" to italic end mouseUp
Alternative, one can use the "type" command if the programmer wants to simulate someone typing something into a field. The type command will do very well here:
on mouseUp select before first line of card field "target" type "hello there" end mouseUp
The hide command can be used to hide any object. Some examples are: buttons, fields, and the menubar. The opposite of the hide command is the show command, and it can be used to make an object show up again.
-- a comment onmouseUp hide card field "title" wait 5 seconds show card field "title" endmouseUp
Each of the tools in the tool menu has a name that can be used with this command.
onmouseUp choose spray can tool set dragSpeed to 150 drag from 300,100 to 400, 200 wait 1 second choose eraser tool drag from 300,100 to 400, 200 choose browse tool endmouseUp
The available tools are:
- reg[ular] poly[gon]
- round rect[angle]
on mouseUp ask "What is your name?" put it into response answer "You said " & response end mouseUp
Logic with input
on mouseUp ask "What is your name?" put it into response if response is "blue" then answer "correct." else answer "incorrect." end if end mouseUp
Logic with choices
on mouseUp answer "Which color?" with "cyan" or "magenta" or "yellow" if it is "cyan" then answer "You selected cyan." else answer "You did not select cyan." end if end mouseUp
The play command plays the specified sequence of notes with the specified sampled sounds. The tempo parameter specifies the number of quarter notes per minute; the default value is 120.
play "harpsichord" "c4 a3 f c4 a3 f c4 d c c c"
The global command is used to specify variables which will be available to other scripts within the stack or even in another stack. Unless variables are declared a global, they are considered by HyperTalk as local which means that they may only be used within a single script. If they are global, they may be carried to other scripts. Variables must be identified before they are used in order for them to become global.
-- allow access to globals global var1, var2, .. answer "hello " & var1 & "."
-- Let's put it altogether now on mouseUp put random of 100 into n repeat 6 ask "please input number(1-100)?" if it < n then answer "more than" && it else if it > n then answer "less than" && it else if it is n then answer "perfect!" exit mouseUp end if end repeat answer "You lose, myy answer is " && n end mouseUp
Found a mistake? Submit an edit to hypertalk.
incoming(4): merveilles noodle neauismetica macintosh
Last update on 20G13, edited 4 times. +20/31fh