|
Page 1 of 1
|
[ 9 posts ] |
|
| Author |
Message |
|
Promethius
Ambassador
Joined: Mon Feb 09, 2004 3:00 am Posts: 3141 Location: Kansas
|
 Basic Scripting Doc
The document below is for basic scripting in TWX. It was created using OpenOffice and saved as MS-Word compatible.
It shows some ideas on scripting, but by no means the only way to do something. It could have bad habits also in the examples, but it should give people a basic starting point. If you find errors, let me know. If it helps you write a script that pods me, so much the better.
Attachments:
File comment: Basic scripting
twxScripting.doc [142.5 KiB]
Downloaded 587 times
_________________
/ Promethius / Enigma / Wolfen /
"A man who has no skills can be taught, a man who has no honor has nothing."
|
| Sun Mar 15, 2009 10:56 pm |
|
 |
|
Promethius
Ambassador
Joined: Mon Feb 09, 2004 3:00 am Posts: 3141 Location: Kansas
|
 Re: Basic Scripting Doc
Looks like the document has been downloaded a few times. I need to find out if it is of any help, and what could be improved before I try putting together part 2 - and what should be included in part 2. I've never written any documentation type material for a computer scripting language and really don't know how far off base I am in the writing style.
_________________
/ Promethius / Enigma / Wolfen /
"A man who has no skills can be taught, a man who has no honor has nothing."
|
| Tue Mar 17, 2009 9:45 pm |
|
 |
|
mob
Boo! inc.
Joined: Sat Oct 09, 2004 2:00 am Posts: 865 Location: USA
|
 Re: Basic Scripting Doc
ok...
1. Nicely written, even for a noob scriptor. 2. Touched on some decent points and not just "basic" things. 3. It turns into an actual product that someone could use and test/edit to their liking.
It was very cool prom, I always get excited when you put something new out whether its a script or now your docs. Recently Ive noticed TWX scripting has been sort of a circle of people with some tricks/knowledge its cool to get some of this info out!
Thanks again killa!!
_________________ “The object of war is not to die for your corp but to make the other bastard die for his.”
Boo! inc.
|
| Tue Mar 17, 2009 9:53 pm |
|
 |
|
ElderProphet
Commander
Joined: Tue Oct 07, 2003 2:00 am Posts: 1133 Location: Augusta, GA
|
 Re: Basic Scripting Doc
In general, we in the inner circle, as you say, fall all over ourselves trying to answer questions and give examples. There is no shortage of willingness to help, but there is indeed a shortage of basic instruction and structured learning. Stand-alone docs like this are helpful. Regarding the doc, I have 2 points Prom. 1. You mention that my script editor, TWXIDE, might be worth a look. This tells me that you yourself haven't really given it a go. Shame on you. Try it and tell me it sux, but don't not try it for crying out loud. 2. You show a classic example of reading a text file into an array, line by line. I think it is useful to see as an example. You should follow it up with the dramatically faster readToArray command, which does the same thing in 1 line. Hopefully you find point 2 constructive anyway  Regards, +EP+
_________________ Claim to Fame: only guy to ever crack the TW haggle algorithm, and fig/shield/hold price formula, twice.
|
| Wed Mar 18, 2009 12:44 am |
|
 |
|
mob
Boo! inc.
Joined: Sat Oct 09, 2004 2:00 am Posts: 865 Location: USA
|
 Re: Basic Scripting Doc
ElderProphet wrote: In general, we in the inner circle, as you say, fall all over ourselves trying to answer questions and give examples. There is no shortage of willingness to help, but there is indeed a shortage of basic instruction and structured learning. Stand-alone docs like this are helpful. When TWX was released and people picked up TWX scripting there were a handful of veterans that took it on and it was at its height then. Now most of the scripts used today by some are either written by those veterans or by people who were kinda schooled along the way with them. There should be more players interested in this because thats how new scripts and new idea's become real. I really usrge new players to take on some small tasks with TWX scripting and make little things here and there with docs like this or the knowledge on Sings mirror of cabal. Thanks prom, and thanks ep for all your support to us trying to learn a couple things.
_________________ “The object of war is not to die for your corp but to make the other bastard die for his.”
Boo! inc.
|
| Wed Mar 18, 2009 6:53 am |
|
 |
|
Kaus
Gameop
Joined: Tue Nov 19, 2002 3:00 am Posts: 1050 Location: USA
|
 Re: Basic Scripting Doc
Promethius wrote: The document below is for basic scripting in TWX. It was created using OpenOffice and saved as MS-Word compatible.
It shows some ideas on scripting, but by no means the only way to do something. It could have bad habits also in the examples, but it should give people a basic starting point. If you find errors, let me know. If it helps you write a script that pods me, so much the better. I liked it Prom and have added it as one of my referances, It is very well written and wish I had it about 4-5 months ago when i was struggling with some key concepts. The twx window command was of some particular interest to me as I have not had a chance to play around with it. In part two if you feel so inclined a scroll back window example would be neat  * Off topic of the tutorial, TwXide rocks has some stuff that I hope EP address's in his next realease but the modularity of the program and size alone make it a great asset to any scripters repository. * I think the issue with scripting is allot (read: not all) of people are lazy when it comes to scripting (myself included at times). In that if it doesnt allready exist wait till it does. Public scripting can be a pretty thankless job and there are plenty of people that love to tear down scripts(often people who dont script). In my experiance there are even more people who don't want/don't have the time/don't care to learn even the basics for various reasons. So I guess it all comes full circle in that if its not easy it's not worth doing.* I look forward to your next installment prom, if the gods of this forum (Mod's) see fit maybe it will get stickied so we don't lose the thread into the abyss.
_________________ Dark Dominion TWGS Telnet://twgs.darkworlds.org:23 ICQ#31380757, -=English 101 pwns me=- "This one claims to have been playing since 1993 and didn't know upgrading a port would raise his alignment."
|
| Wed Mar 18, 2009 9:31 am |
|
 |
|
Thrawn
Commander
Joined: Fri Aug 20, 2004 2:00 am Posts: 1801 Location: Outer Rims
|
 Re: Basic Scripting Doc
I found it very useful, and after receiving your permission, have added it to the TradeWars Academy application project I am working on. Let me know when your part 2 is done and I'd be happy to add it as well.
_________________ -Thrawn
But risk has always been an inescapable part of warfare.
--
Knight to Queen's Bishop 3
|
| Wed Mar 18, 2009 10:57 am |
|
 |
|
Traitor
Lieutenant Commander
Joined: Thu Mar 21, 2002 3:00 am Posts: 890 Location: USA
|
 Re: Basic Scripting Doc
Ok, I'll bite. TWX Scripts .TS vs .CTS.cts scripts load faster, since they are already compiled. .ts scripts have to be compiled on the fly. It doesn't matter 99% of the time. However, all of my combat scripts are pre-compiled. Arrays"Arrays can be viewed as variables with a very distinct advantage, multiple setting of the variable (array) by using a looping structure such as while/end." You might want to add some more fluff about what an array really is and how useful they are. http://www.tw-cabal.com/strategy/twxscripthelp.html goes into some detail on that. Prom, feel free to take what you need from that. Using Script TriggersI would move that up higher. Understanding triggers is, in my opinion, more important than understanding arrays. I would move it above the Let's Create Something or even the TWX Windows section. MenusYou might want to add a section on menus too. Or just put a link in your doc to this one: http://www.tw-cabal.com/strategy/twxscripthelp2.html Menus are evil and tedious, but any complex script will benefit from properly coded menus. As to your code, it looks ok. However, I didn't look at it very closely.
_________________ http://tw-cabal.navhaz.com - THE TW info site
Man, I gotta quit showing up here...next thing you know i'll get dragged back in.
|
| Wed Mar 18, 2009 11:44 am |
|
 |
|
Promethius
Ambassador
Joined: Mon Feb 09, 2004 3:00 am Posts: 3141 Location: Kansas
|
 Re: Basic Scripting Doc
Traitor wrote: Ok, I'll bite. TWX Scripts .TS vs .CTS.cts scripts load faster, since they are already compiled. .ts scripts have to be compiled on the fly. It doesn't matter 99% of the time. However, all of my combat scripts are pre-compiled. Arrays"Arrays can be viewed as variables with a very distinct advantage, multiple setting of the variable (array) by using a looping structure such as while/end." You might want to add some more fluff about what an array really is and how useful they are. http://www.tw-cabal.com/strategy/twxscripthelp.html goes into some detail on that. Prom, feel free to take what you need from that. Using Script TriggersI would move that up higher. Understanding triggers is, in my opinion, more important than understanding arrays. I would move it above the Let's Create Something or even the TWX Windows section. MenusYou might want to add a section on menus too. Or just put a link in your doc to this one: http://www.tw-cabal.com/strategy/twxscripthelp2.html Menus are evil and tedious, but any complex script will benefit from properly coded menus. As to your code, it looks ok. However, I didn't look at it very closely. I agree with what you are saying and I made an assumption (which I tell people not to do when scripting) on the .cts and .ts script comparison. There is a delay on the .ts compile, but the execution speed once compiled is the same. The delay, no matter how small, can get one killed because it can give the opponent a split second advantage. I believe a menus section for part 2 would be a very good idea and I think providing a link to your example probably the most effective. I really don't want to reinvent the wheel on material that is already out and done very well. Part 2 will cover some additional information on arrays and hopefully give some food for thought to people. Ideally any tutorial should go through a peer review process of some type to insure accuracy.
_________________
/ Promethius / Enigma / Wolfen /
"A man who has no skills can be taught, a man who has no honor has nothing."
|
| Wed Mar 18, 2009 7:49 pm |
|
 |
|
|
Page 1 of 1
|
[ 9 posts ] |
|
Who is online |
Users browsing this forum: Bing [Bot] and 42 guests |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum
|
|