Gamemaker Studio 2 DnD Save and Load Text File

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello and welcome to today's video my name is joseph hope everyone's doing well today so i got a comment the other day by a user called israel and they asked can i convert the save and load system for text file i created a while ago into a dragon drop game maker tutorial i'm gonna highlight one i haven't done drag and drop in game maker for the past i don't know when was game maker 8 released i think 16 years ish was the last time i did something around drag and drop so this is my conversion so before i get into it massive thank you to everyone on the channel you guys are awesome you have no idea and i really appreciate you guys um you make a massive difference to channel so i'm going to show you first what i've done so you guys can see i've got my load button really poorly done my save button really poorly done and if i drag this over add windows you'll see no file and if i shuffle and i click the save key generates a save if i boot up the save you can see the same kind of data as you saw in the last tutorial and if i hit the load key it loads the same way if i delete my save save again it will regenerate if i hit load again it changes okay now that's out of the way let's discuss how this works my god did i forget how much i hated drag and drop let's get into it first steps first we create a save function so this works very differently from how um the normal practice of how we program works because certain functions can't be replicated the way i do them in execute code easily so what this does and i've tried to convert as much of it as i can to um drag and drop so the way this looks is this becomes the function do i actually still have an open is the other question no i do not so this in the original code here i actually use the if left button pressed equals to my mask effectively or the object id then execute code drag and drop doesn't do that very nicely so the way we do it is we use left press and then within the left press we have to declare all our functions that we did before so in drag and drop we've got all these lovely options and they've actually expanded it quite significantly from when i last saw it ironically going back to a video i'm in development hell with at the moment talking about structs which are literally where is it where is it where is it somewhere in these menus here uh declare attempt to plan macro i was staring at it before so in here there is there it is strucks i didn't even know that existed and i had a user comment to me and i've actually made a video that i'm just in the middle of finishing up to release as well so they added that that didn't exist originally okay so what this does back on topic is i have to declare the temporary value as what i did in the former code but i have to do it by drag and drop i declare my line count as well as a temporary value then i assign a value to my save now it's important that you have to use an assign value not a redeclare because otherwise when you're resetting it it doesn't work so this reassigns the value and in here you can see here i assign and pull the value down and then within the execute so the best way to think of this is this is here in between no man's land is the equals and then this is functioning out to what you're trying to get it to do the next thing we do is i have to execute some code because there's no nice way to run these functions so basically normally what you to do is these need something assigned to them but because it's not the way they work we have to look at it a different way execute code gets around that problem so i just drag the value back through into here run the execute and you can see here i've still got the classic oi that i put in there then i do the next step which is i drop down a line i then do another assign value which is line count plus one which means i add one to my line clamp line count then i go line count um give it a random a number as it functioned before then again another block of execute code the reason again is you can see here there's no easy way to run let's say a repeat function in here without making it very messy so i've just left a block of code in here which is the original code now i will highlight you can actually literally take my programming in the other one put in an execute code drag dump that in there and it works i did think about just putting that up as the video as a joke but i actually did some work on it for you guys so basically you can execute it out like this and it works the same way it is a lot messier in my opinion but it works now the other thing i should highlight is yes you get these execute code functions so super useful because you can actually take sections of code insert them and then if you needed to clear variables variables just declare them like you normally would using drag and drop okay so that's the load oh sorry the save function let's look at the load function the load function is a bit different because it's got a little bit more going on in it in the create we have to assign did i use the right one i think i did like i said i haven't done this for ages yeah a sign variable should do the same thing i think so assigning it hasn't given me any errors so assigning the error variables like this now i've declared them as arrays and we can do a declaration for an array this way inside these signs so we can still use our bracket function inside that so that assigns all the positions for the read to come through the next step is the left press so this is the same principles before because i can't do a simple read the way i do it before in code we have to go back a layer and use an event call rather than an execute code called in here it's pretty much the same song and dance i've declared a bunch of variables assigned values to them so you can see here for example i have assigned in here my text call function are not called sorry my um text read function same way as i done with my text save function as i break it down so i've literally tried to break it down into as much as i can so you guys can see how it kind of look basically breaking down each layer of the way again this block of text i couldn't modify because it's very tricky to find a repeat call and within this repeat call i've then got multiple functions happening that are important to how files are read so rather than breaking it down i try to keep it in one section then it's basically a close because we don't want to create memory leaks very important we don't create a memory leak and then the last step is we draw ourself and then we execute so i've left that the same only because this is more to do with just demonstrating that it's loading the data than it is uh actually showing that it's what's the word it's it's just a it's a test tool more so than it is a critical part of the function it's just to prove that the data's loading in and out okay so that's today's video i hope you guys enjoyed sorry about the bit of rambling it's been a while since i've used drag and drop i still wouldn't recommend drag and drop i'd go straight into um the gml side as ironically you can actually see here convert to gml so you can actually go straight to the gml side of things um but if you guys want help with drag and drop ask i might be able to do it i might not like i said it's been 16 years so i'll talk to you guys later have a great day and i'll see you next time you
Info
Channel: Domain Studio
Views: 264
Rating: undefined out of 5
Keywords: Gamemaker, Studio, tutorial, GUI, Programing, Easy, Help, GMS, If, DnD, Load, Save, Text, File
Id: MmzScO_f1ns
Channel Id: undefined
Length: 9min 33sec (573 seconds)
Published: Sat Aug 07 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.