Jump to content

Photo

Newbie Item script giving me errors


  • Please log in to reply
10 replies to this topic

#1 Peteo

Peteo

    Back in Business!

  • Members
  • Real Name:Pete
  • Location:Finland

Posted 10 January 2020 - 10:07 AM

Sorry to bother you guys again. Tried to test Moosh's Newbie Item script https://www.purezc.n...=scripts&id=310, but when compiling, I get a following error:

 

PASS 4:

LINE 395: ERROR T21: COULD NOT MATCH TYPE SIGNATURE DRAWFILE(FLOAT, FLOAT, FLOAT, FLOAT, FLOAT, FLOAT, BOOL, FLOAT)

LINE 900: ERROR T21: COULD NOT MATCH TYPE SIGNATURE DRAWFILE(FLOAT, FLOAT, FLOAT, FLOAT, FLOAT, FLOAT, BOOL, FLOAT)

 

Here are the parts of the code that it claims to be troublesome:

			while(MooshItem_InputButtonItem(ID)){
				i = (i+1)%360;
				if(i%3==0){
					Link->InputUp = false;
					Link->InputDown = false;
					Link->InputLeft = false;
					Link->InputRight = false;
				}
				if(!MooshItem_CanTakeResource(ID, mpCost))
					chargeCounter = 0;
				if(chargeCounter<arg1){
					chargeCounter++;
					if(chargeCounter==arg1)
						Game->PlaySound(SFX_MOOSHITEM_CHARGE);
				}
				else{
					DrawTile(3, Link->X+Link->DrawXOffset, Link->Y+Link->DrawYOffset-Link->Z, Link->Tile, 1, 1, 9-((Floor(i/2)%32)>>1), -1, -1, 0, 0, 0, Link->Flip, true, 128); //Line 395
				}
				Waitframe();
			}
				else if(lFlags[i]&MIF_360WAY){ //360 degree animations
					lgroup[i]->DrawYOffset = -1000;
					if(lType[i]!=3)
						lgroup[i]->Dir = AngleDir4(WrapDegrees(lAng[i]));
						
					if(Link->HP>0){
						if(lFlags[i]&MIF_2X2)
							DrawTile(2, x, y-2-lgroup[i]->Z, tile, 2, 2, lgroup[i]->CSet, -1, -1, x, y-2-lgroup[i]->Z, lAng[i], 0, true, 128); //Line 900
						else
							DrawTile(2, x, y-2-lgroup[i]->Z, tile, 1, 1, lgroup[i]->CSet, -1, -1, x, y-2-lgroup[i]->Z, lAng[i], 0, true, 128);
					}
				}


#2 Lüt

Lüt

    Germanize

  • Members
  • Real Name:Steve
  • Location:Chicago

Posted 10 January 2020 - 11:05 AM

You're probably missing DrawLayerFix.

 

Download that and add the line import "drawlayerfix.zh" to your script file.



#3 Peteo

Peteo

    Back in Business!

  • Members
  • Real Name:Pete
  • Location:Finland

Posted 10 January 2020 - 12:10 PM

You're probably missing DrawLayerFix.

 

Download that and add the line import "drawlayerfix.zh" to your script file.

 

Sure, I didn't download that file because the instructions said "Note if you're using 2.53, you can leave out DrawLayerFix."

 

But if that's the problem then I shall download it and see if that makes it work. By the way, does it really matter where I download all these extra script files (in which folder to put them is what I mean)? And if I someday release my quest with this script, I should have this file included with the quest zip file, right? Or do i only need these script files when compiling scripts in ZQuest and after they've been assigned into slots, I don't need to worry about any script files anymore.   :confused: Yeah, I'm a dummy.


Edited by Peteo, 10 January 2020 - 12:18 PM.


#4 Saffith

Saffith

    IPv7 user

  • ZC Developers

Posted 10 January 2020 - 12:42 PM

It generally doesn't matter where you put script files, but if you put a file in a subdirectory, you'll need to specify that in the import statement, e.g. import "headers/drawlayerfix.zh". Some larger libraries are distributed in multiple files, with the main file having its own import statements to include the others. In those cases, you either need to put the additional files where the main file expects them to be or adjust the imports in the main file.

Compiled scripts are saved in the quest file; you don't need to distribute any scripts with the quest.


  • Peteo likes this

#5 Russ

Russ

    Caelan, the Encouraging

  • Administrators
  • Location:Washington

Posted 10 January 2020 - 01:31 PM

And if I someday release my quest with this script, I should have this file included with the quest zip file, right? Or do i only need these script files when compiling scripts in ZQuest and after they've been assigned into slots, I don't need to worry about any script files anymore.

 
 

Compiled scripts are saved in the quest file; you don't need to distribute any scripts with the quest.

So while this is the case, I would recommend including the script with the quest download. Because script files aren't stored in the quest file itself (unless you have the entire file in the buffer), a harddrive crash can destroy the script file and, with it, any chance of updating the quest or fixing bugs in the future. I've seen it happen enough that I'd say it's good practice to just include the script with the quest, just in case.

#6 Peteo

Peteo

    Back in Business!

  • Members
  • Real Name:Pete
  • Location:Finland

Posted 10 January 2020 - 01:58 PM

Thank you, gentlemen. When I returned from my long hiatus, I was worried if I'll ever be able to work on Zelda Classic quests again as I'm not much of a scripter. But you guys make me feel much better about my decision to return to quest making. I will probably have many more stupid questions for you in the near future but if you'll bear with me, hopefully I can reward you all with the next big quest that has hit ZC.

 

And I got the Newbie Item script working perfectly. Moosh should probably change the script description though, you do need drawlayerfix even when using ZC 2.53...


Edited by Peteo, 10 January 2020 - 01:58 PM.

  • Deedee likes this

#7 Lüt

Lüt

    Germanize

  • Members
  • Real Name:Steve
  • Location:Chicago

Posted 10 January 2020 - 01:59 PM

Sure, I didn't download that file because the instructions said "Note if you're using 2.53, you can leave out DrawLayerFix."

But if that's the problem then I shall download it and see if that makes it work.

Yeah, that's interesting.

Well, all I can say is, using 2.53.0 R2, I tried removing the import "drawlayerfix.zh" line from my own script file, and it generated the errors you reported. Then when I added it back in, the errors went away and it compiled.

It's possible the instructions were referring to the later 2.53.1 betas (somewhat different script handling than 2.53.0 releases), or possibly 2.55, or that Moosh just has a more inclusive import configuration in whatever 2.53.0 setup he tested this with. I really don't know, you'd have to ask him.

But, see if that works for you.

And if I someday release my quest with this script, I should have this file included with the quest zip file, right?

Not required for release. All you need for a functional quest is the .qst file. And any audio files if you're using enhanced music rather than imported MIDIs (though you can still play the quest, it'll just have no music).

But as Russ says, including them is useful for archival purposes, seeing how a surprising number of people have lost their script files and been unable to patch their quests as a result.



#8 Emily

Emily

    Scripter / Dev

  • ZC Developers

Posted 11 January 2020 - 01:11 AM

It generally doesn't matter where you put script files, but if you put a file in a subdirectory, you'll need to specify that in the import statement, e.g. import "headers/drawlayerfix.zh". Some larger libraries are distributed in multiple files, with the main file having its own import statements to include the others. In those cases, you either need to put the additional files where the main file expects them to be or adjust the imports in the main file.

Compiled scripts are saved in the quest file; you don't need to distribute any scripts with the quest.

This is GENERALLY true, but in 2.53.1 and 2.55, some folders are automatically checked, so you don't need to specify that in the import statement. I believe `include/`, `scripts/` and `headers/` are checked by default. In 2.53, that's all you get, but in 2.55 you can change what folders it checks by default.

 

I would recommend including scripts with the quest, or if you are willing to learn, use GitHub to store your code. Using github, you can save your code at various points, and you can rewind to any point you ever saved it at. It also allows easily sharing the code with others, and you could just include a link to the github repository with the quest to point to the code.


  • Peteo likes this

#9 Peteo

Peteo

    Back in Business!

  • Members
  • Real Name:Pete
  • Location:Finland

Posted 11 January 2020 - 04:52 AM

GitHub seems great, just registered there. Good to have the code stored in multiple locations as the quest will be having a ton of code. Also, much easier for me to just post a link here if I ever need any of you experts to check out my code. :)



#10 Emily

Emily

    Scripter / Dev

  • ZC Developers

Posted 11 January 2020 - 04:54 AM

GitHub seems great, just registered there. Good to have the code stored in multiple locations as the quest will be having a ton of code. Also, much easier for me to just post a link here if I ever need any of you experts to check out my code. :)

Aye. The best way to use it is to use Git Bash, as you can use the client to easily push commits to a repository. That download comes with a GUI in addition to the command line, for those who aren't command-line savvy.



#11 P-Tux7

P-Tux7

    💛

  • Members

Posted 11 January 2020 - 06:39 AM

So while this is the case, I would recommend including the script with the quest download. Because script files aren't stored in the quest file itself (unless you have the entire file in the buffer), a harddrive crash can destroy the script file and, with it, any chance of updating the quest or fixing bugs in the future. I've seen it happen enough that I'd say it's good practice to just include the script with the quest, just in case.


Can't you use Google Drive or something to back up a folder every time a file in it is changed? It's good for .qst as well but if you only back up your uncompressed scripts the file size should be almost neglegible.


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users