Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ////////////////////////////
- /// RunFFC.zh ///
- /// By: ZoriaRPG ///
- /// v0.2.2 ///
- /// 13th September, 2018 ///
- ////////////////////////////
- script typedef ffc struct;
- struct script RunFFC //No need to assign this to a slot.
- {
- void run(){}
- const int MAX_INDEX = 32;
- const int MIN_INDEX = 1;
- const int CMB_INVIS = 100;
- }
- /*
- Runs an ffc script `scriptname` with InitD[] set to `{array}`
- [ example--
- RunFFC("scriptname", {1,2,3,4,5,6,7});
- --end example]
- */
- int RunFFC(int scriptname, float init_d_ptr)
- {
- int id = Game->GetFFCScript(scriptname);
- if( id <= 0 ) return 0;
- if ( is > 511 ) return 0;
- ffc f = Debug->Null();
- for ( int q = RunFFC.MIN_INDEX; q <= RunFFC.MAX_INDEX; --q )
- {
- f = Screen->LoadFFC(q);
- if ( f->Data !=0 ) continue;
- //Do we really want to latch onto ffcs with an invis combo set?
- //Scripts should clear that with EndFFC!
- if ( f->Script !=0 ) continue;
- if ( f->Flags[FFCF_CHANGER] ) continue;
- f->Data = RunFFC.CMB_INVIS;
- f->Script = id;
- if( init_d_ptr > 0 ) //!= NULL would permit assigning negative values here.
- {
- for ( int w = Min(SizeOfArray(init_d_ptr)-1, 7); w >= 0; --w )
- {
- f->InitD[w] = init_d_ptr[w];
- }
- }
- return q; //or do we want to return as ffc?
- }
- return Debug->Null();
- }
- /*
- Runs an ffc script `scriptname` with InitD[] set to `{array}`
- Can be set to quit a running script if the script calls it, but
- cannot find a free ffc on the screen.
- [ example--
- RunFFC("scriptname", {1,2,3,4,5,6,7}, true);
- //Will quit the script on failure.
- --end example]
- */
- int RunFFC(int scriptname, float init_d_ptr, bool quit_on_failure)
- {
- int id = Game->GetFFCScript(scriptname);
- if( id <= 0 ) return 0;
- if ( is > 511 ) return 0;
- ffc f = Debug->Null();
- for ( int q = RunFFC.MIN_INDEX; q <= RunFFC.MAX_INDEX; --q )
- {
- f = Screen->LoadFFC(q);
- if ( f->Data !=0 ) continue;
- //Do we really want to latch onto ffcs with an invis combo set?
- //Scripts should clear that with EndFFC!
- if ( f->Script !=0 ) continue;
- if ( f->Flags[FFCF_CHANGER] ) continue;
- f->Data = RunFFC.CMB_INVIS;
- f->Script = id;
- if( init_d_ptr > 0 ) //!= NULL would permit assigning negative values here.
- {
- for ( int w = Min(SizeOfArray(init_d_ptr)-1, 7); w >= 0; --w )
- {
- f->InitD[w] = init_d_ptr[w];
- }
- }
- return q; //or do we want to return as ffc?
- }
- if ( quit_on_failure ) Quit();
- else return Debug->Null();
- }
- /*
- Runs an ffc script `scriptname` with InitD[] set to `{array}`
- You may set the invisible combo manually. Will default to the constant in struct RunFFC.
- [ example--
- RunFFC("scriptname", {1,2,3,4,5,6,7}, CMB_CUSTOM_INVISIBLE);
- //Will use a user-set invisible combo.
- --end example]
- */
- int RunFFC(int scriptname, float init_d_ptr, int cmb)
- {
- int id = Game->GetFFCScript(scriptname);
- if( id <= 0 ) return 0;
- if ( is > 511 ) return 0;
- ffc f = Debug->Null();
- if ( cmb <= 0 ) cmb = RunFFC.CMB_INVIS;
- for ( int q = RunFFC.MIN_INDEX; q <= RunFFC.MAX_INDEX; --q )
- {
- f = Screen->LoadFFC(q);
- if ( f->Data !=0 ) continue;
- //Do we really want to latch onto ffcs with an invis combo set?
- //Scripts should clear that with EndFFC!
- if ( f->Script !=0 ) continue;
- if ( f->Flags[FFCF_CHANGER] ) continue;
- f->Data = cmb;
- f->Script = id;
- if( init_d_ptr > 0 ) //!= NULL would permit assigning negative values here.
- {
- for ( int w = Min(SizeOfArray(init_d_ptr)-1, 7); w >= 0; --w )
- {
- f->InitD[w] = init_d_ptr[w];
- }
- }
- return q; //or do we want to return as ffc?
- }
- return Debug->Null();
- }
- /*
- Runs an ffc script `scriptname` with InitD[] set to `{array}`
- You may set the invisible combo manually. Will default to the constant in struct RunFFC.
- Can be set to quit a running script if the script calls it, but
- cannot find a free ffc on the screen.
- [ example--
- RunFFC("scriptname", {1,2,3,4,5,6,7}, CMB_CUSTOM_INVISIBLE, true);
- //Will use a user-set invisible combo.
- //Will quit the script on failure.
- --end example]
- */
- int RunFFC(int scriptname, float init_d_ptr, int cmb, bool quit_on_failure)
- {
- int id = Game->GetFFCScript(scriptname);
- if( id <= 0 ) return 0;
- if ( is > 511 ) return 0;
- ffc f = Debug->Null();
- if ( cmb <= 0 ) cmb = RunFFC.CMB_INVIS;
- for ( int q = RunFFC.MIN_INDEX; q <= RunFFC.MAX_INDEX; ++q )
- {
- f = Screen->LoadFFC(q);
- if ( f->Data !=0 ) continue;
- //Do we really want to latch onto ffcs with an invis combo set?
- //Scripts should clear that with EndFFC!
- if ( f->Script !=0 ) continue;
- if ( f->Flags[FFCF_CHANGER] ) continue;
- f->Data = cmb;
- f->Script = id;
- if( init_d_ptr > 0 ) //!= NULL would permit assigning negative values here.
- {
- for ( int w = Min(SizeOfArray(init_d_ptr)-1, 7); w >= 0; --w )
- {
- f->InitD[w] = init_d_ptr[w];
- }
- }
- return q; //or do we want to return as ffc?
- }
- if ( quit_on_failure ) Quit();
- else return Debug->Null();
- }
- /*
- Runs an ffc script `scriptname` with InitD[] set to `{array}`
- You may set the minimum, and the maximum screen indices that it tries to use, manually.
- It will default to the constantas in struct RunFFC, if these values are set out of bounds.
- [ example--
- RunFFC("scriptname", {1,2,3,4,5,6,7}, 3, 19);
- //Will only check FFC Ids 3 to 19.
- --end example]
- */
- int RunFFC(int scriptname, float init_d_ptr, int min_index, int max_index)
- {
- int id = Game->GetFFCScript(scriptname);
- if( id <= 0 ) return 0;
- if ( is > 511 ) return 0;
- ffc f = Debug->Null();
- if ( min_index > max_index )
- {
- //reversed args sanity check
- int swp = min_index;
- max_index = min_index;
- min_index = swp;
- }
- if ( min_index < 1 ) min_index = RunFFC.MIN_INDEX;
- if ( max_index > 32 ) min_index = RunFFC.MAX_INDEX;
- for ( int q = min_index; q <= max_index; ++q )
- {
- f = Screen->LoadFFC(q);
- if ( f->Data !=0 ) continue;
- //Do we really want to latch onto ffcs with an invis combo set?
- //Scripts should clear that with EndFFC!
- if ( f->Script !=0 ) continue;
- if ( f->Flags[FFCF_CHANGER] ) continue;
- f->Data = RunFFC.CMB_INVIS;
- f->Script = id;
- if( init_d_ptr > 0 ) //!= NULL would permit assigning negative values here.
- {
- for ( int w = Min(SizeOfArray(init_d_ptr)-1, 7); w >= 0; --w )
- {
- f->InitD[w] = init_d_ptr[w];
- }
- }
- return q; //or do we want to return as ffc?
- }
- return Debug->Null();
- }
- /*
- Runs an ffc script `scriptname` with InitD[] set to `{array}`
- You may set the minimum, and the maximum screen indices that it tries to use, manually.
- Will default to the min and max slot constants in struct RunFFC, if the values set aren't
- in bounds; and it will further accept slot args in reverse-order.
- It will default to the constants in struct RunFFC, if these values are set out of bounds.
- Can be set to quit a running script if the script calls it, but
- cannot find a free ffc on the screen.
- [ example--
- RunFFC("scriptname", {1,2,3,4,5,6,7}, 3, 19, true);
- //Will only check FFC Ids 3 to 19.
- //Will quit the script on failure.
- --end example]
- */
- int RunFFC(int scriptname, float init_d_ptr, int min_index, int max_index, bool quit_on_failure)
- {
- int id = Game->GetFFCScript(scriptname);
- if( id <= 0 ) return 0;
- if ( is > 511 ) return 0;
- if ( min_index > max_index )
- {
- //reversed args sanity check
- int swp = min_index;
- max_index = min_index;
- min_index = swp;
- }
- ffc f = Debug->Null();
- if ( min_index < 1 ) min_index = RunFFC.MIN_INDEX;
- if ( max_index > 32 ) min_index = RunFFC.MAX_INDEX;
- for ( int q = min_index; q <= max_index; ++q )
- {
- f = Screen->LoadFFC(q);
- if ( f->Data !=0 ) continue;
- //Do we really want to latch onto ffcs with an invis combo set?
- //Scripts should clear that with EndFFC!
- if ( f->Script !=0 ) continue;
- if ( f->Flags[FFCF_CHANGER] ) continue;
- f->Data = RunFFC.CMB_INVIS;
- f->Script = id;
- if( init_d_ptr > 0 ) //!= NULL would permit assigning negative values here.
- {
- for ( int w = Min(SizeOfArray(init_d_ptr)-1, 7); w >= 0; --w )
- {
- f->InitD[w] = init_d_ptr[w];
- }
- }
- return q; //or do we want to return as ffc?
- }
- if ( quit_on_failure ) Quit();
- else return Debug->Null();
- }
- /*
- Runs an ffc script `scriptname` with InitD[] set to `{array}`
- You may set the invisible combo manually. Will default to the constant in struct RunFFC.
- You may set the minimum, and the maximum screen indices that it tries to use, manually.
- It will default to the constants in struct RunFFC, if these values are set out of bounds.
- Will default to the min and max slot constants in struct RunFFC, if the values set aren't
- in bounds; and it will further accept slot args in reverse-order.
- RunFFC("scriptname", {1,2,3,4,5,6,7}, CMB_CUSTOM_INVISIBLE, 3, 19);
- //Will use a user-set invisible combo.
- //Will only check FFC Ids 3 to 19.
- //Will quit the script on failure.
- [ example--
- --end example]
- */
- int RunFFC(int scriptname, float init_d_ptr, int cmb, int min_index, int max_index)
- {
- int id = Game->GetFFCScript(scriptname);
- if( id <= 0 ) return 0;
- if ( is > 511 ) return 0;
- if ( min_index > max_index )
- {
- //reversed args sanity check
- int swp = min_index;
- max_index = min_index;
- min_index = swp;
- }
- ffc f = Debug->Null();
- if ( cmb <= 0 ) cmb = RunFFC.CMB_INVIS;
- if ( min_index < 1 ) min_index = RunFFC.MIN_INDEX;
- if ( max_index > 32 ) min_index = RunFFC.MAX_INDEX;
- for ( int q = min_index; q <= max_index; ++q )
- {
- f = Screen->LoadFFC(q);
- if ( f->Data !=0 ) continue;
- //Do we really want to latch onto ffcs with an invis combo set?
- //Scripts should clear that with EndFFC!
- if ( f->Script !=0 ) continue;
- if ( f->Flags[FFCF_CHANGER] ) continue;
- f->Data = cmb;
- f->Script = id;
- if( init_d_ptr > 0 ) //!= NULL would permit assigning negative values here.
- {
- for ( int w = Min(SizeOfArray(init_d_ptr)-1, 7); w >= 0; --w )
- {
- f->InitD[w] = init_d_ptr[w];
- }
- }
- return q; //or do we want to return as ffc?
- }
- return Debug->Null();
- }
- /*
- Runs an ffc script `scriptname` with InitD[] set to `{array}`
- You may set the invisible combo manually. Will default to the constant in struct RunFFC.
- You may set the minimum, and the maximum screen indices that it tries to use, manually.
- It will default to the constants in struct RunFFC, if these values are set out of bounds.
- Will default to the min and max slot constants in struct RunFFC, if the values set aren't
- in bounds; and it will further accept slot args in reverse-order.
- Can be set to quit a running script if the script calls it, but
- cannot find a free ffc on the screen.
- [ example--
- RunFFC("scriptname", {1,2,3,4,5,6,7}, CMB_CUSTOM_INVISIBLE, 3, 19, true);
- //Will only check FFC Ids 3 to 19.
- //Will quit the script on failure.
- --end example]
- */
- int RunFFC(int scriptname, float init_d_ptr, int cmb, int min_index, int max_index, bool quit_on_failure)
- {
- int id = Game->GetFFCScript(scriptname);
- if( id <= 0 ) return 0;
- if ( is > 511 ) return 0;
- if ( min_index > max_index )
- {
- //reversed args sanity check
- int swp = min_index;
- max_index = min_index;
- min_index = swp;
- }
- ffc f = Debug->Null();
- if ( cmb <= 0 ) cmb = RunFFC.CMB_INVIS;
- if ( min_index < 1 ) min_index = RunFFC.MIN_INDEX;
- if ( max_index > 32 ) min_index = RunFFC.MAX_INDEX;
- for ( int q = min_index; q <= max_index; ++q )
- {
- f = Screen->LoadFFC(q);
- if ( f->Data !=0 ) continue;
- //Do we really want to latch onto ffcs with an invis combo set?
- //Scripts should clear that with EndFFC!
- if ( f->Script !=0 ) continue;
- if ( f->Flags[FFCF_CHANGER] ) continue;
- f->Data = cmb;
- f->Script = id;
- if( init_d_ptr > 0 ) //!= NULL would permit assigning negative values here.
- {
- for ( int w = Min(SizeOfArray(init_d_ptr)-1, 7); w >= 0; --w )
- {
- f->InitD[w] = init_d_ptr[w];
- }
- }
- return q; //or do we want to return as ffc?
- }
- if ( quit_on_failure ) Quit();
- else return Debug->Null();
- }////////////////////////////
- /// RunFFC.zh ///
- /// By: ZoriaRPG ///
- /// v0.2.2 ///
- /// 13th September, 2018 ///
- ////////////////////////////
- script typedef ffc struct;
- struct script RunFFC //No need to assign this to a slot.
- {
- void run(){}
- const int MAX_INDEX = 32;
- const int MIN_INDEX = 1;
- const int CMB_INVIS = 100;
- }
- /*
- Runs an ffc script `scriptname` with InitD[] set to `{array}`
- [ example--
- RunFFC("scriptname", {1,2,3,4,5,6,7});
- --end example]
- */
- int RunFFC(int scriptname, float init_d_ptr)
- {
- int id = Game->GetFFCScript(scriptname);
- if( id <= 0 ) return 0;
- if ( is > 511 ) return 0;
- ffc f = Debug->Null();
- for ( int q = RunFFC.MIN_INDEX; q <= RunFFC.MAX_INDEX; --q )
- {
- f = Screen->LoadFFC(q);
- if ( f->Data !=0 ) continue;
- //Do we really want to latch onto ffcs with an invis combo set?
- //Scripts should clear that with EndFFC!
- if ( f->Script !=0 ) continue;
- if ( f->Flags[FFCF_CHANGER] ) continue;
- f->Data = RunFFC.CMB_INVIS;
- f->Script = id;
- if( init_d_ptr > 0 ) //!= NULL would permit assigning negative values here.
- {
- for ( int w = Min(SizeOfArray(init_d_ptr)-1, 7); w >= 0; --w )
- {
- f->InitD[w] = init_d_ptr[w];
- }
- }
- return q; //or do we want to return as ffc?
- }
- return Debug->Null();
- }
- /*
- Runs an ffc script `scriptname` with InitD[] set to `{array}`
- Can be set to quit a running script if the script calls it, but
- cannot find a free ffc on the screen.
- [ example--
- RunFFC("scriptname", {1,2,3,4,5,6,7}, true);
- //Will quit the script on failure.
- --end example]
- */
- int RunFFC(int scriptname, float init_d_ptr, bool quit_on_failure)
- {
- int id = Game->GetFFCScript(scriptname);
- if( id <= 0 ) return 0;
- if ( is > 511 ) return 0;
- ffc f = Debug->Null();
- for ( int q = RunFFC.MIN_INDEX; q <= RunFFC.MAX_INDEX; --q )
- {
- f = Screen->LoadFFC(q);
- if ( f->Data !=0 ) continue;
- //Do we really want to latch onto ffcs with an invis combo set?
- //Scripts should clear that with EndFFC!
- if ( f->Script !=0 ) continue;
- if ( f->Flags[FFCF_CHANGER] ) continue;
- f->Data = RunFFC.CMB_INVIS;
- f->Script = id;
- if( init_d_ptr > 0 ) //!= NULL would permit assigning negative values here.
- {
- for ( int w = Min(SizeOfArray(init_d_ptr)-1, 7); w >= 0; --w )
- {
- f->InitD[w] = init_d_ptr[w];
- }
- }
- return q; //or do we want to return as ffc?
- }
- if ( quit_on_failure ) Quit();
- else return Debug->Null();
- }
- /*
- Runs an ffc script `scriptname` with InitD[] set to `{array}`
- You may set the invisible combo manually. Will default to the constant in struct RunFFC.
- [ example--
- RunFFC("scriptname", {1,2,3,4,5,6,7}, CMB_CUSTOM_INVISIBLE);
- //Will use a user-set invisible combo.
- --end example]
- */
- int RunFFC(int scriptname, float init_d_ptr, int cmb)
- {
- int id = Game->GetFFCScript(scriptname);
- if( id <= 0 ) return 0;
- if ( is > 511 ) return 0;
- ffc f = Debug->Null();
- if ( cmb <= 0 ) cmb = RunFFC.CMB_INVIS;
- for ( int q = RunFFC.MIN_INDEX; q <= RunFFC.MAX_INDEX; --q )
- {
- f = Screen->LoadFFC(q);
- if ( f->Data !=0 ) continue;
- //Do we really want to latch onto ffcs with an invis combo set?
- //Scripts should clear that with EndFFC!
- if ( f->Script !=0 ) continue;
- if ( f->Flags[FFCF_CHANGER] ) continue;
- f->Data = cmb;
- f->Script = id;
- if( init_d_ptr > 0 ) //!= NULL would permit assigning negative values here.
- {
- for ( int w = Min(SizeOfArray(init_d_ptr)-1, 7); w >= 0; --w )
- {
- f->InitD[w] = init_d_ptr[w];
- }
- }
- return q; //or do we want to return as ffc?
- }
- return Debug->Null();
- }
- /*
- Runs an ffc script `scriptname` with InitD[] set to `{array}`
- You may set the invisible combo manually. Will default to the constant in struct RunFFC.
- Can be set to quit a running script if the script calls it, but
- cannot find a free ffc on the screen.
- [ example--
- RunFFC("scriptname", {1,2,3,4,5,6,7}, CMB_CUSTOM_INVISIBLE, true);
- //Will use a user-set invisible combo.
- //Will quit the script on failure.
- --end example]
- */
- int RunFFC(int scriptname, float init_d_ptr, int cmb, bool quit_on_failure)
- {
- int id = Game->GetFFCScript(scriptname);
- if( id <= 0 ) return 0;
- if ( is > 511 ) return 0;
- ffc f = Debug->Null();
- if ( cmb <= 0 ) cmb = RunFFC.CMB_INVIS;
- for ( int q = RunFFC.MIN_INDEX; q <= RunFFC.MAX_INDEX; ++q )
- {
- f = Screen->LoadFFC(q);
- if ( f->Data !=0 ) continue;
- //Do we really want to latch onto ffcs with an invis combo set?
- //Scripts should clear that with EndFFC!
- if ( f->Script !=0 ) continue;
- if ( f->Flags[FFCF_CHANGER] ) continue;
- f->Data = cmb;
- f->Script = id;
- if( init_d_ptr > 0 ) //!= NULL would permit assigning negative values here.
- {
- for ( int w = Min(SizeOfArray(init_d_ptr)-1, 7); w >= 0; --w )
- {
- f->InitD[w] = init_d_ptr[w];
- }
- }
- return q; //or do we want to return as ffc?
- }
- if ( quit_on_failure ) Quit();
- else return Debug->Null();
- }
- /*
- Runs an ffc script `scriptname` with InitD[] set to `{array}`
- You may set the minimum, and the maximum screen indices that it tries to use, manually.
- It will default to the constantas in struct RunFFC, if these values are set out of bounds.
- [ example--
- RunFFC("scriptname", {1,2,3,4,5,6,7}, 3, 19);
- //Will only check FFC Ids 3 to 19.
- --end example]
- */
- int RunFFC(int scriptname, float init_d_ptr, int min_index, int max_index)
- {
- int id = Game->GetFFCScript(scriptname);
- if( id <= 0 ) return 0;
- if ( is > 511 ) return 0;
- ffc f = Debug->Null();
- if ( min_index > max_index )
- {
- //reversed args sanity check
- int swp = min_index;
- max_index = min_index;
- min_index = swp;
- }
- if ( min_index < 1 ) min_index = RunFFC.MIN_INDEX;
- if ( max_index > 32 ) min_index = RunFFC.MAX_INDEX;
- for ( int q = min_index; q <= max_index; ++q )
- {
- f = Screen->LoadFFC(q);
- if ( f->Data !=0 ) continue;
- //Do we really want to latch onto ffcs with an invis combo set?
- //Scripts should clear that with EndFFC!
- if ( f->Script !=0 ) continue;
- if ( f->Flags[FFCF_CHANGER] ) continue;
- f->Data = RunFFC.CMB_INVIS;
- f->Script = id;
- if( init_d_ptr > 0 ) //!= NULL would permit assigning negative values here.
- {
- for ( int w = Min(SizeOfArray(init_d_ptr)-1, 7); w >= 0; --w )
- {
- f->InitD[w] = init_d_ptr[w];
- }
- }
- return q; //or do we want to return as ffc?
- }
- return Debug->Null();
- }
- /*
- Runs an ffc script `scriptname` with InitD[] set to `{array}`
- You may set the minimum, and the maximum screen indices that it tries to use, manually.
- Will default to the min and max slot constants in struct RunFFC, if the values set aren't
- in bounds; and it will further accept slot args in reverse-order.
- It will default to the constants in struct RunFFC, if these values are set out of bounds.
- Can be set to quit a running script if the script calls it, but
- cannot find a free ffc on the screen.
- [ example--
- RunFFC("scriptname", {1,2,3,4,5,6,7}, 3, 19, true);
- //Will only check FFC Ids 3 to 19.
- //Will quit the script on failure.
- --end example]
- */
- int RunFFC(int scriptname, float init_d_ptr, int min_index, int max_index, bool quit_on_failure)
- {
- int id = Game->GetFFCScript(scriptname);
- if( id <= 0 ) return 0;
- if ( is > 511 ) return 0;
- if ( min_index > max_index )
- {
- //reversed args sanity check
- int swp = min_index;
- max_index = min_index;
- min_index = swp;
- }
- ffc f = Debug->Null();
- if ( min_index < 1 ) min_index = RunFFC.MIN_INDEX;
- if ( max_index > 32 ) min_index = RunFFC.MAX_INDEX;
- for ( int q = min_index; q <= max_index; ++q )
- {
- f = Screen->LoadFFC(q);
- if ( f->Data !=0 ) continue;
- //Do we really want to latch onto ffcs with an invis combo set?
- //Scripts should clear that with EndFFC!
- if ( f->Script !=0 ) continue;
- if ( f->Flags[FFCF_CHANGER] ) continue;
- f->Data = RunFFC.CMB_INVIS;
- f->Script = id;
- if( init_d_ptr > 0 ) //!= NULL would permit assigning negative values here.
- {
- for ( int w = Min(SizeOfArray(init_d_ptr)-1, 7); w >= 0; --w )
- {
- f->InitD[w] = init_d_ptr[w];
- }
- }
- return q; //or do we want to return as ffc?
- }
- if ( quit_on_failure ) Quit();
- else return Debug->Null();
- }
- /*
- Runs an ffc script `scriptname` with InitD[] set to `{array}`
- You may set the invisible combo manually. Will default to the constant in struct RunFFC.
- You may set the minimum, and the maximum screen indices that it tries to use, manually.
- It will default to the constants in struct RunFFC, if these values are set out of bounds.
- Will default to the min and max slot constants in struct RunFFC, if the values set aren't
- in bounds; and it will further accept slot args in reverse-order.
- RunFFC("scriptname", {1,2,3,4,5,6,7}, CMB_CUSTOM_INVISIBLE, 3, 19);
- //Will use a user-set invisible combo.
- //Will only check FFC Ids 3 to 19.
- //Will quit the script on failure.
- [ example--
- --end example]
- */
- int RunFFC(int scriptname, float init_d_ptr, int cmb, int min_index, int max_index)
- {
- int id = Game->GetFFCScript(scriptname);
- if( id <= 0 ) return 0;
- if ( is > 511 ) return 0;
- if ( min_index > max_index )
- {
- //reversed args sanity check
- int swp = min_index;
- max_index = min_index;
- min_index = swp;
- }
- ffc f = Debug->Null();
- if ( cmb <= 0 ) cmb = RunFFC.CMB_INVIS;
- if ( min_index < 1 ) min_index = RunFFC.MIN_INDEX;
- if ( max_index > 32 ) min_index = RunFFC.MAX_INDEX;
- for ( int q = min_index; q <= max_index; ++q )
- {
- f = Screen->LoadFFC(q);
- if ( f->Data !=0 ) continue;
- //Do we really want to latch onto ffcs with an invis combo set?
- //Scripts should clear that with EndFFC!
- if ( f->Script !=0 ) continue;
- if ( f->Flags[FFCF_CHANGER] ) continue;
- f->Data = cmb;
- f->Script = id;
- if( init_d_ptr > 0 ) //!= NULL would permit assigning negative values here.
- {
- for ( int w = Min(SizeOfArray(init_d_ptr)-1, 7); w >= 0; --w )
- {
- f->InitD[w] = init_d_ptr[w];
- }
- }
- return q; //or do we want to return as ffc?
- }
- return Debug->Null();
- }
- /*
- Runs an ffc script `scriptname` with InitD[] set to `{array}`
- You may set the invisible combo manually. Will default to the constant in struct RunFFC.
- You may set the minimum, and the maximum screen indices that it tries to use, manually.
- It will default to the constants in struct RunFFC, if these values are set out of bounds.
- Will default to the min and max slot constants in struct RunFFC, if the values set aren't
- in bounds; and it will further accept slot args in reverse-order.
- Can be set to quit a running script if the script calls it, but
- cannot find a free ffc on the screen.
- [ example--
- RunFFC("scriptname", {1,2,3,4,5,6,7}, CMB_CUSTOM_INVISIBLE, 3, 19, true);
- //Will only check FFC Ids 3 to 19.
- //Will quit the script on failure.
- --end example]
- */
- int RunFFC(int scriptname, float init_d_ptr, int cmb, int min_index, int max_index, bool quit_on_failure)
- {
- int id = Game->GetFFCScript(scriptname);
- if( id <= 0 ) return 0;
- if ( is > 511 ) return 0;
- if ( min_index > max_index )
- {
- //reversed args sanity check
- int swp = min_index;
- max_index = min_index;
- min_index = swp;
- }
- ffc f = Debug->Null();
- if ( cmb <= 0 ) cmb = RunFFC.CMB_INVIS;
- if ( min_index < 1 ) min_index = RunFFC.MIN_INDEX;
- if ( max_index > 32 ) min_index = RunFFC.MAX_INDEX;
- for ( int q = min_index; q <= max_index; ++q )
- {
- f = Screen->LoadFFC(q);
- if ( f->Data !=0 ) continue;
- //Do we really want to latch onto ffcs with an invis combo set?
- //Scripts should clear that with EndFFC!
- if ( f->Script !=0 ) continue;
- if ( f->Flags[FFCF_CHANGER] ) continue;
- f->Data = cmb;
- f->Script = id;
- if( init_d_ptr > 0 ) //!= NULL would permit assigning negative values here.
- {
- for ( int w = Min(SizeOfArray(init_d_ptr)-1, 7); w >= 0; --w )
- {
- f->InitD[w] = init_d_ptr[w];
- }
- }
- return q; //or do we want to return as ffc?
- }
- if ( quit_on_failure ) Quit();
- else return Debug->Null();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement