Jump to content

Photo

Screen Flag Script Request


  • Please log in to reply
12 replies to this topic

#1 Cukeman

Cukeman

    "Tra la la, look for Sahasrahla. ... ... ..."

  • Banned
  • Location:Hyrule/USA

Posted 12 August 2016 - 01:54 PM

I would like to request  a script that I can assign to the Screen Flag "General Use 1 (Scripts)"

 

If Link has Item 51 (Flippers), any onscreen Combo with Flag 99 is advanced to the next Combo in the Combo list.

 

Thank you for your help.



#2 Lejes

Lejes

    Seeker of Runes

  • Members
  • Location:Flying High Above Monsteropolis

Posted 12 August 2016 - 02:02 PM

ffc script FlipperAdvance
{
	void run()
	{
		if ((Screen->Flags[SF_MISC] & 100b) != 0 && Link->Item[51])
		{
			for (int i = 0; i < 176; i++)
			{
				if (ComboFI(i, CF_SCRIPT2))
				{
					Screen->ComboD[i]++;
				}
			}
		}
	}
}
Best to check the Run Script at Screen Init flag so the combo change won't be seen by the player.

Edited by Lejes, 12 August 2016 - 02:58 PM.


#3 cavthena

cavthena

    Apprentice

  • Members
  • Real Name:Clayton
  • Location:I wish I knew

Posted 12 August 2016 - 02:03 PM

Simple enough. Do you want it to play a sound on the change and do you need it to effect layers other than layer 0?

Global or FFC?

Edit: ninja'd

Edited by cavthena, 12 August 2016 - 02:03 PM.


#4 Cukeman

Cukeman

    "Tra la la, look for Sahasrahla. ... ... ..."

  • Banned
  • Location:Hyrule/USA

Posted 12 August 2016 - 02:39 PM

ffc script FlipperAdvance
{
	void run()
	{
		if ((Screen->Flags[SF_MISC] & 100b) != 0 && Link->Item[51])
		{
			for (int i = 0; i < 176; i++)
			{
				if (ComboFI(i, CF_SCRIPT2))
				{
					ComboD[i]++;
				}
			}
		}
	}
}
Best to check the Run Script at Screen Init flag so the combo change won't be seen by the player.

 

 

compiling error (variable comboD is undeclared)



#5 Lejes

Lejes

    Seeker of Runes

  • Members
  • Location:Flying High Above Monsteropolis

Posted 12 August 2016 - 02:58 PM

See my edit above.

#6 Cukeman

Cukeman

    "Tra la la, look for Sahasrahla. ... ... ..."

  • Banned
  • Location:Hyrule/USA

Posted 12 August 2016 - 03:06 PM

It compiles, but I'm not understanding the implementation.

 

I thought that by checking the screen flag, the script would run. That's not how the screen flag works?



#7 idontknow8

idontknow8

    Senior

  • Members

Posted 12 August 2016 - 03:10 PM

You also have to create a new FFC (Freeform combo) and attach this script to it (after compiling the script and assigning it a FFC script slot of course)



#8 Lejes

Lejes

    Seeker of Runes

  • Members
  • Location:Flying High Above Monsteropolis

Posted 12 August 2016 - 03:13 PM

It has to be placed on screen. Script screen flags have absolutely no power to do anything on their own, they exist only to be checked by scripts. This could be made into a global script variant if you don't want to place this on every screen.

#9 Cukeman

Cukeman

    "Tra la la, look for Sahasrahla. ... ... ..."

  • Banned
  • Location:Hyrule/USA

Posted 12 August 2016 - 03:16 PM

I would like to request a global then, sorry.

 

Now I'm curious what good screen flags are.



#10 Lejes

Lejes

    Seeker of Runes

  • Members
  • Location:Flying High Above Monsteropolis

Posted 12 August 2016 - 03:33 PM

int FlipperAdvance(int prevScreen)
{
	if ((Screen->Flags[SF_MISC] & 100b) != 0 && Link->Item[51] && Game->GetCurScreen() != prevScreen)
	{
		{
			for (int i = 0; i < 176; i++)
			{
				if (ComboFI(i, CF_SCRIPT2))
				{
					Screen->ComboD[i]++;
				}
			}
		}
	}
	prevScreen = Game->GetCurScreen();
	return prevScreen;
}

global script ActiveFlippers
{
	void run()
	{
		int prevScreen = Game->GetCurScreen();
		
		while (true)
		{
			Waitdraw();
			prevScreen = FlipperAdvance(prevScreen);
			Waitframe();
		}
	}
}
This only works on layer 0. That can be changed, though. Screen flags are useful any time you need a script to check a per-room flag. If you wanted to use flag 99 for other purposes on other screens, for example.

Edited by Lejes, 12 August 2016 - 03:51 PM.


#11 Cukeman

Cukeman

    "Tra la la, look for Sahasrahla. ... ... ..."

  • Banned
  • Location:Hyrule/USA

Posted 12 August 2016 - 03:47 PM

line: "prevScreen = Game->GetCurScreen();"

(not the global part)

 

unexpected identifier, expeting $end, on token prevscreen


Edited by Cukeman, 12 August 2016 - 03:47 PM.


#12 Lejes

Lejes

    Seeker of Runes

  • Members
  • Location:Flying High Above Monsteropolis

Posted 12 August 2016 - 03:51 PM

It should compile now, though it's untested.
  • Cukeman likes this

#13 Cukeman

Cukeman

    "Tra la la, look for Sahasrahla. ... ... ..."

  • Banned
  • Location:Hyrule/USA

Posted 12 August 2016 - 04:21 PM

Works better than I imagined! Thank you! :D




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users