mikeadamski26's Forum Posts

  • Ok, I have this all set but am stuck at the "do your own thing part" haha. That's precisely my issue! I'm so close, but while I have it setup to allow a user to load in their own teams.txt file, it doesn't seem to be connecting/replacing the existing teams.txt as when I run the simulator again after loading the teams.txt, the names are not changing.

  • I've been reading a lot about arrays and have learned a lot (newb) here. As you can see in this little demo (that I have set to only generate a virus for players on a football team for testing), I'm trying to pull five positions without any of them repeating.

    To get the demo to the spot I'm struggling with, Click "Virus Possible" and 50%, then click Simulate. Click it until you get it to run a virus (I have it set to ignore everything else for now).

    You'll see that it's pulling in five names, but while demos/literature have helped me get this going, I'm certain my copying/pasting/reshuffling is not setup right.

    All I'm trying to get at this point is to pull 5 random names from my array without repeating any of them.

    Thank you for taking a look! Screenshots below:

    Tagged:

  • howtoconstructdemos.com/using-a-sprite-to-invoke-open-file-dialog-and-a-workaround-for-filechooser-bug-c3p

    Use "AJAX Request URL" action. Also I really recommend studying the documentation and a few tutorials. Many of the questions you ask are pretty basic.

    https://www.construct.net/en/make-games/manuals/construct-3/plugin-reference/ajax

    Thank you. I have been reading and looking through the tutorials. Here is where I currently stand:

    The current live activity (for an idea of what I'm building...load button still does not work yet): simsportsgaming.com/collegefootballscenariosimulator/index.html

    I'm trying to replace the "teams.txt" with the user's own custom version of "teams.txt" that they'd upload using the Load Teams button. That file has my *current* list of teams located here: simsportsgaming.com/collegefootballscenariosimulator/teams.txt

    My event sheet currently looks like this, however I still cannot get any new "Teams.txt" to replace the existing one. I must be missing a command, but I wasn't sure which AJAX command to use. I have tried via the version published for web and also on a desktop version.

  • 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.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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?

  • 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?