≡
Products
▼
Support
▼
Company
▼
Forum
Ambiera Forum
Discussions, Help and Support.
Create a new account
,
Search
, or Login:
Create reply in
Guest's scripts and plugins
Posted by:
(you are not logged in)
Enter the missing letter in: "Interna?ional"
(you are not logged in)
Text:
[quote][b]Guest[/b] wrote: I decided to reinstall my CopperCube app to remove some excess scripts and plugins from my exploration of the program. This has given me the idea to create a thread here to document my journey of rebuilding my tools. Everything I post here is given freely to the CC community for their projects, both personal and commercial, no credit required. It's traditional to begin with a "Hello, World!" program, so that is where we will start. [code] // CopperCube action that prints a message to the console /* <action jsname="action_PrintToConsole" description="Print to console"> <property name="Message" type="string" default="Hello, World!" /> </action> */ action_PrintToConsole = function () { } action_PrintToConsole.prototype.execute = function () { print(this.Message); } [/code] Copy the code above, paste it into a text file, save it as "action_PrintToConsole.js", and place it inside CC's extension folder (located in your Documents\CopperCube folder). When you start you CC app, the new action should be available. If your CC app is already running, go to Edit > Plugins > Reload and Verify Extensions and Plugins, then it should appear. This action script will print a message (default: "Hello, World!") to CC's debug console. What good does this do for us? Plenty. This code gives us a quick means to "sanity check" our game's logic. Logic is conditional. That is, it's either true or false. Consider behavior scripts to be the conditional loops (logic) of CC; consider action scripts to be the ordered (they fire sequentially, top to bottom) instructions after the condition of the behavior loop is true. Generally speaking, if it repeats, it's a behavior; if it doesn't, it's an action. So what does all this have to do with a "Hello, World!" action script? Simple. Call this action to test if the condition of your behavior is true or not. Example: Open your CC app, attach a "When clicked on this do something" behavior to your default cube, attach the "Print to console" action to this behavior, then test your app. When you click on the cube, it will print "Hello, World!" to the debug console. Thus we now know our logic is sound, and that our app is "sane."[/quote]
Possible Codes
Feature
Code
Link
[url] www.example.com [/url]
Bold
[b]bold text[/b]
Image
[img]http://www.example.com/image.jpg[/img]
Quote
[quote]quoted text[/quote]
Code
[code]source code[/code]
Emoticons
Copyright© Ambiera e.U. all rights reserved.
Privacy Policy | Terms and Conditions | Imprint | Contact