Input Value Logging

ToxicFiend

Member
I am essentially trying to track all damage dealt to a prop using a Wiremod damage detector. I just need a simple script for E2, or using gates that lets me add all damage taken, to display it on a screen.

I've screwed around with E2 but I am not experienced enough to figure out how to get the variables into an array.
 

TheRedSky

Senior-Administrator
Staff-Member
Alright I think i might be able to help out a bit, generally it boils down what exactly you are looking for, then gathering that information and presenting it in different ways. Lets start with what exactly you are looking for.
If you want to take the total damage then thats a bit simpler, as you dont need to mess around with arrays and such. You would just need to accumulate the damage being done.

If you wanted to calculate the damage being done within a certain time frame, If(first()){ is great help, as it should automatically trigger on the first hit, followed by a "for" loop and start counting down at whatever interval you set (the shorter the better, but will pull more ops, try to keep to a few lines of code). Then output the result, lets say after 60 seconds.

If you want to create an array per damage tick, it might take a bit of time, but should just be inserting a new array entry, printing it would just be the same as the above but in reverse, using a for loop to print every entry of the table.

The damage detector doesn't include the use of drug, I've personally tested it. I'm not sure about blowtorches, as making something like requires me being in a raid, but I'll see if it has any affect.
 

ToxicFiend

Member
Alright I think i might be able to help out a bit, generally it boils down what exactly you are looking for, then gathering that information and presenting it in different ways. Lets start with what exactly you are looking for.
If you want to take the total damage then thats a bit simpler, as you dont need to mess around with arrays and such. You would just need to accumulate the damage being done.

If you wanted to calculate the damage being done within a certain time frame, If(first()){ is great help, as it should automatically trigger on the first hit, followed by a "for" loop and start counting down at whatever interval you set (the shorter the better, but will pull more ops, try to keep to a few lines of code). Then output the result, lets say after 60 seconds.

If you want to create an array per damage tick, it might take a bit of time, but should just be inserting a new array entry, printing it would just be the same as the above but in reverse, using a for loop to print every entry of the table.

The damage detector doesn't include the use of drug, I've personally tested it. I'm not sure about blowtorches, as making something like requires me being in a raid, but I'll see if it has any affect.
Thank you, very helpful. I don't mind drugs and stuff, worst case multiply it in the script like the drug would do.

All in all this is useful, guess I should start learning E2... :LOL:
 

TheRedSky

Senior-Administrator
Staff-Member
For the first case:
Code:
@name Damage Accumulator
@inputs Damage CLK Reset
@outputs Output
@persist Output
if(first()){
    Output= 0
}
if(Reset == 1){
    Output= 0
}
if(Damage>0 & ~CLK){
    Output= Output+ Damage
}
reset seems to be a bit buggy, ill need to work on that but it should give you a general idea of how much damage things do within a certain timeframe
Fixed, have fun!
 
Last edited:

ToxicFiend

Member
For the first case:
Code:
@name Damage Accumulator
@inputs Damage CLK Reset
@outputs Output
@persist Output
if(first()){
    Output= 0
}
if(Reset == 1){
    Output= 0
}
if(Damage>0 & ~CLK){
    Output= Output+ Damage
}
reset seems to be a bit buggy, ill need to work on that but it should give you a general idea of how much damage things do within a certain timeframe
Fixed, have fun!
Wow, thank you a lot!
 
Top