mIRC Home    About    Download    Register    News    Help

Print Thread
Page 2 of 2 1 2
#43105 21/08/03 03:03 PM
Joined: Dec 2002
Posts: 2,809
C
Hoopy frood
Offline
Hoopy frood
C
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.

#43106 21/08/03 04:03 PM
Joined: Dec 2002
Posts: 1,321
H
Hoopy frood
Offline
Hoopy frood
H
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
#43107 21/08/03 07:06 PM
Joined: Dec 2002
Posts: 343
D
Pan-dimensional mouse
Offline
Pan-dimensional mouse
D
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.

#43108 21/08/03 09:08 PM
Joined: Dec 2002
Posts: 2,809
C
Hoopy frood
Offline
Hoopy frood
C
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.

#43109 22/08/03 02:56 AM
Joined: Dec 2002
Posts: 343
D
Pan-dimensional mouse
Offline
Pan-dimensional mouse
D
Joined: Dec 2002
Posts: 343
Not necessarily true. Complex scripts can be written well and still be confusing.

#43110 22/08/03 04:24 AM
Joined: Jan 2003
Posts: 3,012
Hoopy frood
Offline
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:

Code:
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
#43111 22/08/03 07:32 AM
Joined: Dec 2002
Posts: 196
T
Vogon poet
Offline
Vogon poet
T
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.


trenzterra
AustNet #trenzterra and #w
Head Scripter @ http://trenzterra.uni.cc
#43112 22/08/03 09:51 AM
Joined: Jun 2003
Posts: 130
O
Vogon poet
Offline
Vogon poet
O
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.
#43113 22/08/03 01:37 PM
Joined: Jun 2003
Posts: 47
J
Ameglian cow
Offline
Ameglian cow
J
Joined: Jun 2003
Posts: 47
your code seems to be like c++, programed in Visual c++
isn't it?
lol

#43114 22/08/03 06:30 PM
Joined: Dec 2002
Posts: 343
D
Pan-dimensional mouse
Offline
Pan-dimensional mouse
D
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.

#43115 22/08/03 07:09 PM
Joined: Jan 2003
Posts: 3,012
Hoopy frood
Offline
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
#43116 22/08/03 07:46 PM
Joined: Dec 2002
Posts: 2,809
C
Hoopy frood
Offline
Hoopy frood
C
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.

#43117 23/08/03 01:14 PM
Joined: Dec 2002
Posts: 117
R
Vogon poet
Offline
Vogon poet
R
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?)
#43118 23/08/03 03:46 PM
Joined: Dec 2002
Posts: 2,809
C
Hoopy frood
Offline
Hoopy frood
C
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

#43119 24/08/03 04:45 AM
Joined: Jan 2003
Posts: 3,012
Hoopy frood
Offline
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
#43120 24/08/03 02:50 PM
Joined: Dec 2002
Posts: 46
Z
zac Offline
Ameglian cow
Offline
Ameglian cow
Z
Joined: Dec 2002
Posts: 46
dog = number, dog$ = string. easy. laugh

Page 2 of 2 1 2

Link Copied to Clipboard