Re: Script does something twice it should do once
I don't see anything obviously wrong with the script. Maybe whatever the script is attached to, is created twice and something goes wrong while testing if the actor has already been infected.
"No such operator defined" error probably refers to problem with userdata objects (no operator defined for the userdata to do some action, could be printing or equality testing or something else), and I guess no line numbers either in the error? In that case it's a bit harder to figure out and requires testing.
I'm not sure if it's ok to test it with objects directly like "if actor == actor". I've run into problems before unless I've used the member variables of the object. Using actor ID's could work better. I'm just guessing, but that might be the problem.
Use the basic debugging method by removing code until the error is gone and then add it back until you've located the problem or upload the whole mod here for somebody else to figure it out
I can only think of 2 ways to pass information between scripts other than the game property variables: (btw, did you try wound.Team?)
1. If setting script2.MyVariable = x, and then inside script2 reading it by self.MyVariable doesn't work...
2. Use global tables like you used the infected table. Script 1 creates table if it doesn't exist, and writes it's data to it, script 2 reads the data from the table and removes the entry, and if the table then is empty, sets the reference to the table to nil to mark the table's memory to be released. Make sure you read the right data from right script when there are multiple scripts sending data to other scripts at the same time. You also have to avoid collisions with global variables of other mods.
This is a bit complicated though and might result in a lot of unnecessary memory allocation and deallocation, let alone numerous checks in the numerous scripts running. And if it's not done, the memory won't be released until CC is closed down.
It might be better to use some global manager particle script that manages the table for all scripts and perhaps even the scripts themselves could run in the manager script, all combined, so you wouldn't need to worry about passing information between scripts then or use global variables at all. Best option in my opinion in that case, when you really don't have much choice.
Awesomeness wrote:
What's the difference?
There isn't any difference in program logic in this case.