View Full Version : FS: Some general Questions, WOOT!
Krater01
August 8th, 2004, 05:00 PM
Hello everyone! As I have been experimenting with Legacy FS I have run across a few questions. Keep in mind I'm a novice programmer having just taken a few classes in college.
The Following are the questions for which I havent found any answers:
1) Can you create your own and/or use libraries other than things.h?
2) Can you create your own functions within fraggle script? If so will these functions be able to pass and send value(s)?
3) Can you create arrays? Example would be (int varX [10];) Can you create multiple dimension arrays? (int varY [10] [10];)
4) Does FS make use of Pointers and Strings?
5) Can you include C++ standard libraries? Like iostream, fstream?
6) I have been writeing my FS in Doom Builder, how come I dont need to run any special program to combne my script? Does Doom Builder compile, and add the script into my wad file for me? Can I then distribute this wad file without a .FS file with it?
Thank you for takeing time to read my questionious rant...I hope to learn as much about the capabilities of FS as I can before I begin to start the first stages of designing my next doom wad. Happy Dooming! *alienate*
Planky
August 8th, 2004, 05:50 PM
6) I have been writeing my FS in Doom Builder, how come I dont need to run any special program to combne my script? Does Doom Builder compile, and add the script into my wad file for me? Can I then distribute this wad file without a .FS file with it?
Doom Builder inserts the fs for you, so no, you dont need to distribute the fs file as it's already in your wad.
Aliotroph?
August 8th, 2004, 10:40 PM
BTW, FS isn't even compiled. It just gets inserted into the wad file header.
iori
August 9th, 2004, 12:15 AM
The Following are the questions for which I havent found any answers:
1) Can you create your own and/or use libraries other than things.h?
Yes you can to an extent. You can make another fs file, and call it 'bob.fs' or something, and insert it as a lump in the wad. (like Things.h is). Then you can include it the same way.
2) Can you create your own functions within fraggle script? If so will these functions be able to pass and send value(s)?
You can indeed take the from the CVS and mess around with the FS parts. They are all located in C files with the 't_' prefix.
3) Can you create arrays? Example would be (int varX [10];) Can you create multiple dimension arrays? (int varY [10] [10];)
So far only 1 dimensional arrays are supported (in the C version), and were just recently added.
4) Does FS make use of Pointers and Strings?
Not sure what you mean by this, hehe.
5) Can you include C++ standard libraries? Like iostream, fstream?
Not standard libs I dont think. All the functions are coded into legacy itself, and not available outside as libraries.
Thats all I know, Someone may come along and add to or completely change what ive said :p, I am but a beginner myself.
Krater01
August 9th, 2004, 10:04 AM
Thank you all for the prompt responce to my dire questions! *roflmao* Now that I have a better understanding of FS I can begin makeing more complex script in my wad files.
I must comment however that I remember reading something on another post about future versions of Legacy doing away with FS and switching over to ACS? I hope not!! I've been learning FS for like a month now and it would be a low down dirty shame to have to learn everything all over again! I used to program ACS in Hexen wads a long time ago using DOS-based DCK but as far as I can remember FS seemes more powerful but a bit more cryptic than ACS - am I mistaken??
Anyhow thanks again for the help! Happy Dooming *xbones*
iori
August 9th, 2004, 01:42 PM
Good news, legacy will support both! Since ACS is compiled, it's separate from FS, so no conflicting should happen. Some good things about hexen/acs: Things can have tags (just like walls and sectors), polyobjects (sliding doors, rotating doors), earthquakes , multidemensional arrays, etc. Both ACS and FS can do some of the same things, but there are differences that set them apart.
Krater01
August 9th, 2004, 07:56 PM
Ooo that is good news indeed! *flip* Correct me if I'm wrong but i get the feeling that people prefer ACS over FS. I've tried both (even though its been a while (like 5+) years since I did any ACS) and I must say I prefer the FS. I dunno why, FS just seems more natural to me... perhaps I'm insaine *eek*
Happy Dooming!
Aliotroph?
August 9th, 2004, 09:08 PM
Sorry, no pointers or real functions in FS (although a different script would be like a function without parameters). It's not C. :p
I didn't know arrays were added. Now I wanna play with this some more. Strings are primative.
ToXiCFLUFF
August 10th, 2004, 05:19 AM
ACS is overall much more powerful, mainly because you can write scripts which take arguments (basically allowing you to create functions). The other great thing about it, like iori said, is that it's so closely integrated with Hexen's extended and improved linedef and thing implementation.
smite-meister
August 10th, 2004, 07:45 AM
Not more powerful, just more convenient:)
You can simulate parametrized functions in FS as well:
int p1, p2, p3, p4, p5; // these variables are used to emulate parameter stack in function calls
int ret; // return value
// "function"
script 1
{
ret = p1 + p2;
}
script 2
{
// call the addition func
p1 = 5;
p2 = 7;
startscript(1);
print(ret);
}
I'm not sure if you can do recursion, too. Perhaps if you copied the global vars
into local ones in the beginning of the function, it could work.
EDIT:
Oops. startscript does not start the other script immediately, so it won't work. Damn.
I wonder why?
Krater01
August 10th, 2004, 04:56 PM
hrrrm, upon first glance I dont know why the 1st function would not execute....
Aliotroph?
August 10th, 2004, 05:06 PM
I had something like recursion for a script to make a sliding door re-open if it closed on you. That much worked (since there were no parameters) but I couldn't tell how FS was actually executing the scripts at all.
ToXiCFLUFF
August 12th, 2004, 06:53 AM
EDIT:
Oops. startscript does not start the other script immediately, so it won't work. Damn.
I wonder why?
Basically, it's to do with the way timing works in FS. You need a wait() to get a value returned like that, since FS only deals with other running scripts while the current one is waiting. So you can simulate parameters, but if it's an operation you want done many times, there's a limit to how fast it can be done because of all the wait() functions. And then other problem you can run into, is if many different things are using the same block of code.... you've then got to have one set of global variables to temporarily store the "parameters", and then another set of script-scope variables in the script which takes them.
Hurdler
August 15th, 2004, 04:01 PM
I think I posted a recursion example here in the past.
Krater, if you need functions from standard libraries, we (or you) can add them in the source code (like we did with the math functions), but you can't simply use a dll (or .so on Unix systems) and use the functions defined there. That's something we could add later, but the problem is that it would generate scripts which are not compatible on all Legacy supported plateform (which is probably a bad idea).
As for arrays, it's still in the CVS and there is no official beta/stable version with that support. And for now, you can't use the [] operator. It still use functions to create/manipulate arrays. I plan to work on this later if requested by lots of people (it shouldn't be hard and time consuming to do that).
Aliotroph?
August 15th, 2004, 08:00 PM
Sounds fun. Arrays will probably double the power of FS.
xiO
August 15th, 2004, 08:42 PM
sounds good
vBulletin® v3.8.3, Copyright ©2000-2010, Jelsoft Enterprises Ltd.