Nic_MDS's Forum Posts

  • You do not have permission to view this post

  • Without the plugin's help, it will probably be impossible to achieve it without going into written coding of the game's files. The only downfall of this plugin (at least when exporting to HTML5) is that it does not work with Advanced Minify of the export settings (only with Simple).

    Maybe look into some pure Javascript coding to write into C3 without plugins, but from what I tried, it appeared to be hard to impossible. :(

    I've seen that this plugin works in a similar way to the native multiplayer functions of C3, maybe there's something to look into it. But if you run out of time, I can tell you that with the plugin you can achieve your goal (at least on Destkop and Android Devices).

  • From what I understand, Audio Play in Background only works for an audio that started playing when the game was running. Then it'll stop and not play any other audio as soon as it is finished.

    In my opinion, this is a feature that should be enabled for dev and user consent, instead of blocked, since run in background tend to be important. I know it has to be used with caution, but this caution could maybe be controlled from the framework side.

    Anyway, that said, I use a plugin called "Run in Background". It's kinda tricky, but it sure works on Android Platforms (Browser) and Desktops, but doesn't on iOS.

    https://www.construct.net/en/make-games/addons/462/run-background

    It even have an exemple file, it's worth checking out.

  • Glad it works! You should be able to get the result into a global variable like this:

    > runtime.globalVars.VarName = paramGotten;
    

    Hey, it worked! Don't remember what I was doing wrong, but your line did the trick. Thank you for helping out!

  • Hey, if I got your question right, you may get what you need from the use of a Dictionary. I made an example so you can see if it's what you need to learn.

    Layout Setup

    Event Sheet

    Hope this helps.

  • Sorry, I'm not sure what a 'hidden' parameter is..

    The easiest way to know for sure is to test.

    I don't know if this is the right nomenclature for it, but there's sometimes when a parameter isn't showed in the URL at the address bar, like for example https://examp.com/?myparam="abcd1234". In my case the link is like "https://examp.com/mygame" and the parameter is actually inside the page in an <iframe src="https://examp.com/?myparam="abcd1234">.

    I don't get too much of web as of now to understand if what I did was necessary or not, but the only way I got it to work is as it follows (using the URLSearchParams api). To anyone who stumbles upon something like this in the future there goes what I did bellow. Also, thanksdop2000, this API was in the link you recommended. :)

    	globalThis.paramGotten = "Initialize";
    
    function gettingParameter()
    {
    	const param = new URLSearchParams(window.location.search);
    	//if there is a param called myparam...
    	if(param.has('myparam'))
    	{
    		console.log("param exists");
    		//passing the param that was found to the Global Variable "paramGotten"
    		//this way it's possible to access it in the EventSheet
    		paramGotten = param.get('myparam');
    		console.log(paramGotten);
    	}
    }
    

    I tried using localVars and globalVars to get the param from the JS code, but wasn't able to do it in anyway. The only path I found was with the Text Object. But hey, it's working.

  • Hey man, I don't know if I got your problem right. But, what if you created an Instance Variable inside your item called something like "type". Then, when Item with variable "type" equals 1, something happen. If it equals 2, other happen, and so on.

    I do this sometimes when I need to differentiate two instances of a same Sprite. I put a Instance Variable with different values to create a difference between then in the events.

  • You don't need to do this via the Browser object, just google how to get query parameters with Javascript, there are several methods. For example:

    https://flaviocopes.com/urlsearchparams/

    Hey, thanks for your insight!

    I'm new to JS, so I don't even know exactly what to search for sometimes. I'll make sure to test some of these.

    Do you happen to know if those methods usually works even if the param is "hidden" from the address bar?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hello! I'm trying to get access to the Browser Object in Javascript to use it's QueryParam expression. I've read in the documentation that using expressions in JS isn't possible.

    Is there something similar to it that I could use? I've tried putting in my function Browser.QueryParam("myparam"); but it gave me "Browser is not defined" error in the console.

    Does anyone know what could I do? I'm trying to get an auth token. Code below:

    function GettingData()
    {
    	const url = "https://testurl.com/api/testing-page"; // API URL
    	const token = Browser.QueryParam("mytokentest"); // API Token - Does not Work. Console gives Browser Not Defined
    	//const token = runtime.objects.Navegador; - Navegador = Browser Object in Portuguese. Can't access QueryParam from here.
    	const method = "GET"; // Request method
    
    	fetch(url, {
    		method,
    		headers: {
    			"Authorization": `Bearer ${token}` // Auth header
    		}
    	}).then(res => res.json().then(console.log)).catch(console.error); // Do better handling here
    }
  • Hello!

    In the project that I'm working on, on server side we have a javascript variable that I need to access inside the game.

    The game is being uploaded on the same page as this javascript variable is in.

    Is there a way to access this information from inside Construct 3 and then store it to a Global Variable or something like that?

    Thank you all!

    For now, I see that Scirra didn't charge me this month up to now. I hope to get some help about it, since I really need to get back to my project. The site says that the next charge will be only in the next month. I'm afraid of canceling it and doing another sub and next month be charged two times by mistake.

    Hello. I just sent an e-mail but I need help as soon as possible.

    My license, that is paid, isn't working. Even my C3 License Badge isn't showing on my Profile Picture here on the forums.

    The license page says that everything's paid. I have nothing in debt, my Credit Card is okay. I just don't get, what happened?

    If you guys can help me out, I will greatly appreciate, because I really need to use it and I can't work on my project since it is well past the limitations of the free version.

  • I got what I needed to work installing this plugin here:

    construct.net/en/make-games/addons/462/run-background

    It allowed the game to keep running some of the tasks in background. Does not work with the "Wait X Seconds" event, so if you have to play audio as a time based event, some math and comparisons with the WallClockTime variable should work fine.

    Won't work on Apple phones, though.

  • Hi guys! I have a game that runs on browser. In it, the player may want to keep hearing the audio of it even if doing other tasks (like reading a message or looking some social media app). The game keeps narrating some stuff while the player do other things in his phone.

    In the Audio Game Object, there's an option in it's properties called "Play in background". But it only plays in background the audio that has started playing while the player was looking into the game. Any audio that needs to be played after that one will not be able to be listened, needing the player to comeback and do some input.

    If it was a kind of a music player, the player would need to comeback to the app and hit the play button again to continue to listen to his music.

    Is this a bug? Is there some way to the user to keep listening to the narration of the game, that use different audio files, even when focusing on other apps?

    Thank you all in advance for any help provided! =)

  • Hello! I have a simple dropdown list in my game with ID set as drop1 and class dropdownlist.

    This list has 10 different options, but some of them have more impact than others, so I'm trying to change the color of those ones to be highlighted.

    I just can't figure out how to do it. Does someone knows any way to achieve that?

    Thank you all!

    Tagged: