konterball's Recent Forum Activity

  • Thanks!

  • Hi there,

    In the Addon SDK v1, the runtime had the "IsInWorker()" function as well as the "IsPreview()" function. Now it seems that there is only "IsInWorker()" left.

    How can I check via the SDK v2 whether the game is in the preview?

    Thank you :)

  • Ashley Uhhh. I found out that my addon causes the localStorage to be null. How is that possible? Any ideas?

    I'm using Developer Mode -> Add dev addon. Could this cause it?

  • Ashley Yes, I thought so too, but nope:

    The tip with IStorage sounds good. I'll try it out. Many thanks!

    Could you tell me how to access it in domSide.js? That would be great :)

    iRuntime is avaiable. Could i use it for it?

  • Hi there,

    I'm currently working on an addon that uses, among other things, loading and saving functions from an external SDK.

    The problem is that loading and saving doesn't work in the preview (correct behavior), but only in the corresponding environment. All good!

    BUT: I would therefore like to use a fallback storage in this case. Unfortunately, the usual suspects are all null.

    Even including an external library (hello localForage) doesn't help, because the drivers that are actually supported don't work either and supports() returns false for them.

    What other fallback options do I have?

    Thanks :)

  • Ashley Yes, of course I understand that. I just don't want the project to run locally.

    I use an SDK that unfortunately complains if any JS code is called before it is initialized. And that is exactly the snippet that causes this issue. Therefore has to be removed manually.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Is it possible to export a game as an HTML5 version in such a way that the following script is not automatically added to the index.html, so that you don't have to remove it manually afterwards?

    <script>
    if (location.protocol.substr(0, 4) === "file")
    {
    	alert("Web exports won't work until you upload them. (When running on the file: protocol, browsers block many features from working for security reasons.)");
    }
    </script>
    

    Thanks in advance!

    Tagged:

  • To use "await", you simply have to precede the function with "async". Like this:

    async _GetValue() {
    	const value = await asyncFunction();
    	return value;
    });
    

    The second question is still open.

  • Hi there,

    I have two questions:

    1.) How can I handle asynchronous functions in domeSide.js? At the moment it is very complicated:

    Example:

    Is there an easier way? I couldn't use await.

    this.AddRuntimeMessageHandlers([
    	["get-value", () => this._GetValue()]
    ]);
    
    _GetValue() {
    	asyncFunction().then(value => {
    		this.PostToRuntime("set-value", value);
    	});
    }
    

    I need two MessageHandlers. Is there an easier way? I couldn't use await.

    What obviously doesn't work:

    _GetValue() {
    	const value = await asyncFunction();
    	return value;
    });
    
    _GetValue() {
    	asyncFunction().then(value => {
    		return value;
    	});
    }
    

    2.)

    It looks like you can use _postToDOMAsync in conditions. Is it correct that this doesn't work with expressions?

    Thank you very much

  • Hi there,

    I want to create my own addon and have downloaded the sample. Developer Mode is activated.

    Now I get the following error message: addon.json specifies id "MyCustomID", but expected id "MyCompany_SingleGlobal" (see screenshot).

    BUT: If I now set MyCompany_SingleGlobal as the ID again, I get the error message the other way round:

    addon.json specifies id "MyCompany_SingleGlobal", but expected id "MyCustomID". Well.... what?!?

    I would now like to uninstall the add-on, BUT ?safe-mode doesn't work. The screenshot was taken on editor.construct.net

    Why doesn't safe mode work?

    The documentation says: "To remove this addon, you can clear your browser storage." What exactly do I have to clear? I don't want to delete my entire storage, just Construct-specific entries (I use Chrome).

    Please help :)

    Thanks in advance.

  • WackyToaster Thanks for your engagement :)

    Well, for "Letterbox Scale" it seems to work. At least for the top in landscape mode. I'm afraid that i need it for "Scale outer". There it behaves completely different, but maybe there is only a little change necessary?

    Addendum: window.innerHeight and window.innerWidth are different from all values that can be determined via Construct. Would you have to use this to calculate some ratio in order to then be able to calculate the width and height in proportion?

    Actually you would need a scaling value, but it always seems to be 1...

    But maybe I'm completely on the wrong track.

  • WackyToaster Thank you for your quick and very detailed answer :)

    An iFrame is not possible. I depend on the environment in which the game is to be shown afterwards. The navigation bar is placed on the game as an overlay by this environment, so I don't think an extra layer makes sense, correct? If the navigation were in-game, then yes. But only space should be created and the UI elements should be pushed further down (or to the right) in order to avoid the overlap mentioned.

    I have now created a sprite "Spacer" (1x1) and positioned it in the top left corner via "Anchor" (thanks for the confirmation). In theory it now behaves as it should, but I still have problems with the size. Full width and height works now, but how do I ensure a constant height/width of 100 pixels?

    If I simply use "Set size" with the value 100, then the value changes proportionally to the window size:

    If I make the window smaller, this value also becomes smaller. How can I make 100px fixed?

    Thanks :)

konterball's avatar

konterball

Member since 10 Jan, 2019

None one is following konterball yet!

Trophy Case

  • 5-Year Club
  • RTFM Read the fabulous manual
  • Email Verified

Progress

7/44
How to earn trophies