PDA

View Full Version : quick question



Master Maniac
03-23-2008, 05:14 PM
how would i say


if(x number of combos are a certain combo)

?

i checked the std.zh to see what was going on there... but i just cant figure out how to mess with combos in scripts.

Gleeok
03-23-2008, 06:05 PM
Start with checking one combo then just add on to that. I believe you want to use ComboAt(). but you should be more specific.

Use it like this:

if(Screen->ComboT[ComboAt(x, y)] == ???){ // stuff

Master Maniac
03-23-2008, 06:48 PM
ok thank you =)

and btw, im simplifying that floor puzzle script. it doesent have to be that complex really lol.

Master Maniac
03-23-2008, 08:39 PM
sorry for the double post... the edit button absolutely refuses to work for me.

anyway i got one more question.

does Screen-> ComboF[] trigger a flag? or just say its there?

Joe123
03-23-2008, 08:47 PM
You can check whether a combo has that flag, or give that flag to a combo.
Not tigger though.

Triggering flags isn't too straightforward.

Master Maniac
03-23-2008, 08:49 PM
damn... ok can you tell me what i have to do to make it trigger a flag? thats the main part of the script lol

Joe123
03-23-2008, 08:55 PM
You have to put a Trigger (Sens. Perm) combo underneath Link's feet.


this->Data = whateverthatcomboIDnumberis;
this->X = Link->X; this->Y = Link->Y;
Waitframes(3);
this->Data = 0;

//or

int combo = Screen->ComboT[ComboAt(Link->X,Link->Y)];
Screen->ComboT[ComboAt(Link->X,Link->Y)] = thatcomboIDnumber;
Waitframes(3);
Screen->ComboT[ComboAt(Link->X,Link->Y)] = combo;

Master Maniac
03-23-2008, 09:09 PM
wow...

ok the places where you said thatcomboIDnumber, its the ID of the trigger (sens. perm)?

Joe123
03-23-2008, 09:11 PM
yes

The_Amaster
03-23-2008, 09:12 PM
Yeah.

But that triggers all the flags on the screen. Not sure if that's what you want.

Gleeok
03-23-2008, 09:13 PM
Probably intended to be a translucent tile......does it even work like that? An ffc with a trigger type that is..

The_Amaster
03-23-2008, 09:15 PM
Maybe a floor tile? I forget, can you set FFCs under Link?

Master Maniac
03-23-2008, 09:32 PM
what i was gonna do was make it trigger just one flag. flag 16.

but this isnt turning out as easy as i hoped it would...

there should be a trigger function for things like this...

The_Amaster
03-23-2008, 09:36 PM
Maybe if you describe the effect you're trying to create.

Master Maniac
03-23-2008, 09:47 PM
well... im trying to make a simpler version of the floor puzzle script.

here it is:
ffc script floor_puzzle{

void run(int n, int x, int y){

if(Screen->ComboT[ComboAt(x,y)] == n){

int combo = Screen->ComboT[ComboAt(Link->X,Link->Y)];
Screen->ComboT[ComboAt(Link->X,Link->Y)] = 658;
Waitframes(3);
Screen->ComboT[ComboAt(Link->X,Link->Y)] = combo;

}
Waitframe()
}

it compiles just fine. but when i try to test it, nothing happens.

it was supposed to be if (n) combo ID's matches this tile then trigger the flag.

The_Amaster
03-23-2008, 09:49 PM
Sorry, yeah, but what does it do. What kind of floor puzzle? Is it just a "push a block onto a marker" or something?

Master Maniac
03-23-2008, 09:51 PM
umm the one thats hard to describe lol.

that puzzle where you have to turn the floor tiles colors when you step on them and make them all the same to proceed?

The_Amaster
03-23-2008, 09:55 PM
Ohhhhhh.
*rereads script*
Now it makes sense.
Well, forget placing SensPerm triggers, just use Joe's script to place the new color. Then like Gleeok said check each combo for the type, and if it's the correct number activate.

Master Maniac
03-23-2008, 10:13 PM
so... what i have now will do essentially nothing?

because ive tried testing what i have and it doesent do anything and plus, the tiles keep changing while link is standing on them. i only want them to change once, when link steps on them, and only change again if link steps on them again.

i think i might have to abort this mission and use the one thats already made lol i dont think there is a simple way to do this.

and by the way i made a little something gleeok might enjoy.


ffc script death{
void run(m){
if(Link-> Item[m]){
link->HP=0;
}
Waitframe()
}
}

it brought me endless happiness lol D:0 is the item ID i believe. it was supposed to end my script test quest but thats not happening any time soon.

Joe123
03-24-2008, 05:50 AM
Well, forget placing SensPerm triggers, just use Joe's script to place the new color. Then like Gleeok said check each combo for the type, and if it's the correct number activate.
I wrote a script to place colours?

This was where?



Maybe a floor tile? I forget, can you set FFCs under Link?


this->Data = whateverthatcomboIDnumberis;
this->X = Link->X; this->Y = Link->Y;
Waitframes(3);
this->Data = 0;
See the second line?
Yah, that's what it does.



it compiles just fine. but when i try to test it, nothing happens.
That's because there's no while loops, so it just runs once and then stops.

It's also wrong, but it's better than that eyeball thing you were writing a few weeks ago at least.


What you want is something a little more like this:

ffc script floor_puzzle{
void run(int combotype, int n){
int i; int combocount;
int orig;
while(true){
combocount = 0;
for(i=0; i<176; i++){
if(Screen->ComboD[i] == combotype) combocount++;
}
if(combocount >= n){
orig = Screen->ComboT[ComboAt(Link->X,Link->Y)];
Screen->ComboT[ComboAt(Link->X,Link->Y)] = CT_STRIGFLAG;
Waitframes(3);
Screen->ComboT[ComboAt(Link->X,Link->Y)] = orig;
}
Waitframe();
}
}
}

I'll run you through it:

open script{
void run(declare integer combotype, declare integer n){
declare integer i; //for use in the for loop
declare integer combocount; //this counts how many of combo 'combotype' you have on the screen
declare integer orig; //same function as the 'combo' integer in the last script
start the while loop{ //so the script will run every frame
set the combocounter to 0; //so that the number of that combotype counted last frame doesn't carry over
start a for loop, that will check every combo on the screen{
if(the combo ID number at [i] (which is what the for loop increments, so we'll check every single combo this way) is equal to the combotype you want it to be) increment the combocounter; //which counts how many of that combo are on the screen
end for}
if(the combocount for this frame is equal to the number of that type of combo you want on the screen (integer n, D1){
run the trigger script;
end if}
Waitframe(); // so the while loop doesn't crash the system
end while}
end void run}
end script}


So how to use it:
Make all of your little panel things 'Step->Next' combos. When they turn to the next combo, they will cycle back to the first one after a certain number of frames.
Set 'D0' of the script to be the Combo ID number of the combo after your 'Step->Next' combo (so what they change into)
Set 'D1' to the number of those combos on your screen
Put Flag 16 across all of your panels, and set flag 16 in the secret combo editor to be what they change into (this is so that they all stay changed after you've stepped on them all)
Then you can use flags 17-32 to make something happen after all of them change.


Bear in mind, however, that this is now a different puzzle to the oracles puzzle.
This puzzle is 'make all of the floor tiles the same before they can cycle back', rather than 'step on all the floor tiles in a row'.

The_Amaster
03-24-2008, 09:53 AM
I wrote a script to place colours?

This was where?
Ii meant your first one you showed. Instead of placing a SensPem just place a different colored floor tile under Link's feet.

And that looks real neat. I just may have to steal it.

Joe123
03-24-2008, 10:17 AM
That script I wrote doesn't change the actual combo, it just changes it's attribute.

Go ahead, I don't like to keep anything I make private really.

The_Amaster
03-24-2008, 10:54 AM
Oh, whoop, missed the "Data"
Ah well, doesn't matter now.