View unanswered posts | View active topics It is currently Sun Apr 26, 2026 8:01 pm



Reply to topic  [ 17 posts ]  Go to page 1, 2  Next
 Scripting help 
Author Message
Ensign

Joined: Fri Sep 19, 2003 2:00 am
Posts: 247
Location: Canada
Unread post 
Plugging away at some code here and have run into a bit of a wall(Grimy's forum down). What is the longest tunnel you have encountered? I cring when I see...

SetArray $Tunnel SECTORS

Is there any internal maximum that TWGS sets for Tunnels?

Zoso
Thanx in advance

_________________
No Quarter - Is what we offer our enemies


Mon Jun 13, 2005 3:44 pm
Profile ICQ
Commander

Joined: Thu Feb 20, 2003 3:00 am
Posts: 1529
Location: USA
Unread post 
no


Mon Jun 13, 2005 4:07 pm
Profile ICQ
Ensign

Joined: Fri Sep 19, 2003 2:00 am
Posts: 247
Location: Canada
Unread post 
Thanx for the quick response K3, anyone else care to comment any further?
quote:What is the longest tunnel you have encountered?

I suppose I ought to breakdown and grab myself a copy of TWGS so that I can test locally eh?

Zoso

_________________
No Quarter - Is what we offer our enemies


Mon Jun 13, 2005 5:02 pm
Profile ICQ
Commander

Joined: Thu Feb 20, 2003 3:00 am
Posts: 1529
Location: USA
Unread post 
I remember at least one 12 sector tunnel in a game. Don't remember anything larger than that right off hand.


Mon Jun 13, 2005 9:41 pm
Profile ICQ
Lieutenant Commander
User avatar

Joined: Thu Mar 21, 2002 3:00 am
Posts: 890
Location: USA
Unread post 
I haven't seen one more than 12 long either in a normal bang, even in 20k games.

As far as I know, there is no limit, you could get one 500 sectors long I suppose. And the sysop could always MAKE one that long too.

_________________
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.


Mon Jun 13, 2005 10:10 pm
Profile WWW
Ensign

Joined: Fri Sep 19, 2003 2:00 am
Posts: 247
Location: Canada
Unread post 
Kewl, I too haven't seen one more than 10 in length. Most of that size I have seen are generally comprimised anywas. I guess it's not a big deal to leave the array to univerese size. Just being picky I guess.

Zoso

_________________
No Quarter - Is what we offer our enemies


Mon Jun 13, 2005 11:56 pm
Profile ICQ
Commander
User avatar

Joined: Tue Oct 07, 2003 2:00 am
Posts: 1134
Location: Augusta, GA
Unread post 
I generally opt for dynamic arrays if I'm going to be looking at the variable dump in TWX. Keep in mind that you can zero an array after it has been created so you don't have to look at a 20,000 line variable dump of a static array. Use this syntax:
setArray $tunnels 0

Creating a dynamic array is faster than creating a large static array, so if you are just going to be working with an array of ~10 indexes, the speed of the static array will be moot.

+EP+

_________________
Claim to Fame: only guy to ever crack the TW haggle algorithm, and fig/shield/hold price formula, twice.


Tue Jun 14, 2005 1:31 am
Profile WWW
Ensign

Joined: Fri Sep 19, 2003 2:00 am
Posts: 247
Location: Canada
Unread post 
quote:setArray $tunnels 0

Just so I understand completly, The above Array will accept any amount of indexes, whether it be 1 or 1000.
Staying on the same topic, deos TWX support multi-dimensional arrays? (Dynamic/Static or both?) And is it limited?

SetArray $Tunnels 0,0

Zoso

_________________
No Quarter - Is what we offer our enemies


Tue Jun 14, 2005 9:48 am
Profile ICQ
Commander
User avatar

Joined: Tue Oct 07, 2003 2:00 am
Posts: 1134
Location: Augusta, GA
Unread post 
To recap, the syntax I used above is as follows:
setArray $tunnels 0

This command will clear any existing array named $tunnels, and create a new, unpopulated dynamic array. A dynamic array will accept any amount of indexes, and they need not be numbers as with a static array.

TWX does support multidimensional arrays. You'll usually declare each dimension of a static array at the beginning, as follows:
setArray $data 5000 20

That will create an array named $data with 5000 indexes, and each of those 5000 indexes will have 20 sub-indexes. I *think* the number of dimensions is limited to 256, or available memory... whichever occurs first. If you can understand how to make efficient use of > 256 dimensions, then you should be curing cancer, not playing TW![:P]

You can declare a dimension at any time, and you can even combine static and dynamic dimensions. So if you have a dynamic array $tunnels, and you find a new tunnel 11 sectors in size, you can create a static dimension in your dynamic array $tunnels, as follows:
setArray $tunnels[$tunnelCount] 11

A tutorial for Arrays in TWX is long overdue. Bug me enough and I'll write one.[;)] Until then, I hope this has been helpful.

+EP+

_________________
Claim to Fame: only guy to ever crack the TW haggle algorithm, and fig/shield/hold price formula, twice.


Tue Jun 14, 2005 10:53 am
Profile WWW
Ensign

Joined: Fri Sep 19, 2003 2:00 am
Posts: 247
Location: Canada
Unread post 
EP, Once again you surpassed what I had expected for an answer. Thanks for the great recap on arrays, and yes please write a tutorial, that is... when your done with all of your other projects [:D]

Zoso

_________________
No Quarter - Is what we offer our enemies


Tue Jun 14, 2005 11:31 am
Profile ICQ
Lieutenant Commander
User avatar

Joined: Thu Mar 21, 2002 3:00 am
Posts: 890
Location: USA
Unread post 
quote:Originally posted by ElderProphet

A tutorial for Arrays in TWX is long overdue. Bug me enough and I'll write one.[;)] Until then, I hope this has been helpful.

+EP+

Agreed. While this:
http://www.tw-cabal.com/strategy/twxscripthelp.html
Gives a pretty good description of an array, and a few examples of where to use them, it's still lacking. Well, that and the scripts are garbage compared to what I write now.

So, EP, after the next beta haggle, and after the next release of TWX Proxy, and after we iron out those other experiments... [:D], how about taking a crack at a revision of the above?

_________________
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.


Tue Jun 14, 2005 12:12 pm
Profile WWW
Commander
User avatar

Joined: Tue Oct 07, 2003 2:00 am
Posts: 1134
Location: Augusta, GA
Unread post 
Sorry Traitor... I didn't mean to say that in an insulting way.

Zoso, it's always a pleasure to help.

I actually wrote a tutorial once for TWXProxy.com, but lost it in a harddrive crash about a year ago. I'll see what I can come up with in the next few weeks. I think it would sure save people a lot of time. For most people who lack a computer science degree, arrays can be a tough concept. And even efficient TWX scripters probably don't use them in their full capacity.

+EP+

_________________
Claim to Fame: only guy to ever crack the TW haggle algorithm, and fig/shield/hold price formula, twice.


Tue Jun 14, 2005 6:40 pm
Profile WWW
Lieutenant Commander
User avatar

Joined: Thu Mar 21, 2002 3:00 am
Posts: 890
Location: USA
Unread post 
heh. didn't take it that way at all. I knew what you meant

_________________
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 Jun 15, 2005 4:17 am
Profile WWW
Ensign

Joined: Fri Sep 19, 2003 2:00 am
Posts: 247
Location: Canada
Unread post 
quote:I think it would sure save people a lot of time. For most people who lack a computer science degree, arrays can be a tough concept. And even efficient TWX scripters probably don't use them in their full capacity.

Nod, it took me quite some time to get my head around the concept of arrays. However, know that I've been fooling with them for a number of weeks I've begun rewriting alot of stuff I had done in the past.
Note - I'm really digging these multi-dimensional arrays.

Zoso

_________________
No Quarter - Is what we offer our enemies


Wed Jun 15, 2005 10:18 am
Profile ICQ
Lieutenant J.G.
User avatar

Joined: Sun Mar 13, 2005 3:00 am
Posts: 387
Location: USA
Unread post 
Zoso
One suggestion that really helped me with arrays especially dimensions was to look at it like a single dimension array is just a list of items a matrix(2 dimensional array) is was like a piece of paper with rows and columns a 3 dimensional array is a stack of pieces of paper.... a 4th dimensional was a filing cabinete with stacks of paper, where each drawer holds a stack of paper you can go on forever if you can visualize it to something you can relate to.

But there is an old saying K.I.S.S which if you as a scripter/programmer which you in fact are because you are making a program respond to outside stimuli whether it be a keystroke/responsive from the server or even the completion of another script.

Xide deserves more credit than he's getting. I for one am awed at the way he has written TWXProxy (even if Delphi is not my strong point) and hereby nominate him for inclusion into the TradeWars Hall of Fame.

_________________
Find out just what any people will quietly submit to and you have the exact measure of the injustice and wrong which will be imposed on them. Frederick Douglas


Thu Jun 16, 2005 12:03 am
Profile ICQ
Display posts from previous:  Sort by  
Reply to topic   [ 17 posts ]  Go to page 1, 2  Next

Who is online

Users browsing this forum: No registered users 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

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by wSTSoftware.