I'm working on a script to 'gimp' some Link Tile modifiers, so that they only appear after an item has been activated and only disappear upon the activation of another item.
To test it, I combined it with my dash boots script to create a new B-button item.
However, I've got an error message I can't repair. Though it doesn't damage compiling at all, it freezes ZC after 2 frames (Heavy calculations for no reason.)
The error message says "Warning: Cast from Float to Bool". As I'm unsure of what exactly that means, I was hoping I'd find an answer in here.
global script CJCitems{ int selectionflag;
void run(){
while(true){
if(selectionflag==112){
!TileMod();
} // end of item condition
else{
!TileKill();
}
}//end of while loop
} // end of void run
bool TileMod(){
int item_number;
int item_state;
if(selectionflag==112){
if( Link->Item[113] ){
return false;
}
else{
if (item_number > 0 && item_number < 255){
if (item_state == 0 || item_state == 1){
item_state = 1;
Link->Item[113] = item_state;
}
}
}
}
}//! End of TileMod
bool TileKill(){
int item_number;
int item_state;
if(selectionflag==1){
if( Link->Item[113] ){
if (item_number > 0 && item_number < 255){
if (item_state == 0 || item_state == 1){
item_state = 0;
Link->Item[113] = item_state;
}//!End of item_state validation
}//!End of item_number validation
}
}
else{
return false;
}
}//! End of TileKill
}// end of global script
Above is the script in its entirety, but these are the parts that I'm really having problems with:
bool TileMod(){int item_number;
int item_state;if(selectionflag==112){
if( Link->Item[113] ){
return false;
}
else{
if (item_number > 0 && item_number < 255){
if (item_state == 0 || item_state == 1){
item_state = 1;
Link->Item[113] = item_state;
}
}
}
}
}//! End of TileModbool TileKill(){
int item_number;
int item_state;if(selectionflag==1){
if( Link->Item[113] ){
if (item_number > 0 && item_number < 255){
if (item_state == 0 || item_state == 1){
item_state = 0;
Link->Item[113] = item_state;
}//!End of item_state validation
}//!End of item_number validation
}
}
else{
return false;
}
}//! End of TileKill
Selection flag is a set integer that's put into place by an item script on the boots item (Which is currently overlapping the 'Bait' item so that I could have it in my inventory.)
Other items that I had provided have a 'null selection' flag that changes the number to 1, a number that only makes the final 'if' statement true.
This portion of the script is designed to check if an item is in the inventory. If it is and the Selection flag is 112, then it does nothing. If the Selection flag is 112 but the item is not in the inventory, it adds it.
However, if the item is in the inventory and the Selection flag is 1, it removes it from the inventory. If it isn't there and the flag is 1, then the code does nothing.
What's confusing me is this 'Cast from Float to Bool' statement. It doesn't harm the script compiling, but it freezes ZC when the quest is loaded.
I need it to just process in the background. Right now it seems the interference between 'float' and 'bool'... whatever that means, is slowing the engine's calculations to a crawl.
EDIT: You'll pardon if the script isn't exactly horizontal-bar friendly... it's got a lot of scopes.
EDIT2: I snipped the 'Boots' code out of the global code, in the hopes it would run better. More in my reply.