Official ScriptUO EasyUO Scripts > Script Debug

Sub in a Sub???

<< < (2/4) > >>

TrailMyx:
Well, you can certainly justify using them.  Suppose a routine has a specific function used all over the script, but is mainly used in a specific subroutine.  Why not?

I guess I know from experience writing ScriptUO that when you hit a SUB tag, it does NOTHING.  It's just a tag marking a location for the GOSUBS to go.  So there's no overhead from a SUB; the overhead comes from the GOSUB since you have to setup the %0, %1, %2, %etc variables and perform the stack interaction and execution pointer jump.

However for me, I just would never do that.  I like code to have a specific flow to it.  Sub'n'subing just makes me think back to the good'ol days of coding BASIC using line numbers (MSBASIC, BASICA, ApplesoftBASIC, etc)  I'm not a fan of spaghetti coding, and this really smells like fresh pasta.  lol.  Thankfully, I'm allergic to pasta now.

Tidus:
i like to use the #result feature.  If it needs to go to a certain spot and it does it every time under the circumstance i use #true.  and make  an if statement in my main repeat sub so that it says if it returned true it goes here. otherwise it just continues on.

xxcaptainxx:
would one of you wise ones look at my heal and warn int he debug it is hurting my brain :)

TrailMyx:
You should try and implement some of the suggestions from CS, it'll work better that way.  Be sure to update your first post since I'm sure you have changed it some and add the recommendations.  Just be sure to balance your braces " { } ".

Ultimately, the best way to handle bandies is to do journal scanning; so I understand that looking at the Healing Commander here at ScriptUO can cause you some headaches.  I remember A-hardy had a journal-based bandage scanner; I'm not sure where that is now but it probably won't make your head hurt as much.

Bobkyou:
Would excessive use of subs in subs potentially cause a memory leak?  I don't know how easyuo is coded, but I would imagine it keeps track of each time gosub is called, and would need to see a return for each gosub to release the memory space.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version