noidlox_ban_8 Posted June 15, 2017 Share Posted June 15, 2017 1 hour ago, liverare said: Both have their pros and cons. You should look into trying all of them to understand them for yourself, where best they are applied and which you prefer to use. Throughout my RS scripting life, I've gone through all the funky and wacky methods of doing stuff, but none of them have worked for me. What I've found works best for me is to just cut out all the bullshit: Don't program; just script. Don't create dependencies; just duplicate them. Can you provide some examples? Link to comment Share on other sites More sharing options...
liverare Posted June 15, 2017 Share Posted June 15, 2017 6 minutes ago, Nugaex said: Can you provide some examples? This is something scruffy, but the logic's structured and easy to read: if (isAtBank()) { if (isInventoryFull()) { if (isBankOpen()) { depositLoot(); } else { openBank(); } } else if (isLowOnSupplies()) { if (isBankOpen()) { withdrawSupplies(); } else { openBank(); } } else { if (isBankOpen()) { closeBank(); } else { walkToMonsters(); } } } else if (isAtMonsters()) { // etc. } 1 Link to comment Share on other sites More sharing options...
Tom Posted June 15, 2017 Share Posted June 15, 2017 (edited) What if I told you they are the same thing, just one is more of an object oriented approach and reflects better practice. End result = State Machine Edited June 15, 2017 by Tom 1 Link to comment Share on other sites More sharing options...
Eliot Posted June 15, 2017 Share Posted June 15, 2017 2 minutes ago, Tom said: What if I told you they are the same thing, just one is more of an object oriented approach and reflects better practice. End result = State Machine True, but please don't ask for help with debugging a 10,000 line file. Thank you. Link to comment Share on other sites More sharing options...
Tom Posted June 15, 2017 Share Posted June 15, 2017 Just now, Eliot said: True, but please don't ask for help with debugging a 10,000 line file. Thank you. tfw all these people are bragging about there 30 line onLoops while I'm sitting here with a 4 liner 1 Link to comment Share on other sites More sharing options...
sudoinit6 Posted June 15, 2017 Share Posted June 15, 2017 My first scripts were state based and then I discovered tasks. As a noob who is shit at programming I find task based easier to troubleshoot, but really they are pretty much the same thing formatted differently. Just my opinion, but I am bad at this so take it with a grain of salt. 11 minutes ago, Tom said: tfw all these people are bragging about there 30 line onLoops while I'm sitting here with a 4 liner Let me show you my Tut Island script and its 60+ classes, it would make you vomit! Link to comment Share on other sites More sharing options...