Try Tutorial

Fraxy tutorials and guides go here.
User avatar
TheBlueEcho
VIP Member
VIP Member
Posts: 206
Joined: Wed Feb 24, 2010 1:41 am
Epicness: So Epic
Gold Stars: 1

Try Tutorial

Postby TheBlueEcho » Sat Jul 09, 2011 1:13 am

Trys offer a whole new dynamic, allowing you to make Challenges, Levels, or just more aestheticly pleasing bosses.
Contrary to some people's belief, trys are not all that complicated, and very easy to make, especially if they're used just for One-Offs, like Hermit, and Coatl. They do, however, require some time to make. (Which, I think, is the heart of the issue for most.)

To make Try's all you need is one of the manuals (The Organized Online Version or The Simplified Text File), and a text editor. It doesn't have to be a complex one.

So, to get right into it.

================================================================================
I - The Fine Print
================================================================================

Alright, the things you absolutely must remember are as follows:

"All Functions are in quotations"
Every Segment of a Function is separated with commas, excluding the last segment and single-segment functions.

An example of what 2 kinds of functions looks like:

Code: Select all

"FUNCTION", str1, var2, int3

"END"



Functions won't work if not quoted. It will either consider it a variable, or ignore it, and maybe cause errors in the long run.
It's general practice to write functions in uppercase (CAPS), so there more distinguishable from everything else, but it's not necessary.

----------------------------------------
All Functions, Variables, Labels, and ect. can only occupy one line at a time.

This is very self explanatory, but just in case, the following is what you should NOT do:
"FUNCTION", blah, blah I_A_Variable=Zip "ANOTHERFUNCION", DUR, DUR "FUNCTIONTHE3RD", HOGWASH

----------------------------------------
"All strings are in quotations."
"Strings can be combined with"+Variables+"and"+Math

Almost all strings that you will use are for text, such as messages. But strings are also used for file searches and labels. Strings can also be combined with Math and Variables:


Code: Select all

"MESSAGE","Player X = "+_px,...
becomes:
"MESSAGE","Player X = 200",...
and:
"MESSAGE","Player X+Y = "+(_px+_py),...
becomes:
"MESSAGE","Player X+Y = 300",...



----------------------------------------
All Trys include "FRAXY_TRY" and "END"
"FRAXY_TRY" must not have any spaces in it's code.

Fraxy will not recognize a file as a Try without "FRAXY_TRY" at the Absolute start of the file. Literally. It's either Line 1 or Nothing. A try file will also error if no "END" function is present when it reaches the end of the file. So don't forget that either.

There is one exception: Preprocessor Files. They don't follow this rule.

----------------------------------------
// and ; are your 'note'-worthy friends.

These are for making comments, both inline and elsewhere. Use them feverishly, if necessary. Example:


Code: Select all

"FUNCTION", _global1 // - I'm a comment, so i'm ignored. >.< -
// - I'm also a comment. -
; - Me Too! -
"FUNCTION", _global1 ; - WooHoo! Giga Puddin'! -



----------------------------------------
Variable Names CANNOT start with a number. (1x = 1)
Variable Names CANNOT contain symbols (!, @, #, $, %, ...), excluding the under space ( _ ).
Variable Names CANNOT be over 32 characters long.
Variable Names CANNOT share the same name as Math Functions.
Variable Names are NOT case-sensitive.
Labels MUST start with an asterisk. ( * )

----------------------------------------
Preprocessor Files can be of any extension, as long as Fraxy can read it.
Preprocessor Files do not need the "FRAXY_TRY" and "END" functions.
Preprocessor Files run along side the main try.

Don't worry if you don't get it all. Try Script makes these rules very repetitive, and you'll pick it up, along with other things, as you go along because of this.

With all that squared away, we will start!

================================================================================
II - An Absurdly Basic Try Script
================================================================================

Make sure you look up the functions while you do this.

So, to begin, you need to declare the "FRAXY_TRY" function. Find it in the manual and type it up in your try. (Tip: If you're using the Simplified Text Manuel, Use your Text Editors "Find" tool to find functions much faster.)
In the string (str1), name your try whatever you feel like. Call it "Hello World" if you wish. Ignore/Delete the 2nd instance (int2) for now (or leave it 0, if you choose).

Next, we will make a "WAIT" function. This halts the processing (or reading) of the try for a period of frames. Without wait functions, your whole try will be declared and processed in a single frame, and that's bad. So, type up the function and give it a frame value (int1) around 90-150. (Tip: A general guide for FPS Shooters is 30 frames = 1 second. So keep this in mind when a function requires you to enter frame values.)

Next, we will generate an enemy. For simplicity's sake, it will be a simple starfish.
So First, we will want to declare a "CREATE" function, then type the location of the .fed into the string. Since it's located in the "enemy" folder, your string should be "enemy\starfish.fed".
Of course, Fraxy will search the Try Folder first, but it will eventually move to the root folder of Fraxy.exe to search for the file folder by folder. It seems slow, but it's not.

In the next two instances, you'll pick which direction the boss will be facing (int2), and in which direction he will be created (int3). Heres a simple chart to help you out:


0 (Top/Up)
1024 (Right)
2048 (Down/Bottom)
3072 (Left)



Take Note that the facing is usually opposite of the generation point, meaning that, if the boss is made at point 0, above the player, you want the boss to be facing 2048, which is down.

Moving on to (int4), which is distance, take MON's advice and set it anywhere around 300-500 dots(pixels) away. For (int5), pick a rank you like, and for (int6), we'll set to 1 for now.

So Far, we've declared the file as a Try, Made the file pause for a few seconds and made a boss appear. Now we need to make it so that the try doesn't end untill the boss is defeated. So look up the "LIMIT" Function, and type it in. Set (int1), the number of cores present, to 0, and (int2), the number of parts present, to -1. This will cause the try to wait until the boss is defeated.

Now we will end this try with the "END" function, and go test it out in Fraxy!

Heres an example of what your try might look like:

Code: Select all

"FRAXY_TRY","Hello World!"

"WAIT",120

"CREATE","enemy/starfish.fed",0,2048,400,100,1 // My starfish is sneaking up behind you here.

"LIMIT",0,-1

"WAIT",60 // added an extra wait.

"END"




To remove the generation messages, change the last integer of "Create" and "Create2" to 0. That controls the Generation Message Flag.
You use "Create2" if your enemy is being generated in a absolute place. Most like this function because it is more precise and independent of player position, which is perfect for Fixed Area Battles (an occasionally, boss creation).
You use "Create" if your enemy is being generated in relation to the player's position. This is generally better for Free Area (freeplay) Trys because the enemy will always be close to the player, and not spawning in the middle of nowhere.

You use "Pos" to set up a base point for "Create2", "Item2" and I think one or two other functions. You should have "Pos" defined in your try before using "Create2"

To get enemies to appear at a random whatever, you need to define a variable with the math function rand() in it. An example:

Code: Select all

test1 = rand(50)


This will cause the Variable 'test1' to equal any number between 0 and 50.

To account for Options, you need "Limit" to account for them as well, that is to say, change the number of cores allowed from 0 to 1, if only one Option is present. (from "Limit",0,-1 to "Limit",1,-1)

To limit the traversable area of the player, you use "AreaLimit". To limit the camera/screen area, you use "AreaFixed". You use "AreaLimit" and "AreaFixed" together to constrict the player to the bounds of the window, like in 401 and Freeplay's Area Fixed Mode.

Hint: With a bit of creativity, you can use Loops, Objects, and Variables to make simple animations, perhaps for a titlescreen or Special Event Scene.



Code: Select all

"FRAXY_TRY","[Rand distance]"
"BUFFER", 32768, 1
"LOAD","fighter.fed", 0
"WAIT", 100
"REPEAT", 32
angle_A = rand(4096)
angle_B = (angle_A+2048)&4095
distance = rand(200)+300
"CREATE","*0", angle_A, angle_B, distance, 0, 0
"LOOP"
"LIMIT", 0
"END"

Try it.




Code: Select all

// load
// 32KB x 32
"BUFFER", 32768, 32
"LOAD","401_e01L.fed", 0
"LOAD","401_e01R.fed", 1
"LOAD","401_e02.fed", 2
"LOAD","401_e02C.fed", 3
"LOAD","401_e02L.fed", 4
"LOAD","401_e02R.fed", 5
"LOAD","401_e03.fed", 6
"LOAD","401_e04C.fed", 7
"LOAD","401_e04L.fed", 8
"LOAD","401_e04R.fed", 9

...

"CREATE2","*0", 2048, -120, -150, 0, 0



"Buffer", Buffer size (in bytes), Number of buffers
Note: 1 kilobyte = 1024 bytes
Number of Buffers should be equal or higher that the number of enemies loaded with the "LOAD" function.

Use buffers if you want to semi-load or Pre-load* .fed files so that they load up faster when there created in fraxy. You create preloaded enemies almost the same way you call a label in a "GOTO" function. You will want to set it up at the head of you Try Script.





Lables are just special points in a try used by GOTO and GOSUB functions. Here's an example of what one might look like:

Code: Select all

"A_FUNCTION", 1234

*A_LABLE

"ANOTHER_FUNCTION", "some message"



The one thing that seperates them from variables is that they start with a Asterisk (*).

As for GOTO and GOSUB, they are useful if you want to move around your try script other than the standard Line by Line. Some examples of why you would use these would be to change settings during the game and jump right back, or to skip parts of the try.

So you would use them like this:

Code: Select all

"GOTO","*A_LABLE"

"A_FUNCTION", 1234

*A_LABLE

"ANOTHER_FUNCTION", "some message"


Code: Select all

"GOSUB","*TEST_LABEL"

"END"
*TEST_LABEL
// Your Try Script Here.
"RETURN"

User avatar
ShadowHunter
Elite Fraxian
Elite Fraxian
Posts: 769
Joined: Mon Mar 21, 2011 6:59 pm
Epicness: ۞

Re: Try Tutorial

Postby ShadowHunter » Sun Jul 17, 2011 3:54 am

Last edited by ShadowHunter on Mon Aug 05, 2013 5:35 pm, edited 1 time in total.
۞

User avatar
AlexMdle
Administrator
Administrator
Posts: 1189
Joined: Mon Jan 18, 2010 8:36 pm
Epicness: micro skills

Re: Try Tutorial

Postby AlexMdle » Sun Jul 17, 2011 11:42 am

Try removing the ./ from "./Desperation.fed"
Now under new management.


Return to “Tutorials and Guides”

Who is online

Users browsing this forum: No registered users and 1 guest

cron