 Hello guys crypto grounds here welcome back to another idle game tutorial video. This is my fourth video I'm recording today, so sorry if I see it, so I've already messed up. I'm a little stuttery today because I've recorded four videos for the weekend. I am going to record as much videos related to the whiteboard and the tutorial because I need to push out some content because I definitely owe you guys it. And we're almost out 1000 subscribers so I'm preparing for 1000 subscriber video edit. So if you have any suggestions or I should else I should do for 1000 subscribers, please let me down below because I have no clue what I'm going to do. But anyways this video we're going to be doing automators. This is episode 22 I believe. If I'm wrong then there will be a text somewhere. But yeah let's get on with it. We're going to do automators. That's how I said. I promise I would do automators last video which for me was a few minutes ago I just said that. So yeah let's add another button. We're getting tons of buttons here the navigation is looking pretty messy. So that's up to you on how you want to organize it. So since we're adding another button I need to do one thing. I need to move these achievements because it's definitely like in a bad spot. That should fix it. I don't have events. How's events looking? Yeah I need to kind of move some stuff down. So here let's turn off the main screen and kind of adjust. So yeah this is kind of the problem with our stuff is that we're already getting really messy. So we can just drag this down. This isn't like the best way to do it because everything isn't anchored to the top. Make sure that's anchored to the top. Make sure everything here is also anchored to the top. This is stretch. Now we can just move Monday and that should be a lot better. So let's do Monday or it's a Tuesday now. So yeah if you need to have like a scrollrex thing you can do that. If you don't know how to do scrollrex let me down below and I can do tutorial on that or you can just simply google it on tutorial. Whatever satisfies you. So let's just do all this real quick. Now we can scale this downwards. Much better. Cool. Cool. Cool. Prestige. How's prestige looking? Okay. That's fine. We need to remove this right here. So this will be our automator button. This will be like auto buyers. So automator. All right. So now we need to do an automator screen. Like usual I just copy the previous one. I don't have to create new object every time and delete the old stuff. All right. Let's actually keep a button because we can just use those for later. And this will be called the automator screen or the auto screen. It's going to call it the auto screen. Yeah. I'm going to delete this button because I can just grab one of these right here. So yeah we'll just have the same upgrade system except we don't need a bimax. So how this is going to work. We're going to have an upgrade. We're going to have it unlock and we're going to have it like upgrade the speed. So let's move everything out. So I am, it depends on how time goes, but I think I'm only going to do one automator. So I'm just going to put this dead in the center and this will be actually all the two one for protection as well. So this is click. No, this is going to be click you for the click upgrade. And this is going to be called auto by click upgrade one or we'll just do click upgrade. Again, I'm assuming you guys would have names click upgrade one auto buyer and this will be this will cost this will be pretty pricey I believe. So let's just do one E4 coins or we can make these gems. We can make these cost gems. What do you think? What do you guys think? Um, let's make them cost coins, but if you want to do gyms or souls from the double prestige, you can just change the currency however you want in the script. So we have our first one and I have production production you okay. And this one will be production upgrade one auto buyer and we can make this one a little bit more expensive. Um, okay. So here we're going to do, come on, let me edit interval. Let's see what's the initial interval could be. It can be 10 seconds. Okay. And we can go all the way down to maximum, which is like every frame. Okay. We'll do the same thing for this one. Cool. So this will be we're going to make a new script called the automator manager. So I'm going to change this button name to automators and we're going to make a automator manager. Cool. Also another thing I think I actually never mind. I didn't screw up on anything. I thought this box was my auto screen. Also before we forget, change this to auto change because I forget every time. Cool. We are in before we forget again, we're going to import unity engine.ui namespace. All right. So we have, this is pretty much the same thing as this right here. So we can do this exact same way, the same setup. So what we can do is copy all this stuff from the prestige manager and go in here. And now we don't want this in here. Let's go to main before we continue. Let's do the navigation. So where's our groups? So we're going to add public canvas group auto group and then at the bottom here, we're going to add auto group, change the label to auto and we're going to set auto group to false on disable all. Now we're good here. All right. So our costs, we only have two. So we're going to have two to make sure you increase that. And also we're going to have to define a maximum limit. So if you want to have, so this can be completely based on, so let's actually, let's have a level cap levels cap shoot, we got to go back to our main. Sorry if I'm jumping around a lot. Hopefully it's not a big deal. We're going to add hashtag region auto majors hashtag and region and then here we're going to have public int auto level one auto level two. We only have two autos. So we're just going to do that. And we're going to make a region hashtag region autos tag and region awesome to zero. All right. So all right, we got some of it done, we need to add using static break infinity dot big double. But we also need to add, actually, I don't think we'll, yeah, we'll probably use that. We also just need to add, we need to add the just the regular break infinity class. It's actually struck the difference between a struct and a class, everything in the structs public. So it's basically like making a giant variable. Let's see. It's like this big, the big double. So the break, the break infinity is a name, sorry, I think I got looped up before, break infinity is a namespace and big double destruct. If that makes sense, instead of a class, class is like where it's private, everything or it's mostly private and a struct is like a public object where it can be used anywhere as long as you have the namespace. Hopefully I'm describing that correctly. So let's start defining stuff. So the first, so we only have two automators. So cost one is going to be equal to 1E4. Did you need it for use? No, 1E4, 1E5. So we're going to do 1E4, 1E5. I want to make these pretty pricey. So I'm going to keep this cost because I like them auto level one, auto level two. Now we need to have our costs. So before we do that, we need to add intervals. So level caps, level caps, okay, how am I going to do this? So let's do levels caps equals new int and we're going to cap that to, oh, actually what we can do is do new array. And we want the limit. So let's see. Let's say we want 20 levels, we're going to do 20 levels, we're just going to do 20, 20, done, 20 level is instant, all right. So let's let's plan how we're going to do this, we're going to how we're going to attack this. So let's go to notepad. So let's say we have 20 seconds or 10 seconds is our default and we've got 20 upgrades. So we could just do a half second every time, so 9.5, 9, 8.5, all the way down to 1. So let's see, we have 8, 7.5, 7, 7.5, 6, 5.5, 5, 4, 3.5, 3, 2.5, 2, 1.5, 1, 1.5, 0, where it's instant, okay. So here we actually have 21 upgrades. So let's actually increase this limit to 21, because 21 will be our instant, okay. So we'll use this in the future to prevent buying even more upgrades, because that really does that piece of purpose. So let's add intervals, this can be a public float array, public float intervals. So hopefully I'm not jumping too much around in this cost description, we will we will fix this eventually. So this is, this should be start automators, intervals, we're going to create a new int to, oh, it's a float, and that's why, okay. Also let's go back here, we're going to need this array manager again. So cost will equal cost one, we don't need that, we don't need that, auto level one, auto level two, all right, so there's our array manager, all right, make that private Okay, so let's grab these names real quick. So here's our auto screen. Where's all of our stuff? Oh, it's right here, it's not even in the actual screen itself, oops, all right, so we have our click one, auto buyer, and we have our production one, auto buyer, production upgrade one, auto buyer. Yep, and we only need two of those. Cool, cool, cool. This honestly runs very similarly to how we do it here. So it's pretty much exactly what we're going to do. So we can literally just take this UI from the prestige manager copy in here. And now we need to do game dot auto group and cost, text, length, we can do the exact same thing. So now we need to manage this a different way. So we can have level, we can also have, we don't add too much text, I guess I won't do level this time. So we have our description, we have our costs. Now we need our interval, interval. We need to define this too. So we'll add this to our array manager. So intervals zero is going to equal 10 times auto level one. No, it's 10 minus auto level one times 0.5. So now this is the part we got to be careful because if we have, oh, it can't convert, oh, why, what's the double? Oh, it's because 0.5 is a double, right? You can get rid of these parentheses. I'm so bad at those. So if we put this into a calculator, our max level is 21, right? So if we do 10 minus 21 times 0.5, we get negative 0.5 seconds, which we don't want. So we start at zero, right? So we need to somehow make this not work if it's zero. So we're going to do level minus one so that this zero is like when we unlock it, right? So that's level zero. Level one is like our second purchase up to 21 levels. So we'll just do this 21 minus one, which again is 20. And we have our zero seconds. So we're going to do if data auto level is greater than zero, then we're going to set our interval to this. And now let's see. Do we still need parentheses here? I don't believe so. Yeah. So we're going to subtract it by one. Otherwise, intervals is 10, I guess. We can just do it like that. Okay, we can do the same thing for our auto level two, intervals one. Just replace that. That's pretty much it for that. So we're going to have our interval. We're going to do intervals I. We're going to do F zero because we don't, we're going to do F one. Okay, I actually have an idea. So we're going to do if level at I is greater than or equal then. It's really, it won't go over 21, but that's just for safety measures. If level I is greater than 21 is greater than 21. Then our interval, then we're going to mention instant. Otherwise, shoot, we're going to do can't do that here. I was going to do two string F one. There you go. That should work. So if our level is maxed, it will display instant and it will do so. So that should be good for the UI. Oh, for the, for this now is going to be coins. So basically just going to do game.coins temp. And game.data.coins. Coins. I'm going to do coins temp. Now we already do this smooth number so we can just ignore this. Game.coins temp cost I cost bar smooth perfect. Also what we can do is if level of levels one is greater than levels cap. I for optimization purposes, because some of them might not be 21, you know. And you can also always change the interval thing here accordingly. Okay. So we need to add the buy, which we can go straight from buy upgrade. Copy this. And we got this now. So our level will be auto level one and we only have two. So we'll do auto level one and auto level two. So this is going to be coins, not gems. And that's pretty much it. Also we need to add an if statements. So we need to add and level is greater than. So basically if level is also greater than the interval cap. What's our cap? Is it levels cap? Levels cap ID. Then we will return it. Otherwise, if it's the levels less than the cap or equal to. So we need to do greater than or equal to because we don't want to buy more than what we already have than what the cap should be. So may she add if level is greater than levels cap it will return. Okay. We will not buy anymore. So I think we have all of this like the basic mechanics done. We just need to do like the automator stuff. So over here we're going to do void run auto. Okay. So this is a little tricky because we have to have like a timer. So we're going to add public float timer. And we're going to set timer equal to new float with size two, which is basically what we do for intervals. Cool. All right. And by default there's zero. So we're going to do if if levels zero is greater than is greater than zero. Then we're going to run this automator. All right. So we're going to do auto buying for us. So we will do a timer plus equals timer or this time dot delta time to delta time at index zero. Okay. So run that. But we also need to check if timer zero is greater or equal then. So we can have our our time or interval. So our interval. Where is that? Our interval is being set right here. If it's greater or equal than our interval and zero, then we are going to run the claim or the auto buy, which will be game dots by click one upgrade. Where is this? Click one upgrade. I forgot what they're called by upgrade. Okay. So it's by upgrade and we're going to do the correct one. So the thing with this being instance is that it could lag just a little bit. I think so we'll set this. So that's why I don't like doing instant upgrades at that point. We will just do by max. Okay. Yeah. That that sounds like a deal. We will just buy max game dot by upgrade and we're going to see one see one. Oh, yeah. That's it. Oh, nope. That's not it. We have to reset the timer. Okay. Okay. Cool. So now we need to make sure if, if levels is not equal to levels cap zero, then we're going to run this else. If it's capped out, then we are just going to game dot by let's see, how do we handle this? So I think what I'm going to do is I'm going to take this and not run the whole thing every time. So we're going to do if a game dot by click upgrade max is not equal to zero. So basically it means we can buy at least one. Then we're going to run by click upgrade max. That's it. Pretty cool stuff. So this is that. Now we need to do this exact same thing for production. This point, we can just do auto. We can input all this stuff. So instead of copying pastes twice, we can easily just put this in a new method, our own method in here. And let's see int ID. So this will be our ID here. ID ID ID. We need a string for the name string name. So put the name in here ID. And oh, we need to call our method to we do void. I don't think we can. Yeah, that's not going to work. Because this buy upgrade works. I think we would just have to do something in here. Okay, let's try this. So we're going to do switch. We're going to add a switch case right here. Switch case name. So if the name is C one, we're going to add this. And then break. Cool. And then now if we're going to do a production one, which is P one. We're going to do P one. And then we're going to do by production by production one max count. And by, let's see what is this one? Production upgrade one. Oh, it's just by. Oh, yeah, it's max. There we go. That's it right there. Cool. So now what we can do here, this is a very lengthy method, but you can easily expand upon this. Just very nice. You can just do auto. What's your ID? I think it's zero. And then the name is just C one. And that's that. And then for the second auto, we do P one. That is very it. So now instead of copying, pasting this tens of times for how many upgrades you have, all you got to do is that. And now we run our auto. We're going to do. Yeah, we're just going to run the auto. Cause yeah, that, yeah, that should be okay. I think we're done. Finally. Okay. So now in here, we need to add all of our stuff again. So what's cost this? Yeah, we don't need to do that. It's just the UI. I think that's it. Cool. So our elements are two, we're going to do two, two, two. Why is it three? That's why two, two, two. That's not going to make a difference, but we might as well just change it in there too. While we're at it. Cool. So now we got less stuff to drag in. So we have our, our cost text and our second cost text. Progress bar labeled progress bar. And then we have our smooth. Okay. So now these buttons, we need to apply. Oh, this is it. We need to drag our auto manager in here and do buy upgrade. So this is zero and this is one, I believe. Is that correct? Yes, that is cool. This is fun. I do this every day. I find my weaknesses and I get better at it. It's very nice. And if you're new to coding and you're not that great at it is what you say. Just code every day. Just do your best. Just put a few hours in every day and you'll get so much better. Look, just looks up online, how to do, how to do this certain way, efficiency and for the most efficient way. If you learn new things about C sharp, you're guaranteed to get better at coding fast. It just takes a lot of time though and effort. I'm not just like, I'm just going to just not work on it, but work on the tutorials and then I'm done. You got to do outside learning too. Anyways, I'm getting off track off task. So we need to add our canvas to the game manager, which is our auto screen canvas group. Why is that a canvas group? Okay, that's very weird. So make sure your auto group is a canvas, not a canvas group. Okay, auto screen. Okay, before I forget anything else, we need to drag this game. Let's try that again. Cool. I think we're done. Cross our fingers. Let's turn this off and let's go to our main screen. I am expecting bugs, by the ways. If you didn't know, I'm expecting bugs. All right, let's go to automators. I told you I was expecting bugs. Bugs always happen. And if you experience bugs, when you're free time coding, just go back and I'm pretty sure you can find a figure out your mistakes like I just did. Yeah. What? Auto group? Why is auto grouping a... Okay, that is odd. Why is there auto group the rebirth? Oh, it's because I'm stupid and I dragged in the wrong one. Pay attention. Pay attention, people. Okay, let's go to automators. Cool. So it looks like our progress bar is so far aren't working. I'm going to close all my other scripts because we got a lot open. So why is our UI... Okay, I see why. We forgot... So I tend to do this so much when I do methods like this, instead of adding it to the update, I just do this. But I keep forgetting to add the run. So in here, you just do... Oh, we don't have autos, don't we? No, I guess not. Public. So make sure you add public automator manager. And then I'm just going to put auto at the top of your main script. I'm going to do auto.run. So that means in our game manager object, we will need to drag our automator manager in here and the inspector. Save that. And it should work. Oh, index that range. What is it? Okay. So costs are set to zero. Why are costs set to zero? Okay, so we forgot to add our start manager too. So yeah, make sure you... Make sure you add all this stuff. Auto.startautomator in your start method. Okay. There we go. It works. So interval says zero. I should make it locked if it's upgrade zero, but it's okay. Let's try it. So there's no upgrades being bought at the moment. So let's buy our first one. Cool. So let's try it. See if it buys any. So it's level 138. Oh, just bought one. Woohoo. And go upgrade frenzy on this. Oh, we got negative. Okay, so it's buying past our limits. That's why. So yeah, we can't buy any of these. Ready? Look at that. Look at our automator go. Every two seconds now. This is OP. We can buy some of this too. So while that's going. Here, let's add eight. Instead. Okay, ready? This is not ready. Basically just auto buy max is at this point. That's so cool. So if we prestige, watch this. This is going to be so cool. Oh, we don't have any money. Look at that. Just auto buys for you. That's so cool. Here, let's prestige one more time. Ready? Look at that. That's so cool. I love this. I don't know. I have so much fun when I do this kind of stuff. Let's add nine. Let's do our production. So another good upgrade is to start prestige with this many coins. For sure. Yeah, look at that. That's so much fun. I love this kind of stuff. So anyways, we need to fix that negative factor or click, and then we are done. So let's go to buy. So we need to make sure if coins. Okay, so what I like to do is if this is getting mixed up, I can just add a method pretending like I'm going to do this. So you can do if coins is greater than or equal than coins and. And level is less than our cap. We can. So and less than our cap. We will return this. That's okay. That's that's the reason why it's because I didn't, I did this incorrectly. So make sure your buys doing this. So you're going to get negatives. So it should be if data coins greater than if. So basically it's the complete opposite of this because of this exclamation mark. All right. We could save that. It should not go negative anymore. Anyway guys, I really hope you enjoyed this video. I was really excited about adding this to this video. You have any suggestions? Oh, you didn't like me for a second. He was like being quiet. Anyways, if you enjoyed this video, make you leave a like and subscribe to my channel and turn on notifications if you're new. And let me know if you have any, or if you have any suggestions in the comments below. Anyway, thank you guys for watching. Peace.