Welcome to the Scripting Help Forum

This forum is for discussing writing scripts with the in-game programming API. Sometimes programming can be a challenge so use this forum to discuss the best way to write scripts and to get help when you just can't get your app to compile.

Please keep all discussion in this forum civil and refrain from using improper language unless necessary.

question about scripting

i am very new to the game and i dont even know how to begin making a script can you posibly help my on this topic at hand?

Step by step

Hi, welcome to the game. You really should read the hwiki here
http://www.hackwars.net/wiki/index.php/Main_Page

there are several helpful hints, tips, tutorials and an excellent overview of the entire game and how to's as well as an in game tutorial to start your first attack under the TUTORIALS menu.

However, I, like you, don't always understand that dry technical mumbo jumbo, so here is a very basic step by step to give you a start.

1. Log in to the game

2. Click on APPLICATIONS in the upper left corner of the Hackwars window

3. Select SCRIPT EDITOR from the drop down menu (This opens a notepad-like window where you actually build your scripts and or challenges)]

4. Click the very far left icon that looks like a blank page (this opens the template selector where you choose what kind of script you are going to write)

5. choose ATTACK and click ok (this opens a template for an attack script)

6. You will notice 3 sections, Initialize, Finalize and Continue. Those are the 3 steps an attack script goes through to perform an attack. Initialize happens prior to the attack, continue happens after every iteration or damage phase, finalize happens when you have gotten the firewall to zero and are ready to finalize your attack.

7. click the finalize tab

8. There should already be a INT MAIN() { } inside each section. I won't go into the long story of it, but for basic scripts just put your code between the first { and the last } and it should be ok. When you get better you can play with various coding styles and create your own.

9. open the hwiki api page here http://www.hackwars.net/wiki/index.php/Functions and look at the attack functions http://www.hackwars.net/wiki/index.php/Functions#Attacking_Functions

10. read some of the basic functions. You can only script up to your current ATTACK level, which starts at 1. As you build your attack, you can use bigger and better functions.

11. based on the required level we only have 3 functions to choose from to start, so we are going to choose the showChoices() function.

12. in the finalize section of the script, between the first { and the last } type or copy what I have here ---> showChoices();

13. If you mispell it or forget the ; at the end it will not work.

14. your final script should look something like this

int main(){
showChoices();
}

15. now we learn to compile by testing our script with the TEST COMPILE BUTTON which is third button from the right end. when you click that it should tell you that the script costs $10 and 20 CPU

16. If you get errors, you did something wrong, so look at the script and see what you messed up. BTW, naming is optional, it will be called untitled if you don't save it with a name.

17. No errors means you are ready to compile with the center button on the end set of three, looks like a stack with an arrow pointing down to it.

18. Turn on a bank port and withdraw $10 from your bank to pettycash then click the compile button and select ok.

19. Congratulations, you just made an attack script. Now click one of your empty ports that says CLICK HERE TO INSTALL A SCRIPT and select your new script.

20. You just made an attack script and installed it to an empty port. You are now ready to face your noob oppressors. check the NETWORK window to see a list of yellow quest NPC or white attack npc and get to work.