ScriptUO
Official ScriptUO EasyUO Scripts => Scripting Chat => Topic started by: Crisis on April 11, 2015, 12:29:15 PM
-
I have some questions about this to make sure that I am solid in any future scripting attempts:
1. Capital letters vs lower case: Can I set something with caps set %Secure and then call it with %secure? Does it work the same with menus?
2. Underscores: Is there any benefit to separating words with underscores vs putting the two words together? %mage_book vs magebook
3. If these capital and lower case letters are interchangeable and words using underscores or combined don't really matter, does it make a script flow smoother or look neater by doing one vs another?
-
doesn't matter ... all personal choice.
People do it certain ways as they think it makes it easier to read or just thats how they like it
MageBook
magebook
mage_book
mAGEbOOK
etc
I tend to do MageBook_1
MageBook_2
Pick your poison.... ;D
As to whether %Magebook and %mAGEbook are the same variable I've forgotten %mage_book is defainatly not the same as %magebook
try this to get answer
set %magebook YES-same
display ok are they the same ? %MAGEBook
halt
-
Very good question Crisis. I'm sure they are getting tried of my 1 billion newbie questions. I was wandering the same thing.
And Thanks for the answer EN.
-
Capitalization definitely does not matter. %MageBook, %MAGEBOOK, %MaGeBoOk, etc are all the same variable.
-
Even if it doesnt matter its an unwritten rule to format variables by the same kind. Back then on euo i prefered lowercase combined with _
like %ocr_code_for_lethal_darths_quest so the naming was good and selfexplaining but i also saw people coding like subs in subs to obfuscate functions like
sub blabla
gosub %1 %2 %3 %4
It depends on your style and target of consumers. If you just want good code clearly readable and understandable a stil together with some patterns are always good. If you want to make it impossible to read name your vars like %jch443hcd439nuc and make anonymous sub calls.
-
I wish I would have adopted a convention and stuck with it. Sometimes my code uses the underscore, sometimes I capitalize. The curse of a lazy programmer I suppose. :) Whatever makes your code more readable for you.
-
I wish I would have adopted a convention and stuck with it. Sometimes my code uses the underscore, sometimes I capitalize. The curse of a lazy programmer I suppose. :) Whatever makes your code more readable for you.
So lot of us will be like you. since you had been teaching to most of us :)
-
So lot of us will be like you. since you had been teaching to most of us :)
I hadn't thought about that. I apologize in advance for my schizophrenic code and its affect on the masses!
-
So lot of us will be like you. since you had been teaching to most of us :)
I hadn't thought about that. I apologize in advance for my schizophrenic code and its affect on the masses!
Haha, I'm guilty of learning some of your bad habits then considering my first, mostly personal, works were slightly modified TM plagiarisms while I learned the ropes. I think I'm now down to my Gumpwait sub still holding on to your design of passing two Gump name options instead of just one (although I never use the second) simply because I had no idea WTF I was doing and thought it was a requirement lol. Happily, everything else is guilt-free! :D hehe. Boy that was a long time ago... *insert nostalgic sigh here*
On the topic of caps, I'm typically a %MyVarsAreLikeThis kind of guy - I've even gone back and cleaned up scripts to fix this very thing, not that they are all addressed now. I like things to be readable and I HATE having to use a Shift+_ combination every time I type out a variable - ewww!!!!
X
-
Call it OCD but I use most of the time first letter capital Gosub DropItem, MoveItems sen to be easier to read.
-
Nice to see everyone pick at each other and have a great time what makes the days go by good.
-
...guess I am the twisted one...
set %bANKbAG SHEEZZ