When editing mods, it easily happens that you accidentally screw up a script or whatever. Since finding out the cause can be really painful and time-consuming I thought about sharing my common script errors here and also tips on how to work effectively.
You start off with a fastfile which works like a mod by someone. Copy and paste the .ff file into the same directory creating a copy of the original. Open up the original and start modifying/ adding some code. Remember to operate very carefully! Do little changes to have a low chance in a syntax error.
Remember to follow this guide for convenience:
http://www.bullywiihacks.com/t4005-
Once done, replace the original file in the ISO, transfer it to your harddrive and test it on your Wii.
Does it have a compile error?
You can now use the backup file again to start off with a properly working file. Eventually delete the screwed one or use it for reference. Alternatively you can go and fix your error. Remember to duplicate the working one again before you touch it.
Does it work?
Duplicate it as backup and continue working with the file you originally edited. If you feel like the directory gets messy, you can move the backup files to some other folder.
Doing incremental changes is the key. Never trust your own code to work 100% or someone else's script. Errors are where you expect them the least.
Let's talk about some script errors I had and overlooked.
You start off with a fastfile which works like a mod by someone. Copy and paste the .ff file into the same directory creating a copy of the original. Open up the original and start modifying/ adding some code. Remember to operate very carefully! Do little changes to have a low chance in a syntax error.
Remember to follow this guide for convenience:
http://www.bullywiihacks.com/t4005-
Once done, replace the original file in the ISO, transfer it to your harddrive and test it on your Wii.
Does it have a compile error?
You can now use the backup file again to start off with a properly working file. Eventually delete the screwed one or use it for reference. Alternatively you can go and fix your error. Remember to duplicate the working one again before you touch it.
Does it work?
Duplicate it as backup and continue working with the file you originally edited. If you feel like the directory gets messy, you can move the backup files to some other folder.
Doing incremental changes is the key. Never trust your own code to work 100% or someone else's script. Errors are where you expect them the least.
Let's talk about some script errors I had and overlooked.
- Array index increment:
- Code:
arrayCounter = 0;
myArray = [];
myArray[arrayCounter++] = "1st value";
myArray[arrayCounter++] = "2nd value";
myArray[arrayCounter++] = "3rd value";
...
This is wrong. You can not increment the arrayCounter integer variable inside the array brackets. I do not exactly know why but it caused my syntax error. Unfortunately you never receive any specific error messages. The reason it fooled me was because it works in Java and I was tired of incrementing the number by hand like this:
- Code:
myArray = [];
myArray[0] = "1st value";
myArray[1] = "2nd value";
myArray[2] = "3rd value";
...
What you can do for sure is this:
- Code:
arrayCounter = 0;
myArray = [];
myArray[arrayCounter] = "1st value";
arrayCounter++;
myArray[arrayCounter] = "2nd value";
arrayCounter++;
myArray[arrayCounter] = "3rd value";
...
The ++ increment operator does exist, but it may not be used inside of array brackets.
- Function names:
- Functions with the same names can NOT be defined, even if they have a different parameters list. Again, this is allowed in some other languages, but not here.
- Code:
doSomething()
{
doSomething(hi);
}
// Function 'doSomething' already defined
doSomething(hi)
{
self iPrintLn(hi);
}