Staredit Newtork
Community
StarCraft
Games
Site
Favourites
Tips for Tedious Coding

Creator: A_of-s_t
Time: Mar 24 2008, 4:02 am

Post #1     A_of-s_t Mar 24 2008, 4:02 am

[Avatar]
Master of Temptation, Ruler of Aeronotics, and Secret Lover
 offline contact
Tips for Tedious Coding

Part 1 -- Tips for Tedious Coding: An Introduction into Javascript

Have you ever had to produce tedious lines of code, or wanted to produce a cool effect, but didn't feel like writing everything out? Now, I shall unveil and easy way for the production of tedious lines of code. Yay!

Have you ever heard of javascript? Its a type of scripting language -- but heres the secret -- that is uncompiled. All you need is a text editor! So, lets open up our favorite text editor -- which I shall assume is Notepad++.

Introduction:

Now, let's type in the basic part of the script that we need:


Code

var fso = new ActiveXObject("Scripting.FileSystemObject");
var outputFileName = fso.GetParentFolderName(WScript.ScriptFullName) + "\\" + fso.GetBaseName(WScript.ScriptFullName) + ".txt";
var outputStream = fso.CreateTextFile(outputFileName, true);"


-Line 1 states we are creating a new object.
-Line 2 states what its name shall be.
-I don't really know what Line 3 is (I'm guessing it is merely outputs untill told to stop.)


Now, lets make something we can all enjoy: SPINNING PROBES!!!!!


Code

var currentSpinSpeed = 1;
while(currentSpinSpeed < 13) {
    currentSpinSpeed *= 1.02;
    outputStream.WriteLine("     turncwise " + Math.floor(currentSpinSpeed));
    outputStream.WriteLine("     wait 1");
}


So, we set our variable "currentSpinSpeed" equal to one. While this variable is less than 13, we multiply it by 1.02. In the text file it will output, it will write the line "turncwise + Math.floor(1.02)" -> "turncwise 1" Can you see with Math.floor does? It takes any non-interger and round it DOWN.

Now, our code is almost done, all we need is one final line:

Code

outputStream.Close();


We tell our program to finish and close the file.


Our final code looks like:
Quotevar fso = new ActiveXObject("Scripting.FileSystemObject");
var outputFileName = fso.GetParentFolderName(WScript.ScriptFullName) + "\\" + fso.GetBaseName(WScript.ScriptFullName) + ".genicc";
var outputStream = fso.CreateTextFile(outputFileName, true);

var currentSpinSpeed = 1;
while(currentSpinSpeed < 13) {
currentSpinSpeed *= 1.02;
outputStream.WriteLine(" turncwise " + Math.floor(currentSpinSpeed));
outputStream.WriteLine(" wait 1");
}

outputStream.Close();


Save the file as: probeBuildUp.js. Now click on the file and it will create probeBuildUp.txt.

*This javascript originally comes from BSTRhino. I have used it because if its simplicity -- yet stunning visual effect :P I luve spinning probes :D
-----------------------------------


Bouncing Grenades:

I have always loved this effect, and all it requires is iscript magic.


Code

var currentFrameNumber = 0;


Set the current frame number.

Code

function generatePlayFrameCommand() {
    outputStream.WriteLine("     playfram " + currentFrameNumber);
   
    ++currentFrameNumber;
    if(currentFrameNumber >= 4) {
        currentFrameNumber = 0;
    }
}


We define a function that we will use later in the code. You probably can understand this except for a few things (if you are unfimiliar with coding santax).

'++' == add one to the variable.
'>=' == less than or equal to.

Code

var arcStepArray = new Array();
for(var currentArcInitialStep = 1; currentArcInitialStep * 2 - 1 <= 64; currentArcInitialStep *= 2) {
    arcStepArray.push(currentArcInitialStep);
    outputStream.WriteLine("Arc" + arcStepArray.length + ":");
   
    var currentHeightValue = 0;
    for(var currentStepValue = currentArcInitialStep; currentStepValue >= 1; currentStepValue /= 2) {
        currentHeightValue -= currentStepValue;
        outputStream.WriteLine("     shvertpos " + currentHeightValue);
        generatePlayFrameCommand();
        outputStream.WriteLine("     wait 1");
    }
   
    var currentDecrementValue = 1;
    while(true) {
        currentHeightValue += currentDecrementValue;
        if(currentHeightValue > 0) {
            break;
        }
       
        outputStream.WriteLine("     shvertpos " + currentHeightValue);
        generatePlayFrameCommand();
        outputStream.WriteLine("     wait 1");
       
        currentDecrementValue *= 2
    }
   
    outputStream.WriteLine("goto Arc" + (arcStepArray.length - 1));
    outputStream.WriteLine();
}

outputStream.Close();


Now, for good practice, analyze that code and see if you can figure out what it means. Here are some tips:

'var1 += var2' == Variable #1 is equal to Variable #2 plus one.
'while(true)' == run this code while the output from is is a non-zero value.

Here is the overall code needed for bouncing grenades:

Quotevar fso = new ActiveXObject("Scripting.FileSystemObject");
var outputFileName = fso.GetParentFolderName(WScript.ScriptFullName) + "\\" + fso.GetBaseName(WScript.ScriptFullName) + ".genicc";
var outputStream = fso.CreateTextFile(outputFileName, true);

var currentFrameNumber = 0;
function generatePlayFrameCommand() {
outputStream.WriteLine(" playfram " + currentFrameNumber);

++currentFrameNumber;
if(currentFrameNumber >= 4) {
currentFrameNumber = 0;
}
}

var arcStepArray = new Array();
for(var currentArcInitialStep = 1; currentArcInitialStep * 2 - 1 <= 64; currentArcInitialStep *= 2) {
arcStepArray.push(currentArcInitialStep);
outputStream.WriteLine("Arc" + arcStepArray.length + ":");

var currentHeightValue = 0;
for(var currentStepValue = currentArcInitialStep; currentStepValue >= 1; currentStepValue /= 2) {
currentHeightValue -= currentStepValue;
outputStream.WriteLine(" shvertpos " + currentHeightValue);
generatePlayFrameCommand();
outputStream.WriteLine(" wait 1");
}

var currentDecrementValue = 1;
while(true) {
currentHeightValue += currentDecrementValue;
if(currentHeightValue > 0) {
break;
}

outputStream.WriteLine(" shvertpos " + currentHeightValue);
generatePlayFrameCommand();
outputStream.WriteLine(" wait 1");

currentDecrementValue *= 2
}

outputStream.WriteLine("goto Arc" + (arcStepArray.length - 1));
outputStream.WriteLine();
}
outputStream.Close();

*Original script by BSTRhino. Why? Becuase he owns.
-----------------------------------

Application of Javascript (and in fuller understanding -- coding in general) to Effects Using Mathematics:

What I am going to create in this section is a circle of explosions that you can use as an attack or death animation for a unit. I usually use it for larger units' deaths and such.

I know Starcraft incorporates a large array of players -- from youngling to expert elder -- so, skip this section if you understand polar equations.

The equation for a circle using x and y's is Math.sqrt(x*x + y*y) = radius*radius. Writing that equation made me want to puke. Couldn't there be some easier way?

Of course there is -- its called a polar equation. the equation for a circle is simply: r = 1. For a spiral, it is r = Theta.

A Crash Course on Polor Equations:

Polar equations relate angles with radii. At the given angle, the radius will be a certian length. At the end of the radius, it will plot the point.

But how are those points found be people like you or me? By these set of equations:

x = radius * cos(theta)
y = radius * sin(theta)

(This is basic Algebra and Trig. And some Geometry I guess... O well.)

So, if we are going to use a polar equation in our javascript, we're going to need these two equations as functions:

Code

//functions
    function calcx(radians) {
        xasixnum = Math.round(Math.cos(radians) * 10);
        return xasixnum;
        }
   
    function calcy(radians) {
        yasixsum = Math.round(Math.sin(radians) * 10);
        return yasixsum;
        }


Now, javascript uses radius, which differs from degrees.

Degrees * pi / 180 = Radians

We want our explosions to go full cicle so:

Code

// Program entry point
    for(var currentRadians = 0; currentRadians < 2 * Math.PI; currentRadians += Math.PI/16) {
            outputStream.WriteLine("     imgol             334" + "     " + calcx(currentRadians) + "     " + calcy(currentRadians));
            outputStream.WriteLine("     playsndbtwn         7     12");
            outputStream.WriteLine("     wait             1");
    }
outputStream.Close();    


Here is our full code:
Quotevar fso = new ActiveXObject("Scripting.FileSystemObject");
var outputFileName = fso.GetParentFolderName(WScript.ScriptFullName) + "\\" + fso.GetBaseName(WScript.ScriptFullName) + ".icc";
var outputStream = fso.CreateTextFile(outputFileName, true);


//functions
function calcx(radians) {
xasixnum = Math.round(Math.cos(radians) * 10);
return xasixnum;
}

function calcy(radians) {
yasixsum = Math.round(Math.sin(radians) * 10);
return yasixsum;
}




// Program entry point
for(var currentRadians = 0; currentRadians < 2 * Math.PI; currentRadians += Math.PI/16) {
outputStream.WriteLine(" imgol 334" + " " + calcx(currentRadians) + " " + calcy(currentRadians));
outputStream.WriteLine(" playsndbtwn 7 12");
outputStream.WriteLine(" wait 1");
}
outputStream.Close();

*Original Code by A_of_s_t. It is currently being used in Disunion and my mod for the Summer Modding Contest. Please give me some kudos if you use these tips in your mod.


Next up: Completely Random Atttack Sequences
Next up: Application to Triggers
Next up: Application to AI Design
Nect up: Advanced Special Attacks and Spell with Application of Polar and Parametric Equations
This post was edited 9 times, last edit by A_of-s_t: Mar 25 2008, 4:56 am.
From silent:
"lolol First of all wikipedia is flawed because anyone can come into it and post anything. About criticism.. no. You can't just change the definition of a word and expect everyone to bow down in awe. I am using macro evolution as an identifier between changing from one kind to another kind. I.E. bananas turning into flies. So if you want to argue about this then your argueing about the definition of a word.. Not the theory itself. If you want I can use false evolution, or neverbeenseenbefore evolution instead of macro. Its up to you"
This is stupidity. Please look at it very closely -- notice that almost every logical fallacy is used in it.
Top

Post #2     modmaster50 Mar 24 2008, 4:25 am

[Avatar]
 offline contact
Why dont we just download UltiDoom and use the provided code generators?

Anyways, this should be added into a tutorial :D . Good work typing this all out!
Top

Post #3     DT_Battlekruser Mar 24 2008, 4:27 am

[Avatar]
I paid eleven minerals for THIS?
 offline contact
Javascript is such an ugly language considering you can do this in anything. I will grant you though that it is an interpreted language executed locally on any web browser.
hi
Top

Post #4     A_of-s_t Mar 24 2008, 4:31 am

[Avatar]
Master of Temptation, Ruler of Aeronotics, and Secret Lover
 offline contact
Modmaster: Becuase it catches people's attention and it is very basic, that is why I used them. Duh.

Quote from DT_BattlekruserJavascript is such an ugly language considering you can do this in anything. I will grant you though that it is an interpreted language executed locally on any web browser.


It's a pretty straight forward language that I like becuase all you need is notepad to write it. The best part is that its syntax is similar to C++ and it can be used in web pages and such.

EDIT: I'll add it to the tutorials after I'm completely finished.
From silent:
"lolol First of all wikipedia is flawed because anyone can come into it and post anything. About criticism.. no. You can't just change the definition of a word and expect everyone to bow down in awe. I am using macro evolution as an identifier between changing from one kind to another kind. I.E. bananas turning into flies. So if you want to argue about this then your argueing about the definition of a word.. Not the theory itself. If you want I can use false evolution, or neverbeenseenbefore evolution instead of macro. Its up to you"
This is stupidity. Please look at it very closely -- notice that almost every logical fallacy is used in it.
Top

Post #5     Syphon[MM] Mar 24 2008, 4:46 am

[Avatar]
 offline contact
Quote from A_of-s_tModmaster: Becuase it catches people's attention and it is very basic, that is why I used them. Duh.

Quote from DT_BattlekruserJavascript is such an ugly language considering you can do this in anything. I will grant you though that it is an interpreted language executed locally on any web browser.


It's a pretty straight forward language that I like becuase all you need is notepad to write it. The best part is that its syntax is similar to C++ and it can be used in web pages and such.

EDIT: I'll add it to the tutorials after I'm completely finished.


You only need notepad to write anything,
Top

Post #6     A_of-s_t Mar 24 2008, 4:47 am

[Avatar]
Master of Temptation, Ruler of Aeronotics, and Secret Lover
 offline contact
Quote from Syphon
Quote from A_of-s_tModmaster: Becuase it catches people's attention and it is very basic, that is why I used them. Duh.

Quote from DT_BattlekruserJavascript is such an ugly language considering you can do this in anything. I will grant you though that it is an interpreted language executed locally on any web browser.


It's a pretty straight forward language that I like becuase all you need is notepad to write it. The best part is that its syntax is similar to C++ and it can be used in web pages and such.

EDIT: I'll add it to the tutorials after I'm completely finished.


You only need notepad to write anything,

But with javascript, there is no need to compile.
From silent:
"lolol First of all wikipedia is flawed because anyone can come into it and post anything. About criticism.. no. You can't just change the definition of a word and expect everyone to bow down in awe. I am using macro evolution as an identifier between changing from one kind to another kind. I.E. bananas turning into flies. So if you want to argue about this then your argueing about the definition of a word.. Not the theory itself. If you want I can use false evolution, or neverbeenseenbefore evolution instead of macro. Its up to you"
This is stupidity. Please look at it very closely -- notice that almost every logical fallacy is used in it.
Top

Post #7     Corbo[MM] Mar 24 2008, 4:49 am

[Avatar]
LOL! DTBK actually paid for this!
 offline contact
@Syphon: Yes, but you need Java runtime environments, php installed and some other requirements for most of the other programming languages.
You can use notepad to write anything but you'll need something more than notepad to actually use it.
Top

Post #8     A_of-s_t Mar 24 2008, 4:51 am

[Avatar]
Master of Temptation, Ruler of Aeronotics, and Secret Lover
 offline contact
Strange, my computer is 4 years old and has never been connected to the internetz and it runs fine on there.

But I think this is besides the point. I used javascript mainly because I lub it (that and C++).
From silent:
"lolol First of all wikipedia is flawed because anyone can come into it and post anything. About criticism.. no. You can't just change the definition of a word and expect everyone to bow down in awe. I am using macro evolution as an identifier between changing from one kind to another kind. I.E. bananas turning into flies. So if you want to argue about this then your argueing about the definition of a word.. Not the theory itself. If you want I can use false evolution, or neverbeenseenbefore evolution instead of macro. Its up to you"
This is stupidity. Please look at it very closely -- notice that almost every logical fallacy is used in it.
Top

Post #9     Syphon[MM] Mar 24 2008, 6:32 am

[Avatar]
 offline contact
Quote from Corbo@Syphon: Yes, but you need Java runtime environments, php installed and some other requirements for most of the other programming languages.
You can use notepad to write anything but you'll need something more than notepad to actually use it.


Same with Javascript...
Top

Post #10     Deathman101 Mar 24 2008, 10:01 am

[Avatar]
Major General
 offline contact
Kudos for writing this out, but just about anything here can be done with the language IceCC uses...and if not you can come very close. The "no compiling" is extremely tempting though.
OFC if I learn Javascript in SC I can say my modding career taught me something relatively useful.
This post was edited 1 times, last edit by Deathman101: Mar 24 2008, 10:10 am.
Buying D2 Fire Sorc Gear PM Me (Ladder)
Top

Post #11     AntiSleep Mar 24 2008, 11:27 am

[Avatar]
 offline contact
The amount of time it takes to find and install a dev environment for ANY language is piddling to the amount of time saved from tedious triggers. I tend to prefer perl when triggering.
I do not respect your beliefs, and I implore you not to respect mine. To ask respect of beliefs held without evidence, is to burn the books of progress and hope.

- The Village IconoClast
Top

Post #12     A_of-s_t Mar 25 2008, 1:01 am

[Avatar]
Master of Temptation, Ruler of Aeronotics, and Secret Lover
 offline contact
Will add to first post.

Application of Javascript (and in fuller understanding -- coding in general) to Effects Using Mathematics:

What I am going to create in this section is a circle of explosions that you can use as an attack or death animation for a unit. I usually use it for larger units' deaths and such.

I know Starcraft incorporates a large array of players -- from youngling to expert elder -- so, skip this section if you understand polar equations.

The equation for a circle using x and y's is Math.sqrt(x*x + y*y) = radius*radius. Writing that equation made me want to puke. Couldn't there be some easier way?

Of course there is -- its called a polar equation. the equation for a circle is simply: r = 1. For a spiral, it is r = Theta.

A Crash Course on Polor Equations:

Polar equations relate angles with radii. At the given angle, the radius will be a certian length. At the end of the radius, it will plot the point.

But how are those points found be people like you or me? By these set of equations:

x = radius * cos(theta)
y = radius * sin(theta)

(This is basic Algebra and Trig. And some Geometry I guess... O well.)

So, if we are going to use a polar equation in our javascript, we're going to need these two equations as functions:

Code

//functions
    function calcx(radians) {
        xasixnum = Math.round(Math.cos(radians) * 10);
        return xasixnum;
        }
   
    function calcy(radians) {
        yasixsum = Math.round(Math.sin(radians) * 10);
        return yasixsum;
        }


Now, javascript uses radius, which differs from degrees.

Degrees * pi / 180 = Radians

We want our explosions to go full cicle so:

Code

// Program entry point
    for(var currentRadians = 0; currentRadians < 2 * Math.PI; currentRadians += Math.PI/16) {
            outputStream.WriteLine("     imgol             334" + "     " + calcx(currentRadians) + "     " + calcy(currentRadians));
            outputStream.WriteLine("     playsndbtwn         7     12");
            outputStream.WriteLine("     wait             1");
    }
outputStream.Close();    


Here is our full code:
Quotevar fso = new ActiveXObject("Scripting.FileSystemObject");
var outputFileName = fso.GetParentFolderName(WScript.ScriptFullName) + "\\" + fso.GetBaseName(WScript.ScriptFullName) + ".icc";
var outputStream = fso.CreateTextFile(outputFileName, true);


//functions
function calcx(radians) {
xasixnum = Math.round(Math.cos(radians) * 10);
return xasixnum;
}

function calcy(radians) {
yasixsum = Math.round(Math.sin(radians) * 10);
return yasixsum;
}




// Program entry point
for(var currentRadians = 0; currentRadians < 2 * Math.PI; currentRadians += Math.PI/16) {
outputStream.WriteLine(" imgol 334" + " " + calcx(currentRadians) + " " + calcy(currentRadians));
outputStream.WriteLine(" playsndbtwn 7 12");
outputStream.WriteLine(" wait 1");
}
outputStream.Close();

*Original Code by A_of_s_t. It is currently being used in Disunion and my mod for the Summer Modding Contest. Please give me some kudos if you use these tips in your mod.
This post was edited 1 times, last edit by A_of-s_t: Mar 25 2008, 1:07 am.
From silent:
"lolol First of all wikipedia is flawed because anyone can come into it and post anything. About criticism.. no. You can't just change the definition of a word and expect everyone to bow down in awe. I am using macro evolution as an identifier between changing from one kind to another kind. I.E. bananas turning into flies. So if you want to argue about this then your argueing about the definition of a word.. Not the theory itself. If you want I can use false evolution, or neverbeenseenbefore evolution instead of macro. Its up to you"
This is stupidity. Please look at it very closely -- notice that almost every logical fallacy is used in it.
Top

Post #13     Centreri Mar 25 2008, 1:30 am

[Avatar]
Overwin Winboat
 offline contact
Huh. For some reason, I never thought of using a programming language to generate stuff. This'll make trigger-generation easier. PHP>Javascript, though.
I'm BAAAAAAAAAACK
Top

Post #14     A_of-s_t Mar 25 2008, 1:33 am

[Avatar]
Master of Temptation, Ruler of Aeronotics, and Secret Lover
 offline contact
Quote from CentreriHuh. For some reason, I never thought of using a programming language to generate stuff. This'll make trigger-generation easier. PHP>Javascript, though.

For the first part: I'm going to create an Application to Triggering soon.
For the second part: I don't care about personal prefrences. I'm writing this for javascript so deal with it.
From silent:
"lolol First of all wikipedia is flawed because anyone can come into it and post anything. About criticism.. no. You can't just change the definition of a word and expect everyone to bow down in awe. I am using macro evolution as an identifier between changing from one kind to another kind. I.E. bananas turning into flies. So if you want to argue about this then your argueing about the definition of a word.. Not the theory itself. If you want I can use false evolution, or neverbeenseenbefore evolution instead of macro. Its up to you"
This is stupidity. Please look at it very closely -- notice that almost every logical fallacy is used in it.
Top

Post #15     A_of-s_t Mar 25 2008, 4:39 am

[Avatar]
Master of Temptation, Ruler of Aeronotics, and Secret Lover
 offline contact
Cannot add to 1st post at the moment so:

PART 2 -- Applications of Javascript (and to a more reaching extent -- coding in general) for Unique Weaponry

The Miraculous Sine Missiles:

If you have ever viewed the graph of sin(x), you'll see a nice flowing curve. When someone posted that they wanted to see missiles fly to their target in non linear paths, I decided to try it -- and thanks to javascript, I succeeded.

Sin Missiles require two sets of equations and -- even worse, two weapons, two flingies, two sprites, and two images.

One missile will be used for horizontal fire, and one will be used for vertical:

Code

var fso = new ActiveXObject("Scripting.FileSystemObject");
var outputFileName = fso.GetParentFolderName(WScript.ScriptFullName) + "\\" + fso.GetBaseName(WScript.ScriptFullName) + ".icc";
var outputStream = fso.CreateTextFile(outputFileName, true);


//functions
    function calculateyaxis(yaxis, distance) {
        yaxis = 4 * Math.round(Math.PI * Math.sin(180 * distance / Math.PI));
        return yaxis;
        }

       


// Program entry point
    for(var currentDistance = 0; currentDistance < 9; currentDistance += 1) {
            outputStream.WriteLine("     sethorpos         " + calculateyaxis(0, currentDistance));
            outputStream.WriteLine("     sprul               998 " + calculateyaxis(0, currentDistance) + "     0     # MissleTrail (thingy\smoke.grp)");
            outputStream.WriteLine("     wait             1");
    }
outputStream.Close();


Code

var fso = new ActiveXObject("Scripting.FileSystemObject");
var outputFileName = fso.GetParentFolderName(WScript.ScriptFullName) + "\\" + fso.GetBaseName(WScript.ScriptFullName) + ".icc";
var outputStream = fso.CreateTextFile(outputFileName, true);


//functions
    function calculateyaxis(yaxis, distance) {
        yaxis = 4 * Math.round(Math.PI * Math.sin(180 * distance / Math.PI));
        return yaxis;
        }

       


// Program entry point
    for(var currentDistance = 0; currentDistance < 9; currentDistance += 1) {
            outputStream.WriteLine("     setvertpos         " + calculateyaxis(0, currentDistance));
            outputStream.WriteLine("     sprul               998 0     " + calculateyaxis(0, currentDistance) + "     # MissleTrail (thingy\smoke.grp)");
            outputStream.WriteLine("     wait             1");
    }
outputStream.Close();


Now, copy + paste the output of the first one into an image that is unsed and do the same with the second one.

Now, let's go to the Valkyrie and give it two weapons -- one air and one ground -- and have the weapons use "Flies to Target" and have it use a flingy that uses a sprite that uses the images that we editted.

Now, go to the Valkyrie's iscript and change its attack to this:

Code

ValkyrieAirAttkInit:
ValkyrieGndAttkInit:
    wait               1
    curdirectcondjmp     0     22     FireBlock1
    curdirectcondjmp     64     44     FireBlock2
    curdirectcondjmp     128     22     FireBlock1
    curdirectcondjmp     192     44     FireBlock2
EndofAttack:
    gotorepeatattk    
    goto               ValkyrieLocal00

ValkyrieLocal00:
    wait               125
    goto               ValkyrieLocal00
   
FireBlock1:
    wait             1
    attackwith         1
    wait             1
    #useweapon         123
    waitrand         10     12
    goto             EndofAttack
   
FireBlock2:
    wait             1
    attackwith         2
    wait             1
    #useweapon         125
    waitrand         10     12
    goto             EndofAttack


Compile everything and you get a Valkyrie that now fires sinMissiles!

What is curdirectcondjmp?:

While I'm at it, I shall diescribe how curdirectcondjmp works (thanks to Lord_Agamemnon).

curdirectcondjump detects which way the unit is facing and jumps to a block of code if it is facing the right direction.

The first number describes what angle it is at. A circle in SC is split into 256 units (not 360). So, to convert:

Degress * 256 / 360 = Starcraft Measure

Now the second number allows for error, giving a range clockwise and counter-clockwise of this Starcraft measure from the first number.

curdirectcondjmp 64 44 FireBlock2
90 Degrees with about 61 degrees left or right of error allotment. (29d to 151d)



Commplete generators and codes needed:
Quotevar fso = new ActiveXObject("Scripting.FileSystemObject");
var outputFileName = fso.GetParentFolderName(WScript.ScriptFullName) + "\\" + fso.GetBaseName(WScript.ScriptFullName) + ".icc";
var outputStream = fso.CreateTextFile(outputFileName, true);


//functions
function calculateyaxis(yaxis, distance) {
yaxis = 4 * Math.round(Math.PI * Math.sin(180 * distance / Math.PI));
return yaxis;
}




// Program entry point
for(var currentDistance = 0; currentDistance < 9; currentDistance += 1) {
outputStream.WriteLine(" sethorpos " + calculateyaxis(0, currentDistance));
outputStream.WriteLine(" sprul 998 " + calculateyaxis(0, currentDistance) + " 0 # MissleTrail (thingy\smoke.grp)");
outputStream.WriteLine(" wait 1");
}
outputStream.Close();

Quotevar fso = new ActiveXObject("Scripting.FileSystemObject");
var outputFileName = fso.GetParentFolderName(WScript.ScriptFullName) + "\\" + fso.GetBaseName(WScript.ScriptFullName) + ".icc";
var outputStream = fso.CreateTextFile(outputFileName, true);


//functions
function calculateyaxis(yaxis, distance) {
yaxis = 4 * Math.round(Math.PI * Math.sin(180 * distance / Math.PI));
return yaxis;
}




// Program entry point
for(var currentDistance = 0; currentDistance < 9; currentDistance += 1) {
outputStream.WriteLine(" setvertpos " + calculateyaxis(0, currentDistance));
outputStream.WriteLine(" sprul 998 0 " + calculateyaxis(0, currentDistance) + " # MissleTrail (thingy\smoke.grp)");
outputStream.WriteLine(" wait 1");
}
outputStream.Close();

Quote# ----------------------------------------------------------------------------- #
# This is a decompile of the iscript.bin file 'data\scripts\iscript.bin'
# created on: Fri Jun 16 20:57:22 2006
# ----------------------------------------------------------------------------- #


# ----------------------------------------------------------------------------- #
# This header is used by images.dat entries:
# 939 Valkyrie (terran\bomber.grp)
.headerstart
IsId 362
Type 12
Init ValkyrieInit
Death ValkyrieDeath
GndAttkInit ValkyrieGndAttkInit
AirAttkInit ValkyrieAirAttkInit
Unused1 [NONE]
GndAttkRpt ValkyrieGndAttkInit
AirAttkRpt ValkyrieAirAttkInit
CastSpell [NONE]
GndAttkToIdle ValkyrieGndAttkToIdle
AirAttkToIdle ValkyrieGndAttkToIdle
Unused2 [NONE]
Walking ValkyrieWalking
WalkingToIdle ValkyrieWalkingToIdle
SpecialState1 [NONE]
.headerend
# ----------------------------------------------------------------------------- #

ValkyrieInit:
imgul 940 0 5 # ValkyrieShad (terran\bomber.grp)
playfram 0x00 # frame set 0
goto ValkyrieGndAttkToIdle

ValkyrieGndAttkToIdle:
setvertpos 1
waitrand 8 10
setvertpos 2
waitrand 8 10
setvertpos 1
waitrand 8 10
setvertpos 0
waitrand 8 10
goto ValkyrieGndAttkToIdle

ValkyrieDeath:
playsnd 1040 # Terran\FRIGATE\TVkDth00.WAV
imgol 332 0 0 # TerranBuildingExplosionsmall (thingy\tBangS.grp)
wait 3
end

ValkyrieAirAttkInit:
ValkyrieGndAttkInit:
wait 1
curdirectcondjmp 0 22 FireBlock1
curdirectcondjmp 64 44 FireBlock2
curdirectcondjmp 128 22 FireBlock1
curdirectcondjmp 192 44 FireBlock2
EndofAttack:
gotorepeatattk
goto ValkyrieLocal00

ValkyrieLocal00:
wait 125
goto ValkyrieLocal00

FireBlock1:
wait 1
attackwith 1
wait 1
#useweapon 123
waitrand 10 12
goto EndofAttack

FireBlock2:
wait 1
attackwith 2
wait 1
#useweapon 125
waitrand 10 12
goto EndofAttack

ValkyrieWalking:
imgol 249 0 0 # ValkyrieOverlay (thingy\tbmGlow.grp)
sigorder 64
setvertpos 0
goto ValkyrieLocal00

ValkyrieWalkingToIdle:
orderdone 64
goto ValkyrieGndAttkToIdle

*Original Generators and Codes thanks to A_of_s_t -- who ownz at mathematics.
This post was edited 2 times, last edit by A_of-s_t: Mar 25 2008, 4:54 am.