lincolnsalles's Recent Forum Activity

  • I used the json dictionary object because it's easier to edit so many keys manually. And it is also possible to retrieve key values directly from json, without having to pass to a dictionary. But I can retrieve values in that json, but I can't parse the whole json looking for the numeric key I want.

  • I have a Json file that was created within construct 3 with the dictionary's native plugin in the "files" folder. It's like a dictionary, but I know that those files created in the file folder are actually Json files, correct?

    What I want to do is the following:

    Start of layout / Request file.json('tag")

    Ajax on "tag" completed / Parse json string Ajax.lastData

    So far so good. I uploaded the Json file.

    All the keys in my Json file are numbers. But what I want to do is parse all the keys looking for a specific number, until I find that number.

    When it finds the key that matches the number I want, I want it to return the value of that key. And then I want to show that value in a text object. How could I do this? I'm breaking my head because I'm a beginner at this.

    Tagged:

  • With the result like that you don't really need the dictionary. You can access the same data from JSON.

    For example:

    JSON.Get("Skills.Double Strike.Mana")

    will return the same value as

    Dictionary.Get("Skills.Double Strike.Mana")

    Hello. But would I be able to save the information directly from json to local storage? Or would I need to bake for a dictionary like he did?

  • Thanks for all the answers, they helped me a lot.

  • Here is an alternate way. It checks the value with all the other values and if any match it randomizes the number again and re-does the check.

    https://www.dropbox.com/s/z0an316nusgc6nu/unique_random_list.capx?dl=1

    If you were only concerned with the values 1 through 6 you could do something simpler like this too.

    https://www.dropbox.com/s/mb9he4ke03d7r23/unique_random_list2.capx?dl=1

    R0J0hound

    Thank you very much, I confess that your example was too advanced for me lol. I still don't deal very well with loops, but I'll save it to study this more calmly later on. Thank you for that.

  • Using the permutation table is quite easy. You initialize it with a length and a starting value, and it'll automatically randomize itself.

    Problem is, you need to create a visual pseudo-shuffling animation. To that end you can still use a normal random call, but when it's time to pick a final number, you do so using the permutation table at the correct index.

    Here's your modified example implementing what I explained :

    https://drive.google.com/file/d/1HkqVTyFrRjg0AvcsHcTZXT25oTs_D_89/view?usp=sharing

    Dude was really worth it. You showed me that I was making a mistake I was never going to guess, that index 1 of the permutation table is actually 0. How was I supposed to guess? So I was calling the index 1 from 1, when it's actually 0. And apart from that, I just changed your example by putting the table to generate not at the beginning of the layout, otherwise it would always be the same when clicking on the button, but I put it to generate when press the button and the variable is not starting.

    Thanks for all the replies. Many told me that I would have to use matrix for this. Glad you won't need it. This forum is really good.

  • I've read advanced random and from what I've seen, I have to use the permutation table, but I still don't understand how to use that in this project. I read but didn't understand :-(

  • I have a 6 random number generator. But no number can repeat itself.

    I use font sprite object for each of them, and each one has an instance variable, starting with 1 to 6. I also have a global score variable that goes up and so each number ends before the next one, until the 6 numbers finish randomize. It doesn't generate all 6 at the same time, first it generates the first, then the second, up to the sixth number. How do I make sure that no numbers are the same? I'll send the capx here. This is a simplified version of a slightly larger project that ran into this problem. I'll post the link here of the larger project on the itch.io page, which I also intend to post here. The objective was to generate random numbers to bet on the mega-sena, but could not repeat the numbers. A user reminded me well, that the numbers are repeating themselves, and that cannot happen. How to solve? Maybe I would have to store each number in a variable, but I couldn't do that either.

    Below the link of the capx project

    https://drive.google.com/file/d/1fxF-XBWxeRM2KtuSDWdWRjNQnkX3JXja/view?usp=sharing

    And below the link of the original project on itch.io.

    https://lincolnsalles.itch.io/random-number-machine

  • Thank you for your help

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • The method I normally use is to put play sound actions into a sub event that checks if a mute sound variable is true or not before running.

    Thanks for the answers. The way a friend of mine showed me solved the problem. It would be to create a variable for SFXvol and another for MusicVol and instead of the volume of sounds put this variable. When you want to mute just set the variable to -100 and when you want volume I'm using -15. The values can vary tb. I just got it that way.

  • A slightly complicated but successful method is to use arrays and functions to call the sounds/songs instead of using the standard audio expressions.

    This way you can control all sounds and music separately, and get rid of that awful clicking sounds that can still be heard when all audio should be muted. I can recommend checking out Advanced Menu in the Scirra Store - this includes a very effective menu select, settings like audio and language select, and achievements/trophies.

    If you purely just wanted audio, create an array that can toggle between 2 values on sound on/off button. Then use a similar code like this as the function that will be called.

    + Function: On "PlaySound" + AOption: Value at 2 = "on" -> Audio: Play Function.Param(0) not looping from Sounds at int(AOption.At(3)) dB (tag "")

    Then, to call the sound, ie a menu click or a bullet firing, instead of using -> Audio: Play bang_01.webm not looping at volume 0 dB (tag "") use the call function like this

    -> Function: Call "PlaySound" ("bang_01")

    I confess that this method is too advanced for me as a beginner, but thanks for that answer.

  • In this topic here, the same was asked, but it was not answered. I have the same problem. I created an options menu and one of the options when clicked mutes the game sounds, but I'm not able to implement that. I've already tested set muted, set paused, set volume, stop, etc. Only the silent set works, but then it silences all the sound of the game including the songs. I created a variable that turns the sound on or off, but you can still hear little bits of it while others are really muted. How can I actually implement what I see in many games?

    Remember that when I do the same scheme for the game music it works, but not for the sounds. And remembering that I'm using the sound tags.

    Tagged:

lincolnsalles's avatar

lincolnsalles

Member since 16 Aug, 2015

Twitter
lincolnsalles has 1 followers

Trophy Case

  • 9-Year Club
  • Regular Visitor Visited Construct.net 7 days in a row
  • RTFM Read the fabulous manual
  • Email Verified

Progress

12/44
How to earn trophies