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



Reply to topic  [ 4 posts ] 
 SWATH Script Help Needed 
Author Message
Chief Warrant Officer

Joined: Sat Jun 05, 2010 2:05 pm
Posts: 152
Location: Indiana (blah)
Unread post SWATH Script Help Needed
Can anyone tell me what is wrong with this bit of code???

// start our main loop
for (loop = 1; loop < 10 ; loop++);
{
LaunchEtherProbe.exec(start);
start++;
if (start == Swath.main.currSector()) start++;
if (start > totsectors) {
PrintText.exec("\nMax sectors reached quitting!\n");
return true;
}
if ( maxcycles <= cycle ) {
PrintText.exec("\nMax cycles reached quitting!\n");
return true;
}
}

All of the initialization works correctly, values get passed, etc. But when I run the script, it launches 1 probe to the sector I tell it to start in, then the script just ends like it finished. I have tried setting the loop up with both "loop < 10" and "loop >10". No change.

I am trying to create a script that will probe all 20k sectors in the game I am playing in, starting at 1, and reloading on probes as needed. but if I can't get the basic loop to work, nothing else will either. Any help would be greatly appreciated.

_________________
The lord helps those who help themselves...
For everyone else, there's democrats...


Sat Jun 05, 2010 3:13 pm
Profile
Lieutenant J.G.
User avatar

Joined: Sun Mar 13, 2005 3:00 am
Posts: 387
Location: USA
Unread post Re: SWATH Script Help Needed
HiTechRedneck wrote:
Can anyone tell me what is wrong with this bit of code???

// start our main loop
for (loop = 1; loop < 10 ; loop++);
{
LaunchEtherProbe.exec(start);
start++;
if (start == Swath.main.currSector()) start++;
if (start > totsectors) {
PrintText.exec("\nMax sectors reached quitting!\n");
return true;
}
if ( maxcycles <= cycle ) {
PrintText.exec("\nMax cycles reached quitting!\n");
return true;
}
}

All of the initialization works correctly, values get passed, etc. But when I run the script, it launches 1 probe to the sector I tell it to start in, then the script just ends like it finished. I have tried setting the loop up with both "loop < 10" and "loop >10". No change.

I am trying to create a script that will probe all 20k sectors in the game I am playing in, starting at 1, and reloading on probes as needed. but if I can't get the basic loop to work, nothing else will either. Any help would be greatly appreciated.


Just some general help with scripting/programming....

When having problems.... Output the values of all the variables inside your loop....
such as maxcycles and cycles... this is important because the comparison might be causing your loop to abort.

I would also double check all initializations and if statements to make sure that they are what you
assume they would be.

What would happen for arguments sake... start is Greater than totsectors... your loop would
fire 1 probe and exec the PrintText routine and then return true....

<Edit>
After thinking about it some more... do you ever increment cycles?
I know it is just personal choice but I find it helps me to have the test variable come first...
i.e. if (cycles >= maxcycles) to me is more readable... but to each his/her own.


Do you get a message from the PrintText routine? Check both of them...

_________________
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


Sat Jun 05, 2010 4:42 pm
Profile ICQ
Chief Warrant Officer

Joined: Sat Jun 05, 2010 2:05 pm
Posts: 152
Location: Indiana (blah)
Unread post Re: SWATH Script Help Needed
Ok, I couldn't figure out how to print the values of the variables to the screen, so I tried something else. I reduced the loop part of the program to the following:

// start our main loop
for (loop = 1; loop < 10 ; loop++);
{
LaunchEtherProbe.exec(loop);
PrintText.exec("\nloop\n");

}

The script immediately launched a probe to sector 10, printed \nloop\n (with the \n instead of the CR I expected) and then exited. So it would appear that I have no idea how to do a classic FOR-NEXT loop in Java. Ideas? My understanding is that anything in the {} after the FOR command will execute in the loop, but it looks like the loop is running inside itself and then continuing on with the rest of the program.

_________________
The lord helps those who help themselves...
For everyone else, there's democrats...


Sat Jun 05, 2010 5:55 pm
Profile
Chief Warrant Officer

Joined: Sat Jun 05, 2010 2:05 pm
Posts: 152
Location: Indiana (blah)
Unread post Re: SWATH Script Help Needed
Never mind, I really AM a Java idiot...

for (loop = 1; loop < 10 ; loop++);
{
LaunchEtherProbe.exec(loop);
PrintText.exec("\nloop\n");
}

Should have been

for (loop = 1; loop < 10 ; loop++){

LaunchEtherProbe.exec(loop);
PrintText.exec("\nloop\n");
}

I used to program in different versions of BASIC (not VB, just plain good old fashioned B). This Java stuff is a royal PAIN!!!

Thank you for the advice though, that is what pointed me in the right direction.

_________________
The lord helps those who help themselves...
For everyone else, there's democrats...


Sat Jun 05, 2010 6:11 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 4 posts ] 

Who is online

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