Few questions on script commands (for ETScript 4)


(Flippy) #1

Hi,

I am in need of some help. I have just finished writing the new descriptions to each and every Keyword, Operator and Event, and each of their parameters, for the new Intellisense in ETScript 4, and there are a few keywords and parameters where I either have my doubts that they are still in use, or where I simply don’t know what they do (or how to describe them).

So, here’s a list of a few questions for you. Please answer according to the numbers I use to keep it simple. There are a few easy questions and a few that I think people don’t agree on :stuck_out_tongue:

Accums:

  1. What is the maximum index you can use for a globalaccum? (eg, globalaccum [index])
    I have read about 8, some say 9, some say it depends on the mod. The LDR says 10 but I’ve also read that is wrong because numbers 9 and 10 are used for other things already and may cause problems?

  2. What is the maximum index you can use for a local accum

  3. What is the value range for (global)accums? Can they be negative? I am assuming they are half words (−32,768 to +32,767) or maybe signed integers (−2,147,483,648 to +2,147,483,647) but that’s just a guess.

  4. What bit_indeces can we use for (global)accum [index] bitset [bit_index] (or bitreset, etc). Is it a single byte? 0 to 7? 1 to 8?

Keywords:
5. Regarding the sethqstatus [team] [status] command. What does the [status] parameter represent in this keyword? I believe it is the HQ (Command Post) bonus (like how fast your teams chargebar re-fills). What values can it take? 0.0 to 1.0, floats? Integers?

  1. Regarding the addtankammo [amount] command. Is this even functional? If so, what the hell is tank ammo?

  2. Regarding the setmodelfrombrushmodel [targetname] [useoriginforpvs] [nonsolid] command. What does the useoriginforpvs parameter determine? I believe the PVS is the point that determines if the game draws the model or not when it is not in the players view (like the high tower in Goldrush, where a manual PVS is set so that it is always visible). How can I explain this properly and short for my Intellisense?

  3. Regarding the enablespeaker [speakername] (or disablespeaker or togglespeaker) command(s), is the speakername parameter the targetname of the speaker entity, or a name used in the sounds file, or a speaker made in the ingame speaker editor?

Events:
9. Regarding the failed event. Is it the same as the decayed event? The descriptions are nearly the same on Chrukers website (where I am getting all these commands from btw). Is the decayed event only for multi-stage constructibles, whereas the failed event is only for single-stage constructions maybe?

  1. What does the message event do? Chrukers website lists the description as “Contains a sequence of VO in a message”. This does not mean anything to me however, and I don’t know when this event is raised/called/triggered, nor what it can be used for…

That’s it for now, thanks if you can help!


(S14Y3R) #2

Oh Snap! A year ago I’d remember alot more to be able to help. (I can’t wait for v4 btw man!) My Sabbatical took way too long, lol. I R A SlaKKeR.

You should definately wait on confirmation from a wet pro, I’m a little(too) dry, but I’ll try to help…

This is taken from my own script, even though I haven’t been at it for a while, I’ll have to trust myself.
// Local accums(8 maximum) are totally individual for each entity, eg. stor_crane accum 3 set 5 doesn’t affect train2’s accum 3 set 0
//globalaccums are relevant throughout.
// 8 Local accums max
// 10 globalaccums max
//-use bitset and set on same accum value??! -NO!!

  1. I think the max index for a globalaccum is 10, 0-9, I tried a quick tester and it loaded, but who know’s what some mods might reserve? [no clue here, sry]

  2. local accums are max of 8, 0-7(I forget why). But any number of scriptblocks can have eight in their own respective block…

  3. I’ve never heard of an accum value being negative…

  4. bit indeces are a single byte. iirc, once you ‘accum 1 bitset 1’ you cannot ‘accum 1 set 1’ or you get interference. You can however 'accum 1 bit(re)set 0, accum 1 bit(re)set 1 Fawk, I forget the max for those though…

  5. I think hq status is something for the command map and not the charge-bar speed(that’s with setchargetimefactor x xx x) not %100 sure what that does, sry…

  6. Dayam, tank ammo? never had one run out before, no idea if functional, or if you can set the ammo in the tank…

  7. No clue, no comment…:eek:

8, [speakername] is targetname of the speaker entity that is set with the ingame speaker editor which in turn sets up the names in the sounds file, iirc.

9., I have no recollection… sry…

I hope that helped a little, or at least jogs somebodies memory…(Diego? Sage? Mr.Lego?! Who else is up on their scripting?) I’ve been out of it too long.


(Qualmi) #3

ill take a look at number 3 tomorrow, if there might not someone already replied.

and negative values are possible, i just made a script for a ctf map, which is not fully released yet, where i inc and decreased a accumvariable. i also printed the value of the accum and it was indeed a negative value :wink:


(S14Y3R) #4

Oh yea, I forgot about accum x inc -1, any idea how negative they can go?(like up to or past -9?) fawk, how high can those score keeping scripts go? Loffy would know this inside and out…

#3 might be a whole new can of worms if the variables are infinite or something…

*kicks self for not keeping up on this…


(Qualmi) #5

hehe, i made a test a few weeks ago, as i wanted to test exactly this limit…i remember that i stoped at a very high number, more exactly i installed a button, and everytime i pushed it i increased to 5. i did this to 128 (magic number), and then increasing the 5 to 100 and then to 100000 or sth…i think i pushed alot on the button and increased a lot, but cant remember where i stoped lol. it was high number for sure :slight_smile:


(TomTom7777) #6

[QUOTE=Flippy;190235]Hi,

Accums:

  1. What is the maximum index you can use for a globalaccum? (eg, globalaccum [index])
    I have read about 8, some say 9, some say it depends on the mod. The LDR says 10 but I’ve also read that is wrong because numbers 9 and 10 are used for other things already and may cause problems?

  2. What is the maximum index you can use for a local accum
    [/QUOTE]
    In both 2.56 and 2.60 etmain There are 8 globalaccums and 10 accums allocated space. But errors in the code allow indexes of [0…9] in both cases. Consequently globalaccum 8 and globalaccum 9 will trash the neighboring variable (soldierChargeTime) and vice-versa. There are additional errors in some of the debug/diagnostic error messages related to accums that can further confuse but I won’t detail them here. Some major mods will have fixed the allocation bug but which and the version numbers will take some time to reverse-engineer/search.
    I recommend you handle it by using the 0…9 range but adding a WARNING about not using globalaccums 8 and 9.

  1. What is the value range for (global)accums? Can they be negative? I am assuming they are half words (−32,768 to +32,767) or maybe signed integers (−2,147,483,648 to +2,147,483,647) but that’s just a guess.

They are allocated as signed 32bit integers and can be manipulated (set, inc…) as such (−2,147,483,648 to +2,147,483,647)

  1. What bit_indeces can we use for (global)accum [index] bitset [bit_index] (or bitreset, etc). Is it a single byte? 0 to 7? 1 to 8?

0…31 c-style (0 LSb…31 MSb/sign). If you understand binary representations of 32 bit 2’s complement you can mix bit and decimal operations. Example use bits 0, 1 and 2 as say completion bitflags(bitset)
then decimal test (trigger_if_equal 7) to see if all 3 are completed

  1. Regarding the sethqstatus [team] [status] command. What does the [status] parameter represent in this keyword? I believe it is the HQ (Command Post) bonus (like how fast your teams chargebar re-fills). What values can it take? 0.0 to 1.0, floats? Integers?

Status should be 0 (not built) or 1 (built). The chargebar bonus is handled not by sethqstatus but by the lines of setchargetimefactor normally put in the built event. “The sethqstatus script command will inform all team members about landmines being close by”. i.e. the “Mines have been reported in this area.” messages. I could not find any other code using the sethqstatus.

  1. Regarding the addtankammo [amount] command. Is this even functional? If so, what the hell is tank ammo?

Is it functional I don’t know. Google came up with so few hits it looks like nobody was using it. But there is code for it and for settankammo. (btw the code supports the format addtankammo <targetname> <amount> [<maxammo>] where the missing parameter maxammo (in square brackets) is optional)
I tried coding the commands by targeting the script_movers (All of them!) but saw no difference. In the code the <amount> is stored in effect1Time an entity variable that gets re-used a lot. In fact in the spawn code this variable seems to be used for communicating the health bar not ammo. btw there is a comment in mg42 code that says “// “Ammo” for this weapon is time based” so tank ammo may also be so? I wonder if EastFront has looked at this command?

  1. Regarding the setmodelfrombrushmodel [targetname] [useoriginforpvs] [nonsolid] command. What does the useoriginforpvs parameter determine? I believe the PVS is the point that determines if the game draws the model or not when it is not in the players view (like the high tower in Goldrush, where a manual PVS is set so that it is always visible). How can I explain this properly and short for my Intellisense?

  2. Regarding the enablespeaker [speakername] (or disablespeaker or togglespeaker) command(s), is the speakername parameter the targetname of the speaker entity, or a name used in the sounds file, or a speaker made in the ingame speaker editor?

Question 7 is really outside my experience and I don’t think a quick code search will answer your question.
Question 8 others have answered correctly, they all target the targetnames for the relevant entities however they were added. (The ingame speaker editor being my preference)

Events:
9. Regarding the failed event. Is it the same as the decayed event? The descriptions are nearly the same on Chrukers website (where I am getting all these commands from btw). Is the decayed event only for multi-stage constructibles, whereas the failed event is only for single-stage constructions maybe?

The failed event is similar to the decayed event that precedes it. The failed event happens after a decayed event (for any stage). The decayed final event can happen for single stage and multistage constructibles. The decayed stage1…stage3 events may only happen for multi-stage constructibles that have those mid-stage(s) defined. A failed event is triggered after each of these decayed events.
So why have a failed event? It seems to be possibly animation (SP?) related. decayed events occur while the decay sound plays and can start an an action sequence (animation?). The failed event is triggered after the sound is stopped and can not start an an action sequence.

  1. What does the message event do? Chrukers website lists the description as “Contains a sequence of VO in a message”. This does not mean anything to me however, and I don’t know when this event is raised/called/triggered, nor what it can be used for…

I am stumped on this one. “Contains a sequence of VO in a message”. is just the comment beside its entry in the structure that says it can start an action sequence. and yes the script parser accepts event blocks called message { }. I can not find any other useful reference to VO inside a message, or “sequence of”… Since it is an event I have searched the list of entity types reviewing their “message” keys. Even assuming that there is some way to put a VO inside a message key (which would be neat but I doubt you can), I don’t see why you would want to trigger an event script.


(Flippy) #7

Very helpfull so far, thanks!


(-SSF-Sage) #8

Not all are the easiest questions possible. I am writing in hurry now. These could probably all be tested out.

I’ve always trusted this. I haven’t ever tried it actually, because I have never needed. TomTom7777 seems to have good information.

  1. Every accum can be either “normal” or contain bits. Available bits afaik are 0-9 (tank scripting). You can toggle (0/1) each bit with bitset/bitreset.

  2. TomTom7777 should have it right.

  3. Never found out what this exactly does. Only guesses: Maybe you could limit etc. tank’s mg bullets with the tank related commands from chruker? Possibly affects on normal mg too?

  4. No idea, sry.

  5. Ingame speakears (sps file) and IIRC works on target_speakers too (haven’t used them for a long time).

  6. decayed final/stage1/stage2/stage3 can be used for both sorts of constructibles (for single stage you use just final). I’ve never heared or seen (atleast remember) using “failed”. Possibly it’s functional for single stage constructions (a leftover perhaps).

  7. No idea, but g_scriptdebug might reveal it. Pay attention especially on vo’s. :tongue:


(Flippy) #9

If Tom is right and the accums use 32-bit Integer values, then I can’t see any logical reason why there would only be 10 (0-9) bit indeces. It would be 0-31 then, as Tom says.

Each integer value can be represented just by a combination of 0’s and 1’s, for example:
1001001 = 1 * 2^0 + 0 * 2^1 + 0 * 2^2 + 1 * 2^3 + 0 * 2^4 + 0 * 2^5 + 1 * 2^6 = 1 + 0 + 0 + 8 + 0 + 0 + 64 = 73

The highest possible number to make with this is 32 ‘set’ bits (1111 … 111, 32 ones), which corresponds to 2^0 + 2^1 + 2^2 + 2^3 + 2^4 + … + 2^31 = 4,294,967,295.

However, because we use signed integers, we must also allow negatives, so we can only use half of that largest value (and the other half goes into the negative values), so we end up with a range of -2,147,483,648 to 2,147,483,647, which is exactly what I guessed before and what Tom confirmed :slight_smile:

(And yes, I did know all this before, I just didn’t know that ET used 32-bit integers :tongue: )

About the accums… I seem to recall that it was the local accums (not globalaccums) that were limited to 0-7 because 8 and 9 caused trouble in the game code. Slayer also says it’s the local accums. But Tom says it’s the globalaccums that cannot use 8 and 9 safely…? So which is it? :tongue:


(TomTom7777) #10

[QUOTE=Flippy;190290]If Tom is right and the accums use 32-bit Integer values, then I can’t see any logical reason why there would only be 10 (0-9) bit indeces. It would be 0-31 then, as Tom says.
… so we end up with a range of -2,147,483,648 to 2,147,483,647, which is exactly what I guessed before and what Tom confirmed :)[/QUOTE]

FYI My replies are based upon;
1- experience in modifying/extending dozens of script files
2- experience in decoding C and reviewing the SDKs
3- experimental scripting when I want Ivory-soap* answers.
(*"99 and 44/100% certain)

About the accums… I seem to recall that it was the local accums (not globalaccums) that were limited to 0-7 because 8 and 9 caused trouble in the game code. Slayer also says it’s the local accums. But Tom says it’s the globalaccums that cannot use 8 and 9 safely…? So which is it? :tongue:

There are so many bugs in the script code it can get confusing. The code defines look like they intended to do 10 global and 8 local but then they swapped the defines when they defined/allocated the variables. And the bugs in other commands (example printaccum/printglobalaccum can only do 0…7) might lead you to think only 8 local accums can be used. Not so, but accum 8 and accum 9 should only be used for script that you know works as they can’t be debugged as easily as accums 0…7.
BTW any mods that implement Chrukers bugfix project would result in proper globalaccum 0…7 and accum 0…9 that would also work respectively in printglobalaccum and printaccum. Values outside those ranges would halt the map with the relevant script error.

:(*Dedicated to the memory of Marilyn Ann Briggs (April 22, 1952 – April 12, 2009)


(S14Y3R) #11

[QUOTE=TomTom7777;190269]Is it functional I don’t know. Google came up with so few hits it looks like nobody was using it. But there is code for it and for settankammo. (btw the code supports the format addtankammo <targetname> <amount> [<maxammo>] where the missing parameter maxammo (in square brackets) is optional)
I tried coding the commands by targeting the script_movers (All of them!) but saw no difference. In the code the <amount> is stored in effect1Time an entity variable that gets re-used a lot. In fact in the spawn code this variable seems to be used for communicating the health bar not ammo. btw there is a comment in mg42 code that says “// “Ammo” for this weapon is time based” so tank ammo may also be so? I wonder if EastFront has looked at this command?
[/QUOTE]

Time based? I wonder if that has anything to do with the “time to overheat” the gun?

For the accum things, I guess Flippy needs to add "fixed in any mods that implement Chrukers bugfix project " :frowning: