Basic LiveCode Vocabulary The following LiveCode language vocabulary is only a small portion of the scripting language. However, even this small vocabulary can get you a long way. You can look these up in the LiveCode Dictionary and see examples of the commands and how they work (On the top EditBar in LiveCode is an icon titled “Dictionary”. Click on it). Commands ask <text string> pops up a dialog box with a text field to type an answer in answer <text string> [ with <button1> or <button2> or … or <button7> ] pops up a dialog box with buttons hide <object> makes an object not visible (it is a shortcut for "set the visible of <object> to false") show <object> makes an object visible (it is a shortcut for "set the visible of <object> to true") disable <object> - enable <object> put <text string> into <variable> | <field> <name> puts data into fields or variables add <number> to <variable> | <field> <name> subtract <number> from <variable> | field <name> grab <object> grabs an object for drag-and-drop actions move <object> [from <x,y coordinate>] to <x,y coordinate> [ in <time duration>] set <property> of <object> to <value> changes a property using code instead of the Inspector wait <time duration> where time can be secs, seconds, millisecs, and ticks go to card “name_of_card” intersect ( <object1> , <object2> [, “pixels” | “opaque pixels” | 255 ] ) check if 2 objects touch each other send <message> to me [in <time duration>] allows messages to be sent, good for repeating actions or doing something else play “sound file” [looping] random(<number>) generates a random number between 1 and the <number> where: Messages (a few examples) mouse messages: mouseDown, mouseUp, mouseOver, mouseEnter, mouseLeave,... Objects: Objects are identified with a type and a name: e.g. button “box”, image “Spider.jpg”, group "stars" , graphic "witch" Some Object Types: images, graphics, buttons, groups, fields, cards, stack Objects have properties - which can be changed manually in the “Properties Inspector” or in code using the “set” command. Variables - are containers for holding information or data. You use them to save information or data Create a variable by declaring it as local, global or just putting something into it: local highScore
Comments - these are for people, computers ignore them Comments are added with either “//” or “--” at the beginning of the line // This is a comment - do not try to execute this line Message handlers - begin with “on” on <message> e.g. on mouseUp if statement where <condition> will be True or False if <condition> then e.g. if it is “Yes” then if <condition> then e.g. if it is “Yes” then Repeat loops repeat <number> times e.g. Repeat 3 times // this flashes a bomb on and off |
Home >