| Blockland Forums > Modification Help |
| I am a begginner and need some help. |
| (1/3) > >> |
| rusanton99:
I know some basics, and understand some coding. However, I don't know how to get a script working other than typing it into the console. For now I just want to do this simple code: --- Quote ---function helloWorld() { echo("Hello World!"); } --- End quote --- I don't know where to put it for it to work. Please help? |
| Superb:
Well, I usually put my files into the base folder of blockland before i package them up. You usually have to restart blockland so the new file will be recognized when you first create it, but alternatively you can type setmodpaths(getmodpaths()); So open up blockland, make a file in your base folder called Test.cs, put that hello world code inside of it and save. Now switch back to blockland and open the console and type this. setmodpaths(getmodpaths()); exec("base/test.cs"); It should say Executing base/test.cs. Then simply call your function from the console and it should work. To package your add-on, you will have to put it into a client_test.zip with a description, namecheck, and a client.cs which can either contain the test code and you wont need another .cs file, or make it execute the test code which requires another .cs file. This is an example of how a packaged add-on should look, take a look at the client.cs file inside of it (this is a client sided add-on). http://forum.returntoblockland.com/dlm/viewFile.php?id=3835 |
| rusanton99:
--- Quote from: Superb on December 12, 2011, 10:49:11 PM ---Well, I usually put my files into the base folder of blockland before i package them up. You usually have to restart blockland so the new file will be recognized when you first create it, but alternatively you can type setmodpaths(getmodpaths()); So open up blockland, make a file in your base folder called Test.cs, put that hello world code inside of it and save. Now switch back to blockland and open the console and type this. setmodpaths(getmodpaths()); exec("base/test.cs"); It should say Executing base/test.cs. Thanks. Can I use notepad or does it have to be a special program? Then simply call your function from the console and it should work. To package your add-on, you will have to put it into a client_test.zip with a description, namecheck, and a client.cs which can either contain the test code and you wont need another .cs file, or make it execute the test code which requires another .cs file. This is an example of how a packaged add-on should look, take a look at the client.cs file inside of it (this is a client sided add-on). http://forum.returntoblockland.com/dlm/viewFile.php?id=3835 --- End quote --- |
| Port:
--- Quote from: Superb on December 12, 2011, 10:49:11 PM ---setmodpaths(getmodpaths()) --- End quote --- You actually don't have to do that in this case. exec automatically refreshes the file cache for that specific path (base/Test.cs). You'd only have to do that if something specific used isFile or was in a .zip file. |
| Ipquarx:
--- Quote from: Superb on December 12, 2011, 10:49:11 PM ----Very Large Snip- --- End quote --- None of that crap is needed. Just use exec("base/blah.cs"); It works fine. |
| Navigation |
| Message Index |
| Next page |