Programs in Hack Wars are based around entry-points. When an event fires to trigger one of these entry-points, the code in your program executes. All programs work in the same way, regardless of whether they’re purchased from the store, dropped by an NPC or bought from another player. Attack has three of these entry-points, each one serving a unique purpose:
Initialize: The code in initialize runs when an attack is first starting. This is a good place to cancel an attack before it really even begins. It is also where you provide malicious hooks into a program for Trojan virus applications that use functions like zombie. What follows is some sample code that you might put into initialize to make sure you do not attack one of your friends:
string friend="192.168.2.002";
if(equal(getTargetIP(),friend)){
cancelAttack();
} continue: Each time that an attack is about to perform its next round of damage on an opponent, continue is called. This is a good place to to come to a decision as to whether or not an attack should be canceled. The following sample code demonstrates how to cancel an attack if it is taking too long to finish:
int max_iterations=15;
if(getIterations()>max_iterations){
cancelAttack();
} finalize: Finalize is called when the health of the port you were attacking has been brought down to 0. You can only perform one finalize function in finalize, a list of which follows (you can combine these with functions that do not finalize, such as message):
showChoices(): Displays a dialog on your desktop allowing you to perform a malicious operation on the port that has been weakened. The options available depend on the type of port that was attacked, and include: stealing petty cash, taking over a player’s website, stealing a file, and peeking at code.
installScript(): Allows you to install your own malicious application over top of an opponent’s existing application. The program you wish to install is provided as a parameter before beginning the attack. These parameters will be discussed in detail in the next section.
emptyPettyCash(): Empties an opponent’s petty cash into your petty cash.
deleteLogs(): Deletes all log entries caused by your IP in the opponent’s log.
destroyWatches(): Destroys all the watches attached to the opponent’s port you are attacking.
What follows is some sample code for finalize that either shows choices or steals petty cash, depending on how much money is present in your opponent’s petty cash:
float steal_amount=1000.0f;
if(checkPettyCash()>=steal_amount){
emptyPettyCash();
}else{
showChoices();
}
Recent comments
5 days 3 hours ago
1 week 3 days ago
1 week 3 days ago
1 week 4 days ago
1 week 4 days ago
1 week 6 days ago
1 week 6 days ago
1 week 6 days ago
2 weeks 2 hours ago
2 weeks 15 hours ago