Jump to content

Photo

My ffc script IfBombIsBButtonWeapon will not compile. Errors.


  • Please log in to reply
5 replies to this topic

#1 LikeLike888

LikeLike888

    Spicy food lover!!

  • Members
  • Real Name:Jason
  • Location:North America

Posted 05 June 2018 - 02:58 PM

Place

A ZScript Test Quest.qst

is:

C:\Users\sprit\Desktop\Jason's Things\Zelda Classic 2.5 Stuff\Zelda Classic\ZSCript Test\demo

 

 

 

std.zh

and also

std_constants.zh

and also

std_functions.zh

are all in

C:\Users\sprit\Desktop\Jason's Things\Zelda Classic 2.5 Stuff\Zelda Classic\ZSCript Test\demo

 

 

 

Here is my exact script (I know I can do item script but I intentionally want global script so I know how better to code things in global script when I need to) :

import "std.zh"
const inst BombX = 0; //BombX will be at X position of wherever Link places a Bomb
const inst BombY = 0; //BombY will be at Y position of wherever Link places a Bomb
global script IfBombIsBWeaponItem
{
  void run()
  {
    if ( Link->Equipment = Bomb )
    {
      if ( Link->PressB )
      {
        Game->Counter[CR_LIFE] = Game->DCounter[CR_LIFE]-1;
      }
    }
  }
}

 

 

 

 

Here is the errors I am getting:

PASS 1: PARSING
LINE 2: SYNTAX ERROR, UNEXPECTED IDENTIFIER, EXPECTING FLOAT, ON TOKEN INST
FATAL ERROR POO: CAN'T OPEN OR PARSE FILE!
 
-- PRESS A KEY --

 

 

 

Please help me fix my global script so that it will compile as a working global script, thank you so very much.



#2 Deedee

Deedee

    Bug Frog Dragon Girl

  • Moderators
  • Real Name:Deedee
  • Pronouns:She / Her, They / Them
  • Location:Canada

Posted 05 June 2018 - 03:46 PM

It's "int", not "inst".

Also, Link->Equipment doesn't exist. Look in std.txt for what you're looking for. 

Also, you don't have a while loop, so the global will quit as soon as the first frame ends. Have a while(true) loop after void run() and have a Waitframe(); inside it.

Also, "Bomb" isn't a valid item. Use the item ID number (in the item list).

Also, not sure what's with the constants at the top. They seem useless. If you want something you can edit inside the script, remove the "const". 


Edited by Dimentio, 05 June 2018 - 03:48 PM.

  • ShadowTiger likes this

#3 LikeLike888

LikeLike888

    Spicy food lover!!

  • Members
  • Real Name:Jason
  • Location:North America

Posted 05 June 2018 - 03:57 PM

Thank you for helping me out.

#4 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 06 June 2018 - 12:54 AM

Thank you for helping me out.

 

 

 

It's "int", not "inst".

Also, Link->Equipment doesn't exist. Look in std.txt for what you're looking for. 

Also, you don't have a while loop, so the global will quit as soon as the first frame ends. Have a while(true) loop after void run() and have a Waitframe(); inside it.

Also, "Bomb" isn't a valid item. Use the item ID number (in the item list).

Also, not sure what's with the constants at the top. They seem useless. If you want something you can edit inside the script, remove the "const". 

(Emphasis, mine).

 

Wot? What drugs are you using?!

 

Link->Equipment exists. Absolutely. It's been there since early 2.50 beta!

 

The A and B items are bit-shifted and OR'd (The first 8 bits contain the A button item, and the second 8 bits contain the B button item.), so, it was made in a terrible manner, but it's there. 

 

In theory, if 'Bomb' is declared with the appropriate value, then you could do a quick bitwise Link->Equipment&Bomb.

 

(The rest of your response is correct.)



#5 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 06 June 2018 - 01:18 AM

[…]
 
Please help me fix my global script so that it will compile as a working global script, thank you so very much.

 
 
import "std.zh"

//Not sure what these are going to do (intent?)...  -Z
const int BombX = 0; //BombX will be at X position of wherever Link places a Bomb
const int BombY = 0; //BombY will be at Y position of wherever Link places a Bomb

int gram[256]; //You want a global array. 
const int QUIT = 0; //array index
//Accessors. 
void QUIT(int n) { gram[QUIT] = n; } //Sets the QUIT state. Call as QUIT(n), where 'n' is the numerical state. 
int QUIT() { return gram[QUIT]; } //Accessor that returns the QUIT state as a function. 

global script active  //There is only one active script, so, naming it as a function isn't wise. 
{
	void run()
	{
		QUIT(0); //Clear the quit state on game init. 
		while( !QUIT() ) //main loop. I like to have the option to break this externally. 
		{
			B_Button_Routines(); //Anything in this nest will run based on inputs of the B button.
			A_Button_Routines(); //this one is for the A button, if you ever needed it. 
			Waitdraw(); //Everything before this happens prior to drawing the screen.
			//Drawing happened. Now additional instructions follow drawing.
			Waitframe(); //Tell the game to advance one frame before repeating the loop.
		} //loop restarts here. 
		//If we reach here, then QUIT() is not 0. 
	}
}


//You like to have lots of these things that happen on presses of A or B. 
//I'm making a nest function for the B button stuff. 
void B_Button_Routines()
{
	if ( Link->PressB )
	{
		IfBombIsBWeaponItem();
	}
	if ( Link->InputB ) 
	{
		//INSERT AS NEEDED
	}
	
}

//and an A-button nest

void A_Button_Routines()
{
	if ( Link->PressA )
	{
		//INSERT AS NEEDED
	}
	if ( Link->InputA ) 
	{
		//INSERT AS NEEDED
	}
	
}

//Turning your original script name into a function. 
//Now it is called from inside the nest of B_Button_Routines(), if Link->PressB. 
void IfBombIsBWeaponItem()
{
	if ( GetEquipmentB() == I_BOMB ) //Check for the Item
	{
		Game->Counter[CR_LIFE] = Game->DCounter[CR_LIFE]-1; //Do whatever you want to do, here. 
			//I see that this is reversed from what you had elsewhere.  I do not know if that is intentional. -Z
			//This will still only happen once per press of the B button. 
			//Holding the B button will not make this run for multiple frames. 
			//For that, you want to call it under the 'if ( Link->InputB )' statement of B_Button_Routines(). 
	}
}

  • LikeLike888 likes this

#6 LikeLike888

LikeLike888

    Spicy food lover!!

  • Members
  • Real Name:Jason
  • Location:North America

Posted 07 June 2018 - 03:15 AM

Thank you ZoriaRPG


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users