Goonstation Forums
DWAINE Telesci calculator - Printable Version

+- Goonstation Forums (https://forum.ss13.co)
+-- Forum: Discussion (https://forum.ss13.co/forumdisplay.php?fid=6)
+--- Forum: General Discussion (https://forum.ss13.co/forumdisplay.php?fid=7)
+--- Thread: DWAINE Telesci calculator (/showthread.php?tid=15065)



DWAINE Telesci calculator - Marksman - 09-12-2020

A few people have been asking for ingame dwaine telesci calculators on discord so i thought i'd have a go at making one

How it works is you change the numbers under #INPUT COORDS to where you send your gps
you then change the values under #GPS COORDS to where the gps ended up
and then finally you do the second test under #GPS INPUTCOORDS+1,

Once you have done that you can upload the code via Paper and a scanner, Or manually enter it with the minified version provided

https://wiki.ss13.co/User:Zamujasa/DWAINE_for_Smartasses#Scanning_documents
Code:
#!
# INPUT COORDS
eval 100 to x1
eval 50 to y1
# GPS COORDS
eval 52 to x1a
eval 180 to y1a
# GPS INPUTCOORDS+1
eval 59 to x2a
eval 87 to y2a
echo CALCULATING...
eval x2a x1a - to mx
eval y2a y1a - to my
eval mx x1 * to cx
eval x1a cx - to cx
eval my y1 * to cy
eval y1a cy - to cy
eval $arg0 cx - to xoutput
eval xoutput mx / to xoutput
eval $arg1 cy - to youtput
eval youtput my / to youtput
echo Adjusted Coordinates are
echo X=|echo $xoutput
echo Y=|echo $youtput
echo Made by Graham Harshman
echo PROGRAM END
MINI VERSION
For entering the code straight into a dwaine terminal
Both commands must be entered in order

Code:
echo #!|n#INPUT COORDS|neval 100 to x1|neval 50 to y1|n#GPS COORDS|neval 179 to x1a|neval 80 to y1a|n#GPSINPUTCOORDS+1|neval 183 to x2a|neval 82 to y2a|necho CALCULATING...|neval x2a x1a - to mx|neval y2a y1a - to my|neval mx x1 * to cx|neval x1a cx - to cx|neval my y1 * to cy ^ calc

Code:
echo eval y1a cy - to cy|eval $arg0 cx - to xoutput|neval xoutput mx / to xoutput|neval $arg1 cy - to youtput|neval youtput my / to youtput|necho Adjusted Coordinates are|necho X=|echo $xoutput|necho Y=|echo $youtput|necho Made by Graham Harshman|necho PROGRAM END ^ calc

I'd love to hear some feedback on this.
I intentionally left out any sort of teleman integration as something you can experiment with adding yourself


RE: DWAINE Telesci calculator - Boxta - 09-12-2020

This is pretty well done, script looks nice, Id add this to Dwaine for smartasses if i were you, ive been looking for a script like this so i could control tsci without having to do the cords manually, so that i could send just the GPS cords to where i am


RE: DWAINE Telesci calculator - Marksman - 09-16-2020

Thanks,
I have plans on shortening it a little bit, Ideally i was trying to find a way to store the GPS values in a seperate settings file however i was never able to find a way to make that possible. And i will maybe add it to the wiki if i compact it enough.


RE: DWAINE Telesci calculator - glassofmilk - 09-17-2020

Here is a version that only works with a paper in the scanner, but it provides a script that will generate a calculator script for you, so you don't have to manually insert your calibration values into the script itself each time you use it.

Code:
#!
echo GENERATING...
eval $arg6 $arg4 - to mx
eval $arg7 $arg5 - to my
eval $arg4 $mx $arg2 * - to cx
eval $arg5 $my $arg3 * - to cy
echo eval $arg0 $cx - $mx / to xoutput ^ tmp
echo eval $arg1 $cy - $my / to youtput ^ tmp
echo echo X value: ^ tmp
echo echo $xoutput ^ tmp
echo echo Y value: ^ tmp
echo echo $youtput ^ tmp
echo #! ^ calc
cat tmp ^ calc
rm tmp
echo DONE

Copy this from the scanner to a file named generate. After that, run the command generate $arg0 $arg1 x1 y1 x1a y1a x2a y2a. Type the $arg0 and $arg1 exactly as they are written, since these are placeholder values. X1 and Y1 are the first coordinate you enter into the console, and X1A and Y1A are the GPS results from sending to X1/Y1. The second set of console coordinates must be exactly 1 higher than the first set, and then X2A and Y2A are the GPS results from the second send.

Once the terminal outputs DONE, you can run calc x y passing in real coordinates for X/Y, and it will give you the calculated coordinates to put into the console.