PDA

View Full Version : Having issues with scripts...



Master Maniac
01-28-2008, 02:53 PM
ok ive decided to stay away from writing my own scripts and trying to use some that other people have written. the only problem is after i copy them to notepad and paste them and try to import them i get an error message. im using build 635 i think.

can someone help please and thank you?

Joe123
01-28-2008, 03:22 PM
Having issues with scripts...
Then post in the scripting forums.

I think it's unlikely that the error message is to do with what build you're using, it's most likely the script.

Post it up, and I'll have a look.

EDIT: Make sure that your script file has the '.z' file extension, and that the first line says:

import "std.zh"

Master Maniac
01-28-2008, 03:28 PM
import "std.zh"

item script wshieldmsg
{
void run()
{
Screen->Message(13);
}
}



CODE
// Deep Water- When Link steps on a certain combo without a certain item in his inventory, the combo turns into a Damage Combo. If he does, it becomes normal
// water. Simple. as. that. 4 combos for Water, 4 combos for Dive Warp. No Swim Warp, though. Unless you feel like making more variables. Set this script to
// each screen with the desired combo(s). Best not to use it anywhere else. Why? Well, it wouldn't really make sense. A waste of FFCs.
// Constants/Variables:
// water1-water4- D0 through D3. Control what combos turn into water.
// dive1-dive4- D4 through D7. Will be used for Dive Warp instead of Water.
// level2flippers- What item ID will be used for the Level 2 Flippers. And please, remember to set the item in the Flippers Itemclass. It makes it better.
// damage- How much HP to take off Link if he touches the Deep Water without L-2 Flippers. Default is 8, 1/2 Heart.
// warp1-warp4- Which Dive Warp combo the 4 "dive" variables will turn into. They don't even need to be Dive Warp combos. In case you want more than one Dive
// Warp per screen, or if you've used some other warps. Hey, better safe than sorry. I need to make sure of your ideas! :(

import "std.zh"

const int level2flippers = 248;
const int damage = 8;
const int warp1 = 19;
const int warp2 = 19;
const int warp3 = 19;
const int warp4 = 19;

ffc script deepwater
{
void run(int water1, int water2, int water3, int water4, int dive1, int dive2, int dive3, int dive4)
{
while(true)
{
for (int cmbchk = 0; cmbchk < 176; cmbchk++)
{
if(Screen->ComboD[cmbchk] == water1 || Screen->ComboD[cmbchk] == water2 || Screen->ComboD[cmbchk] == water3 || Screen->ComboD[cmbchk] == water4)
{
if(!Link->Item[level2flippers])
{
Screen->ComboS[cmbchk] = 0;
}
else if(Link->Item[level2flippers])
{
Screen->ComboT[cmbchk] = 3;
Screen->ComboS[cmbchk] = 15;
}
}
if(Screen->ComboD[cmbchk] == dive1)
{
if(!Link->Item[level2flippers])
{
Screen->ComboS[cmbchk] = 0;
}
else if(Link->Item[level2flippers])
{
Screen->ComboT[cmbchk] = warp1;
Screen->ComboS[cmbchk] = 15;
}
}
if(Screen->ComboD[cmbchk] == dive2)
{
if(!Link->Item[level2flippers])
{
Screen->ComboS[cmbchk] = 0;
}
else if(Link->Item[level2flippers])
{
Screen->ComboT[cmbchk] = warp2;
Screen->ComboS[cmbchk] = 15;
}
}
if(Screen->ComboD[cmbchk] == dive3)
{
if(!Link->Item[level2flippers])
{
Screen->ComboS[cmbchk] = 0;
}
else if(Link->Item[level2flippers])
{
Screen->ComboT[cmbchk] = warp3;
Screen->ComboS[cmbchk] = 15;
}
}
if(Screen->ComboD[cmbchk] == dive4)
{
if(!Link->Item[level2flippers])
{
Screen->ComboS[cmbchk] = 0;
}
else if(Link->Item[level2flippers])
{
Screen->ComboT[cmbchk] = warp4;
Screen->ComboS[cmbchk] = 15;
}
}
int loc = ComboAt(Link->X, Link->Y);
if(Screen->ComboD[loc] == water1 || Screen->ComboD[loc] == water2 || Screen->ComboD[loc] == water3 || Screen->ComboD[loc] == water4 || Screen->ComboD[loc] == dive1 || Screen->ComboD[loc] == dive2 || Screen->ComboD[loc] == dive3 || Screen->ComboD[loc] == dive4)
{
Link->HP -= damage;
Game->PlaySound(19);
int stopYUP = Link->Y - 16;
int stopYDOWN = Link->Y + 16;
int stopXLEFT = Link->X - 16;
int stopXRIGHT = Link->X + 16;
if(Link->Dir == 1)
{
while(Link->Y > stopYUP)
{
Link->Y -= 4;
Waitframe();
}
}
else if(Link->Dir == 0)
{
while(Link->Y < stopYDOWN)
{
Link->Y += 4;
Waitframe();
}
}
else if(Link->Dir == 3)
{
while(Link->X > stopXLEFT)
{
Link->X -= 4;
Waitframe();
}
}
else if(Link->Dir == 2)
{
while(Link->X < stopXRIGHT)
{
Link->X += 4;
Waitframe();
}
}
}
}
Waitframe();
}
}
}

this is the script im trying to import. idk exactly what youre talking about with a file extension or anything but its on pureZC by matthew. i actually know nothing about scripts and importing except that they have to be saved in notepad.

Joe123
01-28-2008, 04:17 PM
Right, what's likely to be your problem is that it's not the correct file extension.

Firstly, we're going to ignore that file, and open up notepad fresh.

Then what we're going to do is:

import "std.zh"
Put that on the first line. That loads in lots of tasty variables.
But you're not going to put it twice in the script.
That loads them twice.

ZScript doesn't like you if you load them twice.

Then you're going to put in your item script:

item script message{
void run(int m){
Screen->Message(m);
}
}
I've edited it slightly, now D0 in the item's arguments is what string plays. This means you can use the same script for every item.

Then you're going to copy in Matthew's script, but you're going to do it from the AGN script database instead of PureZC's, because then you'll get the text formatting and it won't be impossible to read.
http://www.armageddongames.net/forums/showthread.php?t=100085

Then what you need to do is:

Click 'Save As' (not 'Save').
Where it says 'Filetype', select 'All Files'.

In the name box, type in the name you want your script file to have, then put at the end:

.z

Then import and compile.
Should work fine.

Master Maniac
01-28-2008, 06:59 PM
ok new question... what if it doesent show up in the folder that i saved it in even after giving it the (.z) file extension?

Master Maniac
01-28-2008, 07:16 PM
sorry for the double post, my computer is weird right now.

and i figured out what i was doing wrong. i was going to tools>import ffc (something or other) and trying to import from there.

now i know that i have to go through tools>compile zscript>import for it to work. thanks!

Joe123
01-28-2008, 07:28 PM
Yes yes, that's correct.

The other one is for ZASM scripts.

Master Maniac
01-28-2008, 07:33 PM
is there any difference between the 2 types of scripts?

Joe123
01-28-2008, 07:38 PM
Oh yes.

ZASM is based on raw assembly coding, and looks a bit like this:

SETV a1,5
COUNT SETV d1,70; projectile countdown: fire at 0
LOOP SUBV d1,1
WAITFRAME
COMPAREV x,180; reached right edge?
GOTOLESS MORE
SETV xd,-1; reverse speed
MORE COMPAREV x,40; reached left edge?
GOTOMORE PROJ
SETV xd,1; reverse speed
PROJ COMPAREV data,0
GOTOTRUE 19
COMPAREV d1,0; now we handle the projectile
GOTOMORE LOOP
SETA1 x,x
SETA1 y,y; place the projectile
SETV d0,21
SETA1 data,d0; set its sprite
GOTO COUNT
QUIT

Whereas ZScript is based on C++ and looks a bit more like what you were posting earlier.

Very different.

No-one really seems to use ASM though.