Nilom's Forum Posts

  • Thank you so much for your time and efforts!

    Okay I will do that. Is there a way how I can disable BBcode from within the events? I didn't find it yet.

    Edit: For now I achieved this by placing a Text object in the editor on the layer with BBcode disabled which gets destroyed on startup.

    And it works! Awesome. :D

  • It's basically just the part in the second picture. But I uploaded a dumbed down version of the project where the issue still persists.

    drive.google.com/file/d/1tu3wghFCFtbmjTKpAjwt4I-Q2WwG8gL7/view

  • Ahh. Good to know. But how comes that letters like g j q y get cut in the bottom part when I set the Text objects size to "Text.TextWidth, Text.TextHeight"?

    I know I could just put Text.TextHeight+20 or something like that but I wanted to have a scalable system.

  • Thank you that's a good idea to pre-place a hidden text object. I will test that out.

  • Hello!

    I have issues getting the correct text height.

    The result is that letters like g, j, q, y are cut and that the text is not centered correctly inside the buttons.

    Is it true that the height of letters like g, j, q, y, which pass the imaginary bottom y-line of the letters (red line), are not correctly calculated? It seems to me that Text.TextHeight is only calculated from that imaginary line to the top (red arrows).

    It's a bit hard to describe what I mean so I tried to skatch it. How can I calculate the pixel height between the violet arrows?

    This is the function that I'm using to create buttons.

  • Hello.

    I have two questions about good Construct 3 practices.

    Question 1:

    If the app that I'm creating has a sign-in system and account creation etc., or let's say some sort of complexity, is it better to have these systems on separate Layout- and Event Sheet Pages? And let's say after signing in move to another Layout to have less code in the "Event loop" or doesn't it matter too much? (I do not use any handpositioned objects in the layouts.)

    Question 2:

    Is it better for the performance/workflow to use variables to toggle parts of the Event Sheet or to just put said parts in groups and activate and deactivate them as needed? In the example above that could be the sign in or account creation processes.

    Thank you in advance.

  • Thank you! This will help me later.

    Now I am a little despairing about how I can create nested objects with the eventing system.

    I am trying to do something like this:

    Characters: [
    
    	{
    	id: loopindex
    	class: randomClass()
    	hp: getHP(self.class)
    	},
    	
    	{
    	id: loopindex
    	class: randomClass()
    	hp: getHP(self.class)
    	},
    
    	{
    	id: loopindex
    	class: randomClass()
    	hp: getHP(self.class)
    	}
    
    ]
    

    So inside the object Characters each of the characters should have his own object with own key: value pairs for storing its id, class, hp and many more.

    I guess I have to push an array and inside that array an empty object or so. But I can't get it to work.

    The current state of my events:

    I changed it many times but it is hard without an example. :(

  • dop2000 thank you for your answer. :)

    Ok that is a bit unfortunate.

    Then I will set the data up as a javascript object via script event and then load it to a global variable. For saving and to use that object with the eventing system.

    What I wonder is however, how can I make this object readable by the runtime engine? Do I have to parse it or something like that?

    It is inpractical, that there is no eventing system for dealing with js objects, like with the arrays.

    I need the data structure to be a js object. Arrays would be a pain.

  • Is there a way to write to one of the projects JSON files? I wanted to use it as kind of a database.

    If there is no way to do this, how much would be the performance impact and memory usage of an javascript object containing thousands of key/value pairs? (Up to 30.000 - 50.000)

    And would it be possible to save this object to one of the projects global variables and save&load from local storage?

    Thanks in advance!

  • You are my hero! I will try this later. Got sick yesterday but today I feel better.

    Thank you again for your help. :)

  • Hmmm. This is strange. raids is a global variable that I parsed AJAX data to. It should be an object.

    I described in this post construct.net/en/forum/construct-3/scripting-51/parse-json-objects-return-149689 how I sat it up.

    Did I do it wrong?

  • Wow this is super awesome! I will test it out as soon as I am at home. Thank you for the efforts! :)

  • Hello!

    I would like to use the javascript filter() method. Is it possible with scripting in Construct 3?

    I tried it both in the editors script file and in the add script command in the events.

    raids.filter(raids => raids.id === localVars.raidID1)[0].raidMembers.filter(x => x.isConfirmed)

    Both times it gave an error message in the console "filter is not a function".

    How can I use Javascripts filter() method?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thank you very much for this idea.

    I asked the programmer if he could restructure it that way and he told me it wouldn't work, because the IDs are dynamic.

    But he told me about variable.filter(). That is pretty handy and I think I can use it.

    Thanks again. :)

  • Thanks for the reply. I know about arrays. But how would I know the array index from, lets say the player name and his level inside one of the raids/dungeons? I would need arrays with named indices. Instead of array.0 I would need something like array.raidID.playerID.name. Or array["raidID","playerID","name"].