≡
Products
▼
Support
▼
Company
▼
Forum
Ambiera Forum
Discussions, Help and Support.
Create a new account
,
Search
, or Login:
Create reply in
wait javascript
Posted by:
(you are not logged in)
Enter the missing letter in: "Internation?l"
(you are not logged in)
Text:
[quote][b][/b] wrote: this should not work in the execute javascript action on "when a key is pressed do something behavior" but it somehow works maybe coppercube execute javascript command uses javascript in a different manner than behavior and action. The code you posted above contains an error so this should not work in either of the action or in the javascript execute command. The whole code is correct except a silly mistake which you had done. you have used "this.startTime" while in the whole script you haven't defined "this.startTime" anywhere, you have defined "var startTime" so you need to use "startTime" instead of "this.startTime". as "this.startTime" is not defined endTime will return a null or zero value and hence the timer never ends. making the action unusable. Just remove "this." from "this.startTime" and you are good to go. Also, there is a mistake in the header of the action as well, but I believe this is because of copy-pasting the action into the forums. you will get an error of unterminated code or comment or something like that. because your action header is mission "/*" at the beginning of your action. final code should be something like this. [code]/*<action jsname="action_DoAfterWait" description="action_DoAfterWait"> </action> */ action_DoAfterWait = function() { } action_DoAfterWait.prototype.execute = function(currentNode) { print("START"); var startTime = (new Date()).getTime(); var endTime = startTime + 1500; function onFrameDrawing() { var now = (new Date()).getTime(); print(now); if (now > endTime) { print("TIME UP!"); } } ccbRegisterOnFrameEvent(onFrameDrawing); }[/code] hope that works *holy**holy*[/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