getIterations()
From Hack Wars Wiki
| Function information for getIterations() | |
| Function | getIterations() |
| API | Attacking |
| Cost | $150 |
| Level | 15 |
| CPU Usage | 2 |
| Description | Returns an integer representing how many times the continue function has been called (i.e. how many times you have hit the target's port). |
Basic Example
int iterations = getIterations(); message(getSourceIP(),"You have hit the target's port "+iterations+" times."); |
Placing this in the continue event of an attack script will tell you how many hits you have dealt to the target's port, each time the event is called.
Advanced Example
int iterations = getIterations(); if(iterations==5){ freeze(); message(getSourceIP(),"You just used freeze on the target's port."); } |
Placing this in the continue event of an attack script will launch a freeze on the target's port if the number of iterations is equal to 5. It will also send you a message saying when you have used freeze.
Return values
Returns 0 in Initialize.
Returns 1 to n in Continue.
Returns n in Finalize.
n is the number of times you dealt damage to your target (without using berserk()).
