How do I access global integers in an FFC script?
I can do this right?
How do I access global integers in an FFC script?
I can do this right?
int global;ffc script test{
void run(){
int not global;
while(true){
Waitframes(60);
global++;
not global++;}
}
}
Got it?
So I just access it in the FFC script like I would any other integer?
And do I have to declare it within my global script, or just after import "std.zh"?
EDIT: I've tried it just after import "std.zh", and in the global script. It says that it wasn't declared when I did it within the global script, so I assumed that it would be outside the script, when it didn't tell it me it wasn't declared.
So when I try this:
int brac = 0;ffc script bracelet_warp{ //start script
void run(int map, int scr){ //start void run
while(brac == 0){ //start while loop
if(Link->Item[19] == true){ //start if
Link->PitWarp(map,scr);
int brac = 1;
} //close if
Waitframe();
} //close while loop
} //close void run
} //close script
if(Link->Item[19] == true){ //start if
Link->PitWarp(map,scr);
int brac = 1;
you defined a local varible called brac, so take out int
Also, last time I knew checking if Link has an item every frame can cause major slowdown (I think DD said that can't be fixed until ZC 3.0) You might want to do this instead:
int brac = 0;ffc script bracelet_warp{ //start script
void run(int map, int scr){ //start void run
while(brac == 0){ //start while loop
Waitframe();
} //close while loop
Link->PitWarp(map,scr);
} //close void run
} //close script
item script got_brac{
void run(){
brac = 1;
}
}
That exact script won't work, because even though you've elimated the while loop, when
you enter the screen after picking up the bracelet, it still warps you before the first frame.
However, when I edited it to look like this:
ffc script bracelet_warp2{ //start script
void run(int map, int scr){ //start void run
while(true){ //start while loop
if(brac == 0){ //start if
brac = 1;
Link->PitWarp(map,scr);
}
Waitframe();
} //close while loop
} //close void run
} //close scriptitem script got_brac{
void run(){
brac = 1;
}
}
it warps you when you first step onto the screen, then when you step back onto it it doesn't warp you, even when you pick up the bracelet.
I had not thought of that, glad you got it woking right 😊
It infact wasn't working (I did say :confused😊
but anyway, now it is 😃
int brac =0;ffc script bracelet_warp{ //start script
void run(int map, int scr){ //start void run
while(brac <2){ //start while loop
if(brac == 1){ //start if
brac = 2;
Link->PitWarp(map,scr);
}
Waitframe();
} //close while loop
} //close void run
} //close script
item script got_brac{
void run(){
brac = 1;
}
}
Thankyou 😊
Setting inventory is what's slow; checking for an item shouldn't be much slower overall than reading an int.
Best of all of course is to move everything into the item script, and avoid having to busy-loop:
int brac=0;item script got_brac{
void run(){
if(brac == 0) {
brac = 1;
Link->PitWarp(map,scr);
}
}
}
I think he wants it to check if Link has the braclet on a specific screen (thus the use of an FFC) If the screen is entered and no braclet, nothing happens but if you do have it you will warp to *wherever* . Not sure but that is what I gathered from the original script. But if you want to warp as soon as you get the braclet DD's script should do the trick with much less code.