Guest

View Thread

 Print Thread
Local script instances impossible?
LordZsar1
Examining the scripts of invasion gametype, I noticed, that the whole deployment algorithm is executed globally instead on each individual object...
This, of course, works in contradiction to OOP (and wastes comparison work for ship types), so my first thought is:
Why!?

As I am fairly inexperienced with lua script and especially how "mighty" the language is implemented in Homeworld 2, I suspect the simple reason, that local script work is not included... or is it?
And if it is, what made the implementor still choose the global way?
There have to be grave disadvantages to be eluded, right?

... Oh, and by the way, arrays start at zero, do they not?
And should loops, which check for timers not contain a function call like "wait" or "sleep" (I do not know which one, if any, is available)?

... Is there a documentation (API) of functions/globals implemented in PDS-related scripts?
Dreaming of something equal in form to javadoc is futile, is it no?
Edited by LordZsar1 on 10-01-2008 11:20
 
Tristan
Wow, you seem to know a lot about scripting. Much more than I apparently do.

My guess would be that it was easiest to do it that way, but I could be wrong. If you have lots of scripting experience I'm sure you'll find much demand here, however. And if not, I could always use some revolutionary ideas for my little project.
 
LordZsar1
... 45% school, 45% own work, 10% academic studies. ^^

No lua experience, limited ability to read/understand C/C++, more or less average Java experience and somewhat above in Jass (Warcraft 3 scripting language, C++-derivate, thus useful for understanding lua ^^).
That is all of my practical capability.
I may assist in theoretical aspects like automata theory, boolean algebra, programming paradigms, complexness analysis... such stuff.

Although, there are still questions to be answered - and do not tell me, nobody knows nothing! How long goes scripting on for PDS?
... Let us start with the simplest of all questions, I asked above:
Do arrays start at zero or at one?
Edited by LordZsar1 on 10-01-2008 12:52
 
Tristan
1 or above makes anything "true", if that's what you mean. 0 is false. Though rules vary depending on the variable in question.
 
LordZsar1
I do indeed know how C++ handles boolean values by integers, but thanks. ~~
Let us switch roles: I shall not ask but I shall tell:

Download source  Code
[...]
local i=1
[...]



This is the definition of variable "i", which occurs in first place and defines it as an "integer" (if signed or unsigned had to be tested).
Integers are elements of the natural numbers...

Download source  Code
[...]
while (SobArrayStatus["EscortArray"..i] ~= 0)do        SobGroup_Create("asdftempsob2")
        SobGroup_Clear("asdftempsob2")
        SobGroup_Create("asdftempsob3")
        SobGroup_Clear("asdftempsob3")       
        if ( ( EscortArrayType[i] == 1 ) and ( SobGroup_AreAnyOfTheseTypes ("EscortArray"..i, "Hgn_LSF") ~= 1 ) ) then
            if (EscortArrayTimer[i] == 0) then
                tempSob2 = SobGroup_CreateShip ("EscortArray"..i,"Hgn_LSF")
                SobGroup_SobGroupAdd("EscortArray"..i,tempSob2)
                EscortArrayTimer[i] = 60
            else
                EscortArrayTimer[i] = EscortArrayTimer[i] - 5;
            end
        end
[...]



You see all these words, which contain the substring "Array" in them?
These are names of variables, which have been instantiated just in the way of the integer number above.
Look closer:

Download source  Code
[...]
        if ( ( EscortArrayType[i] == 1 ) and ( SobGroup_AreAnyOfTheseTypes ("EscortArray"..i, "Hgn_LSF") ~= 1 ) ) then
[...]



You see this "EscortArrayType[i]", do you not? Remember our little integer variable from above? It is there, inside here, to specify the arrays index, at which contained data shall be retrieved.
And remember what number it reads? Exactly: One.
In many programming languages the first storage of an array is accessed via Zero - and if this happens in lua too, this is an inacceptable waste of ressources! Of course, you may say, that means that it has to be one in lua, as surely we would never do such an uglyness.
... But how can I be sure, if there is so much translation work to be done for my appetence to be identified - which is not even equal to be gratified... This was the most simple question, you remember? ^^
Edited by LordZsar1 on 11-01-2008 01:55
 
Tristan
You could always just test by mussing around with some values in the lua files of the game, right?
 
LordZsar1
Surely, and I can invent the wheel anew, if necessary. ^^
Mmh, I may go and take this JIT-compiler for some field testing - but without reference about what is already there (and why it is where it is, as it is, etc.), useful work will be delayed.
...
I did do all this "learn from scratch"-stuff twice before... three years ago with Java and little time later with Jass. The second one is the easier one and I am a little bit proud to say, that my abilities enable me to script in a way that is far more complex and efficient than Blizzard ever intended for their little scripting language.
... Three years, working all alone for myself. That is exactly what you propose. I have to admit - I like working alone... but no one shall estimate achievements in this way. Never published any work for publicity, never even created anything worth to be published - for all I did was experiment, to settle my own inquisitiveness.
Well, so, this project goes on for more than three years, does it not? More time to refine personal abilities, to gather knowledge. Some simple questions should be answered quite easily, for these who work since such a long time on the same subject.

... Maybe my point of view is just faulty as I spent more time with my computer than with carbon based life forms. ^^
If so, do not hesitate to inform me about.
 
Jump to Forum: