Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Is it possible to use AS to operate another file?
#3
Depending on your understanding of C++ you can basically add all of the above yourself. The source code is available and you are free to modify it however your want really.
I'll go into a bit more detail below:

(10-28-2014, 07:46 AM)like1996 Wrote:  Is it possible to use AS to input or output in another file?

I tried to use FILE as in C language, but it didn't work.
It would be soooo wonderful to have this function.
This was requested by zort, but I decided not to add it, as allowing modifying files is a pretty big vulnerability. That said adding it is entirely possible, and AngelScript already has an add on which is does this: http://www.angelcode.com/angelscript/sdk..._file.html

(10-28-2014, 07:46 AM)like1996 Wrote:  And I am using ddraw.dll to script AI, and learnt from YinYin.
But how do this ddraw.dll work? How can we change something, like changing the name of folder that the AS files are put in.
It is kind of hard to explain, and on top of that I am awful at explaining things, but I'll do my best.
Whenever "lf2.exe" starts it looks for a dll file named "ddraw.dll". ddraw stands for DirectDraw which is a part of the DirectX library, and normally this file is located on your computer within your windows installation. What we do is place a DLL with the same name so LF2 loads it instead. Our DLL loads the original "ddraw.dll" into the program, and reimplements the functionality.
On top of this the DLL also modifies the code of "lf2.exe" so whenever it runs its AI functions, a custom function within the DLL is called instead, which then checks whether or not a script exists for the ID. If it does then that script is called, if not then the function simply calls the original one in "lf2.exe".

(10-28-2014, 07:46 AM)like1996 Wrote:  And is it possible to encode AS file in some sense that other people can use the AS file as a AI for LF2 but cannot see what was composed in the AS file?
Yes, although it isn't something I'd recommend. You could either obfuscate the code, by putting in a bunch of code which does nothing, and renaming variables to crazy things, thus making it harder to read.
There is an alternative which I have no clue how will actually work. Basically before AngelScript can run a script it first has to compile it into bytecode. If you want you can save this bytecode to a file, and then read that file instead of a script (this would require modifying the DLL, take a look at this: http://www.angelcode.com/angelscript/sdk...mpile.html).
Like I said though it's not something I'd recommend doing. The first solution can cause a drop in performance (by adding code which does nothing, yet still has to be executed) and the second one may or may not behave weirdly, I have no clue basically. Either way I don't think protecting your code is that important if you are making a mod, or a character, and sharing it will generally benefit the community more.
Age ratings for movies and games (and similar) have never been a good idea.
One can learn a lot from reinventing wheels.
An unsound argument is not the same as an invalid one.
volatile in C++ does not mean thread-safe.
Do not make APIs unnecessarily asynchronous.
Make C++ operator > again
Trump is an idiot.
Reply
Thanks given by:


Messages In This Thread
RE: Is it possible to use AS to operate another file? - by Som1Lse - 10-28-2014, 05:16 PM



Users browsing this thread: 1 Guest(s)