VikasSanstha's Recent Forum Activity

  • So in the editor the comma is analogous to adding another x/width column? I see what's happening now, thanks for explaining it. Hmm, I'm happy to understand it, but it seems in this particular use case, that the choose route is probably the simplest. What do you think?

  • In the end I've decided to just use choose, it's simpler, there's no array, and it's easy to add or change colors. The end result is the same.

  • I would really like to learn how to accomplish this if anyone has any thoughts. It seems like it must be possible. The filename and therefore the prefix is passed through when it's loaded from the url, so there must be a way to store it and use it. This again is the crux.

  • What I don't understand is why all this becomes necessary just because I have populated the array of color choices via a JSON files as opposed to using the event sheet. None of this splitting up the r,g,b values was necessary when using the event sheet. It's still the same array, I don't get it. This seems more trouble than its worth. Overall it's more complex.

  • It may be easier to store colors as hex-string, for example #00aaff

    It's easy to convert them to RGB values with a bit of JS, see event 3 in this demo:

    https://www.dropbox.com/s/87rss2d46mt13iy/ColorPickerTextbox.c3p?dl=0

    Yes, hex would I think be easier since there is no delimiter. I was very surprised to see that C3 lacks hex support. It's so basic to HTML5. I hate working in RGB. As an aside the lack of color pickers in the C3 UI is a definite productivity hinderence. It would be like Photoshop not having a color picker.

    I see the JS for this is short. I will try to figure it out. Thanks!

  • Here you go:

    https://www.dropbox.com/s/lipxgfm97ed6l2y/Sentence%20tutor%20one%20array2.c3p?dl=0

    Note, that I moved "Set currentSentence" action into the "createSentence" function.

    Edit: also added 1px of transparent space around flags to fix the outline. Please re-download the file.

    Thanks so much! I'm going to study it a bit more. Very happy to hopefully learn how to do this efficiently, as it will be relevant in a lot of the content I create. The two separate arrays is a really bad way to work for bilingual educational content, since I would have to manually maintain synchronization across two separate files whenever changes are made, even something as simple as re-ordering.

  • If you check the JSON file, I removed the rgb().

    When you run the debug mode, you will see the different of 2 array.

    The bgColorEvents at 0 will be 10656511 instead rgb(255, 154, 162).

    So I think the Color of the BG when your get from the bgColorArrayEditor is just a string "rgb(255, 154, 162)" not a color.

    Then I break it to separate numbers R, G, B.

    When get from bgColorArrayEditor with randomY, example ramdomY = 0:

    - tokenat(bgColorArrayEditor.At(0,0) = "255, 154, 162"

    - R : int("255, 154, 162", 0,",")) = 255

    - G : int("255, 154, 162", 1,",")) = 154

    - B : int("255, 154, 162", 2,",")) = 162

    Then put all params inside the rgb() to make it a true color.

    Hope this is clear for you!

    Thanks so much for your time and expertise. Greatly appreciated! I will have to study this for a bit, but I'm eager to understand and learn, so thanks.

  • Choose and arrays are not options to achieve this.

  • Use choose("car", "truck", "bus") & ".png" in your URL.

    I have hundreds of images though, and they will occassionally be changed and refreshed. Also many separate lessons, so in the big picture thousands. Much easier if it's automatic. Choose is not really a viable option in this case.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Why don't you make it with revert way?

    - You have the name of the png.

    - Have variable call nameOfImg.

    - Load Image from URL with the path is nameOfImg&".png"

    - Then you display the nameOfImg in text.

    - And the nameOfImg can be random like choose("dog", "cat").

    How does it know what image to load though? I don't want the instruction for what image to load to be derived from text that I have to type. It can't use choose.

    I want it to load images from the project files folder that have unique filenames (not a common base followed by a number sequence) - either randomly or alphabetically, and then to derive the text in the textbox from the filename.

    I know this is possible in plain js. I didn't do it, but the programmer I was working with did. Just hoping it can be done it C3 also.

    Thanks for any assistance.

  • I updated a bit here:

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

    Thanks so much for sharing your expertise. I see now that it was not as simple as I was imagining it to be. Can you help verify that I understand what's going on?

    int(tokenat(bgColorArrayEditor.At(0,randomY), 0,","))

    This is the part I'm not quite clear on, what each value is and what it's doing

    (0,randomY), 0,","))

    Thanks again!

  • If I have

    car.png

    truck.png

    bus.png

    in the files section of the project, how can I randomly load one of them using load image from url. I know how to do it if they have the same base and a number.

    I've read every old post that seems related, and nothing. It would be terribly disappointing if this is not possible. Seems like it should definitely be doable.

    I also can't figure out how to simply load the first one, and then advance through them as the user clicks some sort of next trigger.

    Thanks for any assistance.

VikasSanstha's avatar

VikasSanstha

Member since 24 Jul, 2021

None one is following VikasSanstha yet!

Trophy Case

  • 3-Year Club
  • Forum Contributor Made 100 posts in the forums
  • RTFM Read the fabulous manual
  • Email Verified

Progress

6/44
How to earn trophies