≡
Products
▼
Support
▼
Company
▼
Forum
Ambiera Forum
Discussions, Help and Support.
Create a new account
,
Search
, or Login:
Create reply in
"Every few seconds do something" doesn't work on WebGL
Posted by:
(you are not logged in)
Enter the missing letter in: "I?ternational"
(you are not logged in)
Text:
[quote][b]dekon_17[/b] wrote: Yeah, despite having great achievements for the past couple of days, I stumbled in a problem that I wasn't expecting. Such basic behavior as "Every few seconds do something" just does nothing! Even more than just that, scripting the stuff with "timeMs" or "new Date().getTime()" don't work neither. The code, basicly, looks like this: [code]/* <behavior jsname = "behavior_RanTime" description = "Do stuff at random intervals"> <property name = "Min" type = "int"/> <property name = "Max" type = "int"/> <property name = "Action" type = "action"/> </behavior> */ behavior_RanTime = function() { this.End = null; }; behavior_RanTime.prototype.onAnimate = function() { if (this.End == null) { var Num = Math.floor (Math.random() * (this.Max - this.Min + 1)) + 1; var Time = new Date().getTime(); this.End = Num + Time; }; var Now = new Date().getTime(); if (Now >= this.End) { this.End = null; ccbInvokeAction (this.Action); print ("Done"); }; };[/code] It works well on Windows, still doesn't work with WebGL. The reason why I used "new Date" method is because... Because I tried to avoid "timeMs" problem (with no success, as you probably understand). Is there any way to aviod this problem?[/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