drittnothing
2015-05-13 17:14:09
Hello people!
So im new to coding(yeah,kinda saw that in the title), but we did have some coding in the school(c++, but i didnt really pay attention). We learned that sudo code is a brilliant thing if you are going to write a code, so you know what to do and how it will work. Now im not good at writing this sudo codes, and i have checked the "learn this section", but i figured there are some good scripters/coders here, that can look trough the sudo code and give me pointers on whats wrong and right.
My idea is that i want to make a crafting script that makes gold bracelets, and ive tryed to make the sudo code after that. I havent written in the code "withdraw gold bars" and make "bracelets", ive just said withdraw items and make items, so its more "all-round" code for about anything that is about taking stuff out of bank, walking, clicking things, making things and walking back. The place ive selected to make this script work is Neitiznot, because short distance. The only problem there is that "find the bank" i gotta make myself(yeah, ive made that, not good but working).
If you have time to check out the code and write back to me, i would be relly happy! :)
Maby this can help other noobis like me to understand things better, and how to maby make a good first script :)
Here is my sudo code:
So im new to coding(yeah,kinda saw that in the title), but we did have some coding in the school(c++, but i didnt really pay attention). We learned that sudo code is a brilliant thing if you are going to write a code, so you know what to do and how it will work. Now im not good at writing this sudo codes, and i have checked the "learn this section", but i figured there are some good scripters/coders here, that can look trough the sudo code and give me pointers on whats wrong and right.
My idea is that i want to make a crafting script that makes gold bracelets, and ive tryed to make the sudo code after that. I havent written in the code "withdraw gold bars" and make "bracelets", ive just said withdraw items and make items, so its more "all-round" code for about anything that is about taking stuff out of bank, walking, clicking things, making things and walking back. The place ive selected to make this script work is Neitiznot, because short distance. The only problem there is that "find the bank" i gotta make myself(yeah, ive made that, not good but working).
If you have time to check out the code and write back to me, i would be relly happy! :)
Maby this can help other noobis like me to understand things better, and how to maby make a good first script :)
Here is my sudo code:
Sudo code
Functions to check stuff:
function IsBankOpen():boolean; // a function that checks if the bank is open or closed.
< Is the bank open code> // this will check if the bank is open or closed.
if <BankIsOpen> then // if the bank is open
return true; // it will return the state "true"
else return false; // it will return the state "false"
function AreWeClose():boolean;
<Are we close to the path code> // this will check the if we can find the path from where we are now.
if <We are close> then // are we close, or are we not?
return true; // yes we are close, so return true.
else return false; // We aint close, so return false.
function WhereIsOven(): boolean;
< code that finds the oven code> // here we have code that find the oven.
if < we can find it> // this check if we found it or not.
then return true; // returns true if we found it
else return false; // return false if we didnt find it.
function CraftingMenu(): boolean;
< code to check if the menu is open> // so here the code checks if the menu is open or closed.
if < yes the menu is open> then // if the menu is open and i get a true statement.
return true; // return that is open!
else return false; // else return false!
Procedures to make the program work:
procdedure Openbank(); // this function open bank.
<Find the bank> // this just finds the bank.
<open bank> // opens the bank.
procedure WithdrawBank(); // this procedure is going to withdraw the items.
IsBankOpen(); // check if the bank is open and return true or false.
if <IsBankOpen = true > then // If the function "IsBankOpen" returns true, then continue with code
<withdraw items> // it will withdraw the items with preset function.
else
< We need to open bank> // figures out the bank was closed.
Openbank(); // gives the procedure "OpenBank" a retry to open the fking bank.
loop back to IsBankOpen(); // somehow loop it back to the beginning. Need to set a "attempt loop" so it can quit after 5 attempts.
procedure CloseBank(); // this will close the bank.
IsBankOpen(); // gives the function "IsBankOpen" the job to figure it out, return a state.
if <bank open> then // if the function "IsBankOpen" returnes true
<CloseBank> // Close the fucking bank.
else
write "we cannot close bank" // we cannot close the bank. write a message.
exit; // exit the script.
procedure WalkToOven; // this will walk to the oven.
AreWeClose(); // check if we are able to walk to the oven. This will check the path.
if <AreWeClose() = yes> then // The function will return true or false.
<WalkPathOven> // we can walk it!
else
<We cannt find the way> // we cannot walk it..
exit; // exit the script.
Procedure FindOven; // this will find the oven.
WhereIsOven(); // will give the fuction "WhereIsOven" a mission to find the oven and return state.
if <WhereIsOven() = true> then // we did find the oven
<Click oven> // will click the oven.
else
write "we cannot find oven" // we dident find the oven and write that or failsafe.
exit; // will exit the script.
procedure MakeItem // so this is where the magic happens and it makes stuff.
CraftingMenu(); // the function "CraftingMenu" will check if the menu is open.
if <CraftingMenu = open> then // if it returnes true, then continue with make item.
<make item> // makes the item.
else // well looks like it wasent open.
write "we cannot make the item" // write we cannot make the item or failsafe.
exit; // exit the script.
Procedure WalkToBank();
AreWeClose(); // gives the function "AreWeClose" a job to return if we are or not. Returnes true or false.
if <AreWeClose = yes> then // if we are close and it returned true.
<WalkToBank> // walk the path.
else // we didnt recive a true statement, and it couldnt find the path.
Write "We cannot walk to bank" // writes we cannot find the road.
exit; // exit the script.