Hmm. When I said void, I was basically saying to replace bool TileMod() and bool TileKill() with void TileMod() and void TileKill(). When doing this, comment out those return statements within those functions and see what happens.
Also, IF statements don't require ELSE statements to be bundled with them. For instance rather than:
Code:
if (cheese == 3)
{
random_number = 42;
}
else
{
// Nothing is here. (about the same as your return statements)
}
Code:
if (cheese == 3)
{
random_number = 42;
}
Note that I didn't do anything else. This means that nothing will happen if the IF statement is not true. ELSE statements are used if you wish for an alternative action to happen if the IF test is not true.
Edit: I'm not really sure what those two functions are trying to accomplish, really. They are thrown out by themselves. I'm pretty much saying what I think might be the fix the current problem. I'm not sure if this will make the script work how you want it to work.
Edit 2: Well.. what I suggested makes pretty compile errors.
Edit 3: I want to slap myself in the face now. The new compile error with my change is because of:
Code:
if(selectionflag==112){
!TileMod(); // ---This line---
} // end of item condition
else{
!TileKill(); // ---And this line---
}
And as for what is causing the bool to float error... it's line 33 (for me):
Code:
Link->Item[113] = item_state;
...and line 50 (for me)...
Code:
Link->Item[113] = item_state;
Hmm... I'm not sure what's causing the slowdown and crash, though. My changes didn't really do anything at all in that regard.
Edit 4: On my continuing debugging (and rambling about it), I've noticed something strange with how you are defining (or rather, lack of defining) item state. It might not be necessary at all. I'm toying with that now.
Basically, you are comparing item state before you even define a value for it. You are doing the same thing with item number.
Edit 5: Well I'm miffed about this one. Even after I simplified things a great deal, it still locks up. Here's what I ended up with (though it may not even be what you were looking for... I'm halfway asleep now)
On a related note, you still need to define selectionflag. I couldn't really do that for you in this situation since I dunno how this script interfaces with anything else (you should have left that other code floating around for me to look at). I tried manually defining it and this bugger still locked up.
Code:
global script CJCitems{
int selectionflag;
void run(){
while(true){
if(selectionflag==112){
TileMod();
} // end of item condition
else{
TileKill();
}
Waitframe();
}//end of while loop
} // end of void run
void TileMod(){
//int item_number;
//int item_state;
if(selectionflag==112){
if(!Link->Item[113]){ // I tried comparing this (without !) to 0, but it didn't like that.
Link->Item[113] = 1;
}
}
}//! End of TileMod
void TileKill(){
if(selectionflag==1){
if( Link->Item[113]){ // I tried comparing this to 1, but it didn't like that either.
Link->Item[113] = 0;
}
}
}//! End of TileKill
}// end of global script
If I were more awake, I'd probably have a better chance of figuring out what the problem is. My guess is that it's not liking something about Link->Item[113]. I really don't know what, as I've had limited experience with the inner workings of the actual scripting. For all I know, I've completely screwed up on all of this. Sorry I wasn't of much help.
Here is a question though: are global scripts even working? I know it's assumed they are, but are they actually working? No one has really tested them until now.
Edit 6: I just realized something that is missing. Waitframe();
Final Edit: And that was the problem. Added it to the above code. Whew! You can tell I'm new to this.
The codebox above should compile and work, but I'm not sure it will do what you wanted it to do. This is partially because I have no clue what you were trying to do. If that code fails to satisfy you, then just add Waitframe(); to your loop in your version like I did with this one and it should at least execute without locking up ZC.