|
Joined: Dec 2002
Posts: 2,809
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 2,809 |
One thing I didn't see anyone else mention. I can't speak for everyone, but for me, in addition to using /help a lot, the way I learned to script was by looking at scripts that other people have made. This is how I've learned every computer language I now know, and I think this is how many people learn. Reading a tutorial is one thing, but actually having working code that you can play around with is very useful because you don't have to start from scratch; you can modify what someone has already done and try and figure out what their code does. Once you get good at read other people's scripts, then you can venture out and create your own. If scripts were in a non-readable format, then this learning method would be, for the most part, removed. If the sole purpose of the encoding/compiling is to make it so people can't see your script code, then this whole method of learning will be gone.
|
|
|
|
Joined: Dec 2002
Posts: 1,321
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 1,321 |
If imitation is the sincerest form of flattery, ripping your script(s) is acknowledging you're some kind of minor diety (at least as a scripter/coder). The GNU Project
DALnet: #HelpDesk and #m[color:#FF0000]IR[color:#EEEE00]C
|
|
|
|
Joined: Dec 2002
Posts: 343
Pan-dimensional mouse
|
Pan-dimensional mouse
Joined: Dec 2002
Posts: 343 |
It's odd. I have difficulty reading some of my older scripts. Well, I am 99% sure I scripted the one I'm thinking about. I just forget how I scripted it since it's been years. Then there are new scripts, complex scripts, I write, which if I take a break, I'll probably forget how to update it and fix it.
|
|
|
|
Joined: Dec 2002
Posts: 2,809
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 2,809 |
Thats were good code commenting skills come in. If you write something that isn't obvious what it does, add a comment. Makes your life easier 5 years from now when you find a bug in it and you try to fix it and don't know what it is.
|
|
|
|
Joined: Dec 2002
Posts: 343
Pan-dimensional mouse
|
Pan-dimensional mouse
Joined: Dec 2002
Posts: 343 |
Not necessarily true. Complex scripts can be written well and still be confusing.
|
|
|
|
Joined: Jan 2003
Posts: 3,012
Hoopy frood
|
Hoopy frood
Joined: Jan 2003
Posts: 3,012 |
Thats also untrue. Any and all comments you can place help. Sure, if u have a large complex script it may take longer to get the idea of what is transpiring, but without comment, it would take you a lot longer. Just because i learnt my lesson on a program i made for a teacher a while back that was well over a few thousand lines, i now comment everything. Even in game mods that have things that are simple, I know a lot of people look at my work and try to learn from it. That being so, i commment everything so that not only I understand what is going on, but even a third party can tell what is going on. Ex:
function Game::menuRequest(%clId) {
%clName = Client::getName(%clId); // Client Name
%menuTitle = $KTMod::About::Title; // Menu Title
%curItem = 0; // Current Menu Item
if (!$KTMod::Menu::AllowMenu) {
Client::sendMessage(%clId, 0, "Menu is currently disabled");
return;
}
Client::buildMenu(%clId, %menuTitle, "::Options", True); // Build Menu
// Change Teams
if ((!$MatchStarted) || (!$Server::TourneyMode))
Client::addMenuItem(%clId, %curItem++ @ "Change Teams/Observe", "opt_changeteam");
// Selected Player Options
if (%clId.selClient) {
%selId = %clientId.selClient;
%selName = Client::getName(%selId);
// No Vote In Progress, and not admin
if (($KTMod::Admin::VoteTopic == "") && (!%clId.isAdmin)) {
// Not Already Super Admin
if ((!%clId.isSuperAdmin) && ($KTMod::Menu::VoteSAdmin))
Client::addMenuItem(%clId, %curItem++ @ "Vote To Super-Admin " @ %selName, "opt_vote_sadmin " @ %selId);
// Not Already Admin
if ((!%clId.isAdmin) && ($KTMod::Menu::VoteAdmin))
Client::addMenuItem(%clId, %curItem++ @ "Vote To Admin " @ %selName, "opt_vote_admin " @ %selId);
// Vote To Kick
if ($KTMod::Menu::VoteKick)
Client::addMenuItem(%clId, %curItem++ @ "Vote To Kick " @ %selName, "opt_vote_kick " @ %selId);
// Vote To Ban
if ($KTMod::Menu::VoteBan)
Client::addMenuItem(%clId, %curItem++ @ "Vote To Ban " @ %selName, "opt_vote_ban " @ %selId);
// Vote To Gag
if ($KTMod::Menu::VoteGag)
Client::addMenuItem(%clId, %curItem++ @ "Vote To Gag " @ %selName, "opt_vote_gag " @ %selId);
}
Thats just part of an admin menu I built, and as you can see, fully commented. Very legible, and easy to comprehend. Gotta love comments.
-KingTomato
|
|
|
|
Joined: Dec 2002
Posts: 196
Vogon poet
|
Vogon poet
Joined: Dec 2002
Posts: 196 |
That happens to me too.
One time I was going to fix up the bugs in my Add or Remove Modules dialog.
Then I decided to take a break from the highly complex code.
And when I came back, darn I almost forgot what to fix.
|
|
|
|
Joined: Jun 2003
Posts: 130
Vogon poet
|
Vogon poet
Joined: Jun 2003
Posts: 130 |
Yeah true thats how I learnt too. I don't know what the big deal with ripping if someone rips your script and takes credit who cares? Life goes on, All scripts are open source if you dont want people to see your code don't release it. Ive had people rip my scripts and make them even better than I did. Which encouraged me to make mine better. Thinking about codemastr's post, look at it this way all scripts double as a learning resource. "Knowlege belongs to the world".
If only women came with popup menus and online help.
|
|
|
|
Joined: Jun 2003
Posts: 47
Ameglian cow
|
Ameglian cow
Joined: Jun 2003
Posts: 47 |
your code seems to be like c++, programed in Visual c++ isn't it? lol
|
|
|
|
Joined: Dec 2002
Posts: 343
Pan-dimensional mouse
|
Pan-dimensional mouse
Joined: Dec 2002
Posts: 343 |
Comments would work. But it would take forever to go through the whole script. Hard to navigate since there are so many lines. One script which I consider medium is approximately 7000 bytes.
|
|
|
|
Joined: Jan 2003
Posts: 3,012
Hoopy frood
|
Hoopy frood
Joined: Jan 2003
Posts: 3,012 |
Well, now that i read this book on C Sharp (C#) I see its more C# than anything else. Yes it is a mix of C\C++, and C# but miore than ever C#. The code is very lose, and unstructured. Its for a game, Tribes, that i play. And actually, the source extentions are also .cs which does lead me to believe its C#... Wierd.
-KingTomato
|
|
|
|
Joined: Dec 2002
Posts: 2,809
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 2,809 |
Umm last I checked, C# doesn't use $ and % to represent variables of any kind. Only language I know of that does that is Perl, but that doesn't look like Pperl.
|
|
|
|
Joined: Dec 2002
Posts: 117
Vogon poet
|
Vogon poet
Joined: Dec 2002
Posts: 117 |
BASIC uses $ and % as well, that code doesn't look too much like BASIC though :tongue:
$input(Me like stars, You too?)
|
|
|
|
Joined: Dec 2002
Posts: 2,809
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 2,809 |
Ah yeah, good old BASIC... but doesn't BASIC put the $ at the end of the variable? Did a little Googleing for Tribes 2 Scripting Language, the best I found was "Dynamix Scripting Language" and Dynamix is the company that made Tribes 2
|
|
|
|
Joined: Jan 2003
Posts: 3,012
Hoopy frood
|
Hoopy frood
Joined: Jan 2003
Posts: 3,012 |
Well, the similarity is for the basis of the language, not the little things. The prefixes are just to represent the scopes. The % is to identify the local scope of a function, and $ being a global.
The nickname to those who mod is "Tribes++" as it is a mix of a lot of languages. The C++ shorthand ($var++, $var+=, $var--, etc) as well as other c++ shorthand is accepted. The language isnt type specific so %a could be 5.0 one minutes, "a string" the next, then back to 4. Just a very lost, but very easily worked, language >:D
-KingTomato
|
|
|
|
Joined: Dec 2002
Posts: 46
Ameglian cow
|
Ameglian cow
Joined: Dec 2002
Posts: 46 |
dog = number, dog$ = string. easy.
|
|
|
|
|