Alternative to userDefault in cocos2d3.0 js - cocos2d-js

I am converting my project from cocos2dx 2.0.4 to cocos2d-js 3.0 ,i am unable to find alternative to CCUserDefault for setting Value for key in javascript. I have tried refering the cocos2d-js API documentation,but din't get any other similar function can anybody please tell me alternative for this command..i am new to cocos2d-js 3.0,unable to figure out

Use the cc.sys.localStorage:
cc.sys.localStorage.getItem(key);
cc.sys.localStorage.setItem(key, value);
cc.sys.localStorage.removeItem(key);

Related

Error: 'Imported XML Content cannot be parsed'

Here's what I'm doing:
=IMPORTXML("https://www.predictit.org/api/marketdata/markets/7164", "/MarketData/Contracts/MarketContract/ID")
The other answers I've seen about this have said that Javascript would be the issue, but the page in question seems to load without it, and I've tried using IMPORTJSON and IMPORTFROMWEB to no avail.
Please help!
You are input incorrect parameter for the xmlpath, a proper formula should be as following and you need to spend sometime to find the correct xmlpath to extract the specific string or information you want,
=IMPORTXML("https://www.predictit.org/api/marketdata/markets/7164","//a/#href")
Here is one example from Google:
=IMPORTXML("https://en.wikipedia.org/wiki/Moon_landing", "//a/#href")

Trying to fix an auto farming script for a mobile game

I found a 5 month old lua script to automatically farm currency and items in a mobile game called Soda Dungeon, the script was finicky when I found it and wouldn't work properly so I'm trying to fix it with very little lua experience.
Here is the code Ive edited: http://pastebin.com/U9Ymej0z
it runs fine until it tries to start the dungeon and I get this error:
Runtime error: com.appautomatic.ankulua.f:
Can't find dungeon_level_up.png
stack traceback:
[C]: in function 'continueClick'
?: in function <?:291>
(tail call):?
/storage/extSdCard/soda_dungeon/main.lua:
217: in function 'main'
/storage/extSdCard/soda_dungeon/main.lua:
239: in main chunk
Any help is greatly appreciated.
I don't know anything about Ankulua but a quick session with our best buddy google gave me this:
http://ankulua.boards.net/thread/13/advanced-methods
http://ankulua.boards.net/thread/6/objects-methods-introduction-sikuli-compatible
They give those functions:
continueClick(x, y, xRandom, yRandom, times)
continueClick(PSMRL, times [,timeout])
They say continueClick will click on a position given by x,y or PSMRL, which will resolve in a postion as well.
You enter a string that contains an image name.
I assume the message
Can't find dungeon_level_up.png
Is rather an exception text of some find(PS) function inside Ankulua than a problem with finding an image file. Replace that image name with some coordinates and check what is happening.
I would not trust that function call in your script as the author of that script added a comment that he does not know what continueClick returns. So maybe he did not know how to use it as well.
The documentation says:
There is no return value.
Btw, the author of Ankulua offered support via mail. So why don't you ask him? I'm sure he'll be of better help than anyone here.
let me offer you another alternative method, just a few simple click you and drag
It doesn't require root,
background service Installation can be found at the following
hXXp://123autoit.blogspot.tw/2016/08/123autoit-non-root-daemon-service.html
currently only works on ARM
for Android 5.0+
hXXp://play.google.com/store/apps/details?id=com.autoit.nonroot&hl=en
for Android 4.2~4.4
hXXps://play.google.com/store/apps/details?id=com.autoit.nonroot.legacy&hl=en
feel free to send me message to ask for question
here is what it can do
check out the blog, it contains tutorials, and video demo
http://123autoit.blogspot.tw/
Hope everything works out for you,
cheers

Reload data in Amchart

I'm using this library,
https://github.com/ChimpStudios/AmCharts
It works cool, but i didn't find how to reload existing chart. When i call multiple times:
self.mapView.chart = self.map
self.mapView.drawChart()
map disappear or it's color set to black. In original AmChart for JavaScript, object has method validateData, but this method i didn't find in IOS library.
If someone used this library, please help, because in github author not answer.
I'm unfamiliar with this specific library/wrapper, but looking in the repo, it does appear that both chart.validateData() and chart.validateNow() are supported.
Example usage in ChartView.m

Resumable uploading in latest version of Google API PHP SDK

The example code for a resumable upload (usually used for large files) in the SDK is out of date and does not work (https://github.com/google/google-api-php-client/blob/master/examples/fileupload.php).
Specifically, the $request object that is passed when getting a new Google_Http_MediaFileUpload is of the wrong class type. Google_Http_MediaFileUpload wants an Google_HTTP_Request object, but in the example code, the thing being passed is actually (in recent releases of the SDK) a Google_Service_Drive_DriveFile.
After poking around a bit, I cannot see the obvious way to do this with the current SDK, with the same economy as the example code. (I can see the long-winded way, by creating Google_HTTP_Request objects myself according to the generic API documentation).
Does anyone have an example of working code for this? (I Googled but did not find any. The changes in the SDK appear to be in the last few weeks).
I tested the latest version from Git and the example is working fine. The only "problem" is that it took a little while for the script to finish processing, even after I saw the file on Google Drive.
The $request variable is actually of the expected type Google_HTTP_Request.
$request = $service->files->insert($file);
// In the above line, $service is a `Google_Service_Drive` and
// $service->files is `Google_Service_Drive_Files_Resource`'
// which extends `Google_Service_Resource`.
// That insert() method returns the result of a call
// to Google_Service_Resource::call(), which
// returns a Google_HTTP_Request

Implementing Math.pow() in blackberry

I cant find any pre defined function in blackberry JDE to implement Math.pow(). Can anyone please suggest how to power the values that are retrieved from the Edit text fields(Like X^Y value)...
What about net.rim.device.api.util.MathUtilities.pow ( double double ).
You don't need to implement your own. Check out
net.rim.device.api.util.MathUtilities.pow ( double double )
for what it's worth, i also came across this limitation at one point- (keeping a single library to be used in both j2me AND blackBerry) and there's a decent discussion at http://today.java.net/pub/a/today/2007/11/06/creating-java-me-math-pow-method.html which should help you. i've used this code and it's worked for me

Resources