Recent topics Log in
Search Profile
Memberlist Usergroups
Log in to check your private messages
Register
TTC_JS.html development.
Goto page Previous  1, 2
Post new topic   Reply to topic
SpaceTrace Forum Forum Index » Strategy » TTC_JS.html development.
View previous topic :: View next topic  
Author Message
Renee Davis
1st Rear Admiral
1st Rear Admiral


Joined: 22 Jul 2005
Posts: 298
Location: Lautem, Timor Leste - Lautem District

 Post Posted: Wed May 02, 2007 3:08 am    Post subject:
Reply with quote

Clicking on the "?" button will now bring up a msg box with instructions in it. Geocities is trashing our code with thier advertisment add in's so, if you want this without the yahoo ads, best to copy the code below, post it into notepad or etc. save as a *.html file and load into ie explorer. Posting to the geocities site now as well.
***EDIT***
GMT time clock added below local time clock. New additions will be calculation of times to give user Local time and GMT time eta's
EX: "eta at 12:00 pm pdt / 8 pm gmt" or something like that.
Also a comparison of this method vs. nomal warp to get to destination ex "you save 0:02:30:45" (days:hours:minutes:seconds)
***EDIT***
ETA for using normal warp instead of a hyperdrop and distance added to output.

<html >
<head>
<title>SPACETRACE TRAVEL/TIME CALCULATIONS</title>
<body style="visibility: visible; font-weight: bold; font-size: medium; color: yellow; font-family: Arial; background-color: #333300; vertical-align: baseline; text-align: right; width: 4in; height: 3in;" language="javascript" onload="return window_onload()" > From->
<input id="x1" style="background-image: none; color: lime; position: static;
background-color: black; left: 131px; top: 47px; width: 64px; vertical-align: baseline; text-align: center;" type="text" name="x1" tabindex="1" language="javascript" onblur="return SplitCoords(1)" />/<input id="y1" style="background-image: none; color: lime; position: static;
background-color: black; left: 132px; top: 87px; width: 64px; vertical-align: baseline; text-align: center;" type="text" name="y1" tabindex="2" />/<input id="z1" style="background-color: black; width: 64px; color: lime; vertical-align: baseline; text-align: center;" type="text" name="z1" tabindex="3" />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br /> At -&gt;
<input id="x2" style="background-image: none; color: red; position: static;
background-color: black; left: 131px; top: 47px; width: 64px; vertical-align: baseline; text-align: center;" type="text" name="x2" tabindex="4" language="javascript" onblur="return SplitCoords(2)" />/<input id="y2" style="background-image: none; color: red; position: static;
background-color: black; left: 132px; top: 87px; width: 64px; vertical-align: baseline; text-align: center;" type="text" name="y2" tabindex="5" />/<input id="z2" style="background-color: black; width: 64px; color: red; vertical-align: baseline; text-align: center;" type="text" name="z2" tabindex="6" />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br /> To -&gt;
<input id="x3" style="background-image: none; color: blue; position: static;
background-color: black; left: 131px; top: 47px; width: 64px; vertical-align: baseline; text-align: center;" type="text" name="x3" tabindex="7" language="javascript" onblur="return SplitCoords(3)" />/<input id="y3" style="background-image: none; color: blue; position: static;
background-color: black; left: 132px; top: 87px; width: 64px; vertical-align: baseline; text-align: center;" type="text" name="y3" tabindex="8" />/<input id="z3" style="background-color: black; width: 64px; color: blue; vertical-align: baseline; text-align: center;" type="text" name="z3" tabindex="9" />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Warp -&gt;
<input id="Warp" type="text" style="width: 38px; vertical-align: baseline; color: aqua; background-color: black; text-align: center;" tabindex="10" value="5" />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp; x Hyper -&gt;
<input id="Hyper" type="text" style="width: 38px; vertical-align: baseline; color: fuchsia; background-color: black; text-align: center;" tabindex="11" value="1" />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
<input id="Button1" type="button" value="Calculate" onclick="return Button1_onclick(x1,y1,z1,x2,y2,z2,Warp,Hyper)" style="color: yellow; background-color: red; width: 90px;" tabindex="12" title='Calculate ETA for "From" - "At"' />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input id="Button3" type="button" value="?" style="color: yellow; background-color: red;" onclick="return Button3_onclick()" />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input id="Button2" type="button" value="Hyperdrop" onclick="return Button2_onclick(x1,y1,z1,x2,y2,z2,x3,y3,z3,Warp,Hyper)" style="color: yellow; background-color: red; width: 90px;" tabindex="13" title="Calculate coords and eta's for a hyperjump followed by a dropout" />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;<input id="TTC_Results" style="vertical-align: baseline; width: 278px; color: yellow; height: 41px;
background-color: black; text-align: center; float: none; page-break-before: auto; page-break-after: auto; overflow: auto; clear: both; position: static; display: inline; left: -26px;<br> visibility: visible; top: -16px;" type="text" name="TTC_Results" readonly="readOnly" />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;
<input id="LocalTimeClock" style="font-size: medium; left: -18px; vertical-align: baseline;
width: 278px; color: #ffcc66; position: relative; top: 6px; background-color: black;
text-align: center" type="text" readonly="readOnly" language="javascript" />
&nbsp;&nbsp;</br>
<input id="GMTTimeClock" style="font-size: medium; left: -18px; vertical-align: baseline;
width: 278px; color: #ffcc66; position: relative; top: 6px; background-color: black;
text-align: center" type="text" readonly="readOnly" language="javascript" />
&nbsp;&nbsp;
<script language="javascript" type="text/javascript">
// <!CDATA[
//Standard TTC -> Distance and time between 2 points
//Global Variables (accessable to other code segements)
var xn;
var yn;
var zn;
var t1 = new Date();
var t2 = new Date();
//
function Button1_onclick(fx1,fy1,fz1,fx2,fy2,fz2,fw,fh) {
// Departure
var dy1;
var dz1;
var dd1;
//Destination
var dx2;
var dy2;
var dz2;
var dd2;
var w;
var hw;
var ts;
//___________
dx1=parseFloat(fx1.value);
dy1=parseFloat(fy1.value);
dz1=parseFloat(fz1.value);
dx2=parseFloat(fx2.value);
dy2=parseFloat(fy2.value);
dz2=parseFloat(fz2.value);
w=parseFloat(fw.value);
hw=parseFloat(fh.value);
dd1=line_seg_point_dist_3d(dx1,dy1,dz1,dx1,dy1,dz1,dx2,dy2,dz2);
dd1=Math.round(dd1*1000)/1000.0;
ts=(dd1*9000)/(w*hw);
TTC_Results.value="Distance = "+dd1+" sectors ETA: "+parseSeconds(ts);
}

//Hyperdrop TTC -> Distances/times and (dropout) coords between two points in hyperwarp
//followed by a dropout of hyper into standard warp for a final destination
function Button2_onclick(fx1,fy1,fz1,fx2,fy2,fz2,fx3,fy3,fz3,fw,fh) {
// Departure
var dx1;
var dy1;
var dz1;
var dd1;
//Destination
var dx2;
var dy2;
var dz2;
var dd2;
//Final Destination
var dx3;
var dy3;
var dz3;
var dd3;
//Dropout
var dx4;
var dy4;
var dz4;
var dd4;
//___________
var w;
var hw;
var ts1;
var ts2;
dx1=parseFloat(fx1.value);
dy1=parseFloat(fy1.value);
dz1=parseFloat(fz1.value);
dx2=parseFloat(fx2.value);
dy2=parseFloat(fy2.value);
dz2=parseFloat(fz2.value);
dx3=parseFloat(fx3.value);
dy3=parseFloat(fy3.value);
dz3=parseFloat(fz3.value);
w=parseFloat(fw.value);
hw=parseFloat(fh.value);
dd2=line_seg_point_near_3d(dx1,dy1,dz1,dx2,dy2,dz2,dx3,dy3,dz3);
dd1=line_seg_point_dist_3d(dx1,dy1,dz1,dx1,dy1,dz1,xn,yn,zn);
dd3=line_seg_point_dist_3d(dx1,dy1,dz1,dx1,dy1,dz1,dx3,dy3,dz3);
dd1=Math.round(dd1*1000)/1000.0;
dd2=Math.round(dd2*1000)/1000.0;
dd3=Math.round(dd3*1000)/1000.0;
ts1=(dd1*9000)/(w*hw);
ts2=(dd2*9000)/(w);
ts3=(dd3*9000)/(w);
TTC_Results.value="Drop out at: "+xn+"/"+yn+"/"+zn+" in: "+parseSeconds(ts1)+" after: "+dd1+" sectors. Remaining ETA:"+parseSeconds(ts2)+ " after:"+dd2+" sectors...if normal warp is used instead: ETA is: "+parseSeconds(ts3)+" after: "+dd3+" sectors";
}

function Button3_onclick() {
alert("Instructions:\n 1)For standard tcc:\n A) Enter departure into top row\n B) Enter destination into 2nd row\n C) Enter the normal warp (not the hyperwarp) into warp input\n D) Enter hyperwarp boost (ex: wh's = 2.5, twn's = 3)\n E) Click on calcuate\n 2) For hyperdrop tcc:\n A) Enter departure into top row\n B) Enter destination in hyperwarp into 2nd row\n C) Enter final desired destination into 3rd row\n D) Enter the normal warp (not the hyperwarp) into warp input\n E) Enter hyperwarp boost (ex: wh's = 2.5, twn's = 3)\n F) Click on Hyperdrop ");
}

function MAXVAL(a,b)
{if(a>b)return a;else return b;}
function MINVAL(a,b)
{if(a<b)return a;else return b;}

function line_seg_point_dist_3d(fx1,fy1,fz1,fx2,fy2,fz2,fx3,fy3,fz3) {
var bot;
var dist;
var t;
var fx4;
var fy4;
var fz4;
if((fx1==fx2)&&(fy1==fy2)&&(fz1==fz2)) {
fx4=fx1;
fy4=fy1;
fz4=fz1;
}
else {
bot=(fx1-fx2)*(fx1-fx2)+(fy1-fy2)*(fy1-fy2)+(fz1-fz2)*(fz1-fz2);
t=((fx1-fx3)*(fx1-fx2)+(fy1-fy3)*(fy1-fy2)+(fz1-fz3)*(fz1-fz2))/bot;
t=MAXVAL(t,0.0);
t=MINVAL(t,1.0);
fx4=fx1+t*(fx2-fx1);
fy4=fy1+t*(fy2-fy1);
fz4=fz1+t*(fz2-fz1);
}
dist=Math.sqrt((fx4-fx3)*(fx4-fx3)+(fy4-fy3)*(fy4-fy3)+(fz4-fz3)*(fz4-fz3));
return dist;
}

function line_seg_point_near_3d(fx1,fy1,fz1,fx2,fy2,fz2,fx3,fy3,fz3) {
var bot;
var t;
var dist;
if((fx1==fx2)&&(fy1==fy2)&&(fz1==fz2)) {
t=0;
xn=fx1;
yn=fy1;
zn=fz1;
}
else {
bot=(fx1-fx2)*(fx1-fx2)+(fy1-fy2)*(fy1-fy2)+(fz1-fz2)*(fz1-fz2);
t = (+(fx1-fx3)*(fx1-fx2)+(fy1-fy3)*(fy1-fy2)+(fz1-fz3)*(fz1-fz2))/bot;
if(t<0.0) {
t=0.0;
xn=fx1;
yn=fy1;
zn=fz1;
}
else if(t>1.0) {
t=1.0;
xn=fx2;
yn=fy2;
zn=fz2;
}
else {
xn=fx1+t*(fx2-fx1);
yn=fy1+t*(fy2-fy1);
zn=fz1+t*(fz2-fz1);
}
}
dist=Math.sqrt((xn-fx3)*(xn-fx3)+(yn-fy3)*(yn-fy3)+(zn-fz3)*(zn-fz3));
xn=Math.round(xn*100)/100.0;
yn=Math.round(yn*100)/100.0;
zn=Math.round(zn*100)/100.0;
return dist;
}

function startTime()
{
var today=new Date();
var todayGMT=new Date();
var element=document.getElementById("LocalTimeClock");
var element2=document.getElementById("GMTTimeClock");
element.value=today.toDateString()+" "+today.toTimeString();
element2.value=todayGMT.toGMTString();
t=setTimeout('startTime()',1000);
}
function checkTime(i) {
if (i<10) {
i="0"+i;
}
return i;
}

function window_onload() {
startTime();
return 0;
}

function SplitCoords(idx) {
var element1=document.getElementById("x"+idx);
var element2=document.getElementById("y"+idx);
var element3=document.getElementById("z"+idx);
var coordStr=element1.value;
var coords=coordStr.split("/",3);
if(coords[1]&&coords[2]) {
element1.value=coords[0];
element2.value=coords[1];
element3.value=coords[2];
}
return 0;
}

// ]]></script>

<script language="vbscript" type="text/vbscript">
' <!VBDATA[

Function parseSeconds(s)
dim tStr
dim d
dim h
dim m
d = s \ 86400
s = s Mod 86400
h = s \ 3600
s = s Mod 3600
m = s \ 60
s = s Mod 60
h = checkTime(h)
m = checkTime(m)
s = checkTime(s)
If d > 0 Then
tStr = d & ":"
End If
tStr = tStr & h & ":" & m & ":" & s
parseSeconds = tStr
End Function

' ]]></script>

</body>
</html>
_________________
 Back to top »
View user's profile Send private message Send e-mail
DavAlan
Admiral
Admiral


Joined: 24 Aug 2004
Posts: 778
Location: Palo Alto, California

 Post Posted: Wed May 02, 2007 7:30 am    Post subject:
Reply with quote

blackmagic wrote:
Now here's an idea for you! Its a tactic I've used only a few times because its kinda hard to do.

I was able to trade ships in midflight after my ships were are different coords. This is a simplest way to cut down time to reconfigure your fleet. Say I attacked a base with my fleet1. My fleet 2 is 1 sector out. I see that after the battle that my fleet 2 has ships that will cause me to lose points but I want to attack the base. Well, the typical way to do this is the send fleet 1 to fleet 2's coords and send the unnecessary ships to fleet 1, but what i did was send both fleets to the other's coords and the minute they hit the mid point, I type in identical coords. Then I sync the fleets, change ships, and send my fleet 2 to the enemy base. This cuts down the attack time by 30 mins! tats a lot in some cases

Now if you can calculate a flight path and ETA to any set of coords where 2 fleets can meet and continue to fly, that was be insane.


Renee Davis wrote:
We call that one an "inwarp ship upload/download" It also works for dropping ships off at a base or stationary fleet as well with the proper timing.
Calculating midpoint would be easier then calculating for integer coord points. Would be david's "department" though.
David's eventual goal is to automate this, ex a function to adjust the fleet headings until the coords match.


This is aka an "intercept calculator" or rather, after I implement it the way I desire an "intercept automation", the calculation is easy and is a shorted version of the VC.exe I have already done. The longer and more difficult part will be getting this exe to enter and change fleet courses...also can be done easily enough but, gonna require ingame "field testing".
ReneƩ and I may go at each other with nano's and other harmless ships for this testing phase or just do eta's on each other in defensive.
_________________
"Destruction leads to a very rough road
But it also breeds creation
And earthquakes are to a girl's guitar
They are just another good vibration
And tidal waves couldn't save the world
From Californication"
Red Hot Chili Peppers - Californication
https://www.youtube.com/watch?v=YlUKcNNmywk
___________________________________
https://www.facebook.com/david.brass.524
 Back to top »
View user's profile Send private message Send e-mail
admin
Board Admin
Board Admin


Joined: 09 Jan 2002
Posts: 2938

 Post Posted: Sun Aug 29, 2010 9:51 am    Post subject:

there is a copy here:
http://www.spacetrace.com/addons/
 Back to top »
View user's profile Send private message
Display posts from previous:   
SpaceTrace Forum Forum Index » Strategy » TTC_JS.html development.
Post new topic   Reply to topic All times are GMT + 1 Hour
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
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 vote in polls in this forum




Solaris phpBB theme/template by Jakob Persson
Copyright © Jakob Persson 2003



Powered by phpBB © 2001, 2002 phpBB Group

Impressum