CODE
ffc script multi_tired_secrets{
void run(){
int flags[176];
int iflags[176];
for(int i=0;i<176;i++) flags[i]=Screen->ComboF[i];
for(int i=0;i<176;i++) iflags[i]=Screen->ComboI[i];
if(Screen->D[0]>0){
for(int i=0;i<Screen->D[0];i++){
Screen->TriggerSecrets();
for(int i=0;i<176;i++) flags[i]=Screen->ComboF[i];
for(int i=0;i<176;i++) iflags[i]=Screen->ComboI[i];
}
}
while(true){
if(combo_at_secret_flag_changed(flags,iflags)){
Screen->D[0]++;
}
for(int i=0;i<176;i++) flags[i]=Screen->ComboF[i];
for(int i=0;i<176;i++) iflags[i]=Screen->ComboI[i];
Waitframe();
}
}
}
bool combo_at_secret_flag_changed(int flags,int iflags){
bool changed=false;
int newflags[176];
int newiflags[176];
for(int i=0;i<176;i++) newflags[i]=Screen->ComboF[i];
for(int i=0;i<176;i++) newiflags[i]=Screen->ComboI[i];
for(int i=0;i<176;i++){
if(is_secret_flag(flags[i])&&newflags[i]!=flags[i]) changed=true;
if(is_secret_flag(iflags[i])&&newiflags[i]!=iflags[i]) changed=true;
}
return changed;
}
bool is_secret_flag(int flag){
bool is=false;
for(int i=16;i<32;i++){
if(flag==i) is=true;
}
return is;
}
For the people that want to maybe only save the screen-secret state IF say 5 secrets are triggered and not for any other secrets i made the following script(D0 sets after which number of secrets triggered the screen-secret-state gets saved).
CODE
ffc script multi_tired_only_save_full_trigger{
void run(int num_secrets){
int flags[176];
int iflags[176];
for(int i=0;i<176;i++) flags[i]=Screen->ComboF[i];
for(int i=0;i<176;i++) iflags[i]=Screen->ComboI[i];
if(Screen->D[0]>0){
for(int i=0;i<Screen->D[0];i++){
Screen->TriggerSecrets();
for(int i=0;i<176;i++) flags[i]=Screen->ComboF[i];
for(int i=0;i<176;i++) iflags[i]=Screen->ComboI[i];
}
}
int secret_num=0;
while(true){
if(combo_at_secret_flag_changed(flags,iflags)){
secret_num++;
}
for(int i=0;i<176;i++) flags[i]=Screen->ComboF[i];
for(int i=0;i<176;i++) iflags[i]=Screen->ComboI[i];
if(secret_num==num_secrets)Screen->D[0]=num_secrets;
Waitframe();
}
}
}
Now on what to do in zquest. The ffc you use for this needs to be active on init (set it in the ffc flags). Also the screen needs the flag secrets are temporary checked or else it will be buggy.
If you want to use the second script only be sure to copy the functions from script 1 to make sure it compiles(i posted the functions with script 1 only for simplicity).
Yes my code sucks the same could probably be done much easier but who fucking cares? It works.
If you have trouble with the script please read this post again and dont ask any questions because probably you did something wrong by not reading it properly i wont answer such questions.
If you really cant read here have a demoquest: http://www.file-uplo...ecrets.qst.html
If you are really bad at reading here is the delete link: http://www.file-uplo...218/dxep7f.html
If its deleted probably someone was bad at reading. I wont reupload.
As always feel free to edit modify or even post this code unaltered to the database i dont require credit or any such crap.
Edited by aaa2, 22 November 2012 - 04:13 PM.

