mikeadamski26's Forum Posts

  • You can use FileChooser object.

    > + FileChooser: On changed
    -> AJAX: Request FileChooser.FileURLAt(0) (tag "tag")
    
    

    I just installed FileChooser and have my sprite button now working to ask for a file. Where I get lost now is with the AJAX part. I see the "Request project file" action but I am not able to select FileChooser, nor do I see FileChooser a chooseable action within AJAX. Then what you wrote after that (.FileURLAt(0) (tag "tag"), I do not understand what any of that means.

    Thank you for the assistance!

  • > I've tinkered a bit more, and see I can get a file to load using the FileSystem plugin. I'm a bit confused now on how to get a .txt file a user would load in and connect it in a way that it replaces the names.txt that's already in the project.

    >

    > Getting closer...

    just place a textinput(type:multiline) for user to paste it line by line

    Why can't they just upload a .txt file with each team name on a line? This way--since they would run this simulator a few times a week--could just make updates to the .txt file only if it would be necessary. I would think entering them in one at a time for every instance of the simulator would be tedious. Maybe I misunderstood what you were saying.

  • Here are three screenshots. I wasn't aware of a clock plug-in, but I'll check it out if you think it'll help.

    Also, here's a preview of the (not fully functional) activity/game.

    preview.construct.net

  • Something in this code is making my "sleep" variable count off by -60 instead of -2 when the clock minutes hit 20 and 40. When the clock hits 60 minutes, sleep registers as -2 as expected.

    It's driving me nuts!

    P.S. The actual seconds counter is disabled as I have it set to count by 10 minutes every second.

    [Clock]

    ----+ System: Every tick

    -----> Text_Clock_Hours: Set text to "0" & ClockHours

    -----> Text_Clock_Minutes: Set text to "0" & ClockMinutes

    -----> [DISABLED] Text_Clock_Seconds: Set text to "0" & ClockSeconds

    -----> Text_Clock_Week: Set text to "WEEK" & " " &ClockWeekTracker

    ----+ System: Every 1.0 seconds

    ----+ System: [X] Is ClockPause

    -----> System: Add 10 to ClockMinutes

    ----+ System: Else

    -----> (no actions)

    ----+ System: Every .5 seconds

    -----> Text_Clock_Colon: Set visibility Toggle

    ----+ [DISABLED] System: ClockSeconds ≥ 10

    -----> [DISABLED] Text_Clock_Seconds: Set text to ClockSeconds

    ----+ System: ClockMinutes ≥ 10

    -----> Text_Clock_Minutes: Set text to ClockMinutes

    ----+ System: ClockHours ≥ 10

    -----> Text_Clock_Hours: Set text to ClockHours

    ----+ [DISABLED] System: ClockSeconds = 60

    -----> [DISABLED] System: Set ClockSeconds to 0

    -----> [DISABLED] System: Add 1 to ClockMinutes

    ----+ System: ClockMinutes = 20

    -----> System: Subtract 2 from Sleep

    -----> Score_Sleep: Set text to int(Sleep)

    ----+ System: ClockMinutes = 40

    -----> System: Subtract 2 from Sleep

    -----> Score_Sleep: Set text to int(Sleep)

    ----+ System: ClockMinutes = 60

    -----> System: Subtract 2 from Sleep

    -----> Score_Sleep: Set text to int(Sleep)

    -----> System: Set ClockMinutes to 0

    -----> System: Add 1 to ClockHours

    -----> System: Add 1 to ClockHoursPM

    ----+ System: ClockHours = 13

    -----> System: Set ClockHours to 1

    ----+ System: ClockHoursPM = 24

    -----> System: Add 1 to ClockDayTracker

    ----+ System: ClockHoursPM = 24

    -----> System: Set ClockHoursPM to 0

    ----+ System: ClockHoursPM ≥ 12

    -----> Text_Clock_am_pm: Set text to "pm"

    ----+ System: ClockHoursPM ≤ 11

    -----> Text_Clock_am_pm: Set text to "am"

    ----+ System: ClockDayTracker = 1

    -----> Text_Clock_Day: Set text to "SUNDAY"

    ----+ System: ClockDayTracker = 2

    -----> Text_Clock_Day: Set text to "MONDAY"

    ----+ System: ClockDayTracker = 3

    -----> Text_Clock_Day: Set text to "TUESDAY"

    ----+ System: ClockDayTracker = 4

    -----> Text_Clock_Day: Set text to "WEDNESDAY"

    ----+ System: ClockDayTracker = 5

    -----> Text_Clock_Day: Set text to "THURSDAY"

    ----+ System: ClockDayTracker = 6

    -----> Text_Clock_Day: Set text to "FRIDAY"

    ----+ System: ClockDayTracker = 7

    -----> Text_Clock_Day: Set text to "SATURDAY"

    ----+ System: ClockDayTracker = 8

    -----> System: Add 1 to ClockWeekTracker

    ----+ System: ClockDayTracker = 8

    -----> System: Add 1 to ClockDayTracker

  • I've tinkered a bit more, and see I can get a file to load using the FileSystem plugin. I'm a bit confused now on how to get a .txt file a user would load in and connect it in a way that it replaces the names.txt that's already in the project.

    Getting closer...

  • If you only want one random name, you don't need a dictionary.

    I made a demo project, showing several possible options:

    https://www.dropbox.com/scl/fi/2oe16nkt0w6c300gq1fbl/NamesLoadFromFile.c3p?rlkey=4vqqojrzihooa1hyj9pj70ax5&st=48uvn2za&dl=0

    This is super helpful. Thank you. What I'm trying to do first is to allow the user to load their own .txt list of names. I thought that's what the loading of the AJAX would be doing?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ok, struggling still to grasp all of this. I have the ajax plugin now, but when I ajax action to request "teams.txt", nothing happens when I click the sprite.

    Beyond that, I'm reading what was written here and wondering how I get this .txt file loaded into a dictionary. I have very little experience with these, so I appreciate the steps like has been done before. I'm just struggling to get this to work.

    let's say you storage them line by line in one dictionary key:namelist, so tokenat(dictionary.get("namelist"),

    floor(

    random(0,

    tokencount( dictionary.get("namelist"),newline)

    )

    )

    ,newline)

    so now we have random line's value from "namelist"

  • Following up, my best guess is that it's related to how I have the sprite buttons setup for functionality?

    Hoping someone can help me get this sorted so that the activity can be used on mobile web browsers.

  • I have since added in the touch functionality, and while I have it set to replicate mouse clicks (I forget the exact name of that toggle), it's still not working with mobile touch after I upload it.

  • Maybe I made a big assumption, but I uploaded my game with sprite mouse clicks, and just assumed this would work with mobile touch.

    What am I doing wrong?

  • By the way, here is what I am building. I'm now trying to get this Load Teams button functioning from the posts above.

    simsportsgaming.com/collegefootballscenariosimulator/index.html

  • I want a user to be able to load in a list of names (.txt file? I have no idea). I'm guessing those would be stored in a dictionary or something? Perhaps that's not even necessary.

    Next, I want to randomly pull one name from that list that was loaded in by the user.

    Last, is there a way to save this experience for the user to use for next time?

    Thank you for this all. I'm working on this first step, but am not sure where to start. Is loading from ajax a system command? I have a button (sprite) that I want to set as a "Load" button that when clicked, the user could load in their text file of names. From there, I would load that list into a dictionary it sounds like?

  • I have things working well now, but having issues getting my button to "stay selected" which should have it sitting on animation frame 3 after being selected/clicked on.

    I cannot figure out why this isn't happening! The calculation adjustment is working, so I know it's registering my button selection. I thought it was the else statement, but when I disable that, I still cannot get this button to stick to animation frame 3.

  • I am completely new to dictionaries, JSON, etc. What I'm trying to do is this, which I'm sure is quite easy for most of you:

    I want a user to be able to load in a list of names (.txt file? I have no idea). I'm guessing those would be stored in a dictionary or something? Perhaps that's not even necessary.

    Next, I want to randomly pull one name from that list that was loaded in by the user.

    Last, is there a way to save this experience for the user to use for next time? I'd like it to retain the previous list until changed. Obviously the user could upload a new one when necessary.

    Please keep in mind that I have yet to ever publish a game or even know yet how to even make a game/save state function.

    Thank you for the guidance! I'm learning a lot, and already working on a second concept which I am finishing up before the larger game I'm working on. This has been so fun!

  • Thank you! That worked like a charm adding the opacity condition.