I referred the following link for implementation
http://www.kestrelmoon.com/creaturedocs ... times.html
My code
var actual_data = CreatureModuleUtils.LoadCreatureFlatData(game.cache.getBinary('myFlatDataBinary.bin'));
Its displaying the below error
Uncaught TypeError: Cannot read property 'getBinary' of undefined
Any help appreciated
Unable to use binaries instead of json for pixi runtimes
Re: Unable to use binaries instead of json for pixi runtimes
Hello,
The API for PixiJS might have changed, that is why their game object does not have the getBinary() function.
You don't actually have to use the game object cache to retrieve binary data, you can use regular JS to get a response/get a binary array from the flat data. After that, just pass it into the LoadCreatureFlatData function.
Cheers
The API for PixiJS might have changed, that is why their game object does not have the getBinary() function.
You don't actually have to use the game object cache to retrieve binary data, you can use regular JS to get a response/get a binary array from the flat data. After that, just pass it into the LoadCreatureFlatData function.
Cheers
Re: Unable to use binaries instead of json for pixi runtimes
Thanks for the help.
I tried using regular JS to get the binary text as you said.
But, again there's an error in library file
TypeError: flat_mesh is null CreatureMeshBone.js:2994:3
This is my code
var byteArray=[];
var xobj = new XMLHttpRequest();
xobj.open('GET', 'animations/hey.bin', true);
xobj.overrideMimeType('text/plain; charset=x-user-defined');
xobj.responseType = '';
xobj.onreadystatechange = function () {
if (xobj.readyState == 4 && xobj.status == "200") {
var response1 = xobj.responseText;
for (var i = 0; i < xobj.responseText.length; ++i) {
byteArray.push(xobj.responseText.charCodeAt(i) & 0xff)
}
actual_data = CreatureModuleUtils.LoadCreatureFlatData('byteArray');
new_creature = new Creature(actual_data, true);
new_animation_1 = new CreatureAnimation(actual_data, "idle", true);
I tried using regular JS to get the binary text as you said.
But, again there's an error in library file
TypeError: flat_mesh is null CreatureMeshBone.js:2994:3
This is my code
var byteArray=[];
var xobj = new XMLHttpRequest();
xobj.open('GET', 'animations/hey.bin', true);
xobj.overrideMimeType('text/plain; charset=x-user-defined');
xobj.responseType = '';
xobj.onreadystatechange = function () {
if (xobj.readyState == 4 && xobj.status == "200") {
var response1 = xobj.responseText;
for (var i = 0; i < xobj.responseText.length; ++i) {
byteArray.push(xobj.responseText.charCodeAt(i) & 0xff)
}
actual_data = CreatureModuleUtils.LoadCreatureFlatData('byteArray');
new_creature = new Creature(actual_data, true);
new_animation_1 = new CreatureAnimation(actual_data, "idle", true);
Re: Unable to use binaries instead of json for pixi runtimes
Hello,
Is this the actual line you wrote:
Just want to confirm with you. Because it looks like you should be passing in the byte array, not a string which you are doing.
The string 'byteArray' does not contain the binary data.
Cheers
Is this the actual line you wrote:
Code: Select all
actual_data = CreatureModuleUtils.LoadCreatureFlatData('byteArray');
The string 'byteArray' does not contain the binary data.
Cheers
Re: Unable to use binaries instead of json for pixi runtimes
Thanks for the help.
Can you give an example of code if possible?
Thanks again
Can you give an example of code if possible?
Thanks again
Re: Unable to use binaries instead of json for pixi runtimes
Hello,
This is more of a general JavaScript question ( not really Creature related ). You want to know how to load a Uint8Array from some data online.
I found this link for you, hope it helps:
https://developer.mozilla.org/en-US/doc ... inary_Data
After you get the array, you pass it into the LoadCreatureFlatData function.
This is more of a general JavaScript question ( not really Creature related ). You want to know how to load a Uint8Array from some data online.
I found this link for you, hope it helps:
https://developer.mozilla.org/en-US/doc ... inary_Data
After you get the array, you pass it into the LoadCreatureFlatData function.
Re: Unable to use binaries instead of json for pixi runtimes
Thank you so much for the help Chong!
I was finally able to do it
I was finally able to do it