Jump to content

Photo

Issues with scripts


  • Please log in to reply
13 replies to this topic

#1 HylianGlaceon

HylianGlaceon

    Magus

  • Members
  • Location:Whatever dimension is between Sinnoh and Hyrule...

Posted 18 November 2010 - 11:35 PM

Hi, I'm new here, and I have been having the same problem as this person here: http://www.purezc.co...showtopic=47587 . Only it's not just with the bombchu script, but every script I try to import.

I tried removing the definition in the std.zh file, but it just gave me a different error then and still wouldn't work.

I was hoping to add the Rolling action, then Bombchu, Ball and Chain, Bomb Arrow, Pegasus Boot and Roc's Cape items to my quest if it were possible, so far it wouldn't let me import any of those. I really have no idea how any of this stuff works, though it'd be great if someone could help me compile and add these to my quest.

I'm using the ZC 2.5 Build 1318 Windows and have no scripts used yet. My quest was started on a 2.10 build and then resaved under the build i'm using now if that has any effect on it.

#2 Saffith

Saffith

    IPv7 user

  • Members

Posted 19 November 2010 - 01:55 AM

You shouldn't remove it from std.zh; that might break other scripts. Better to remove the other one.
Anyway, if it gave you a different error, it's a different problem. What did it say?

#3 HylianGlaceon

HylianGlaceon

    Magus

  • Members
  • Location:Whatever dimension is between Sinnoh and Hyrule...

Posted 19 November 2010 - 02:17 PM

It gave me a different error when I had removed it, I put it back to the way it was so it's back to the same error again. Which other one should I remove? I'm still new to scripts and I thought that was the only area I could edit the definitions of the scripts.

This is the exact error I get from putting the Bombchu script in. (I don't have any scripts in my quest yet)

"TMP, LINE 38: ERROR S04: FUNCTION NOACTION WAS ALREADY DECLARED WITH THAT TYPE SIG NATURE."

From what I can tell it's the exact same line as the other person had.

I've tried emailing my quest to a different computer and doing it there as well and still gives the same error. I don't suppose this might be the result of a quest rule or something?



#4 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 19 November 2010 - 02:19 PM

Function NoAction was copied into std.zh. Remove the definition of NoAction from your script (but don't ever remove anything from std.zh!).

#5 HylianGlaceon

HylianGlaceon

    Magus

  • Members
  • Location:Whatever dimension is between Sinnoh and Hyrule...

Posted 20 November 2010 - 07:01 PM

What exactly do I have to remove from the script? Or what should it look like when the right part is removed? It still gives me an error when I removed what I thought was the definition.

If it's going to be this much of a pain for every script, I might just have to exclude them at this rate.

#6 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 20 November 2010 - 09:16 PM

The definition is the part that says
CODE
function NoAction{
InputA=false
... ... ...
}

Edited by MoscowModder, 20 November 2010 - 09:16 PM.


#7 HylianGlaceon

HylianGlaceon

    Magus

  • Members
  • Location:Whatever dimension is between Sinnoh and Hyrule...

Posted 20 November 2010 - 11:34 PM

Alright I removed that part and now it gives me a new error referring to this line..

bool ComboFI(int x,int y, int combotype){

The error is this:

TMP, LINE 22: ERROR S04: FUNCTION COMBOFI WAS ALREADY DECLARED WITH THAT TYPE SIG NATURE.

#8 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 21 November 2010 - 10:15 AM

It might be the same problem with another function. Search your script to make sure ComboFi is only declared once (starting with "function ComboFi{...), then check std.zh to see if it is declared there. If so, remove unneeded declarations in your script file.

#9 HylianGlaceon

HylianGlaceon

    Magus

  • Members
  • Location:Whatever dimension is between Sinnoh and Hyrule...

Posted 22 November 2010 - 02:46 PM

Okay, I think it's finally working now, thanks! Another thing though... Right now the Bombchu uses counter 6, which is the same as the Super Bombs. Would it be an easy fix to be able to set it to counter 7, so Bombchu and Super Bombs would use different counters? I was planning on the Bombchus to be about as powerful as regular bombs and possibly quite numerous in my quest.

This is what is in the script right now for the Bombchu counter, what would I put for it to use counter #7?

Game->Counter[CR_SBOMBS]--;

(If counter 7 won't work, I assume I could also use [CR_BOMBS] for the regular bomb counter if needed as well, right?)


#10 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 22 November 2010 - 02:52 PM

Look at std.zh and find the name for Custom Counter #1, and put that there. It's much less confusing than putting in the number itself.

#11 HylianGlaceon

HylianGlaceon

    Magus

  • Members
  • Location:Whatever dimension is between Sinnoh and Hyrule...

Posted 22 November 2010 - 04:42 PM

Okay, it's working now, i'll draw a minitile for it later.

I'll see if I can get some of the other scripts compiled with it now, thanks!


EDIT 1 - Actually scratch that, tried to compile the bomb arrow script with it, and apparently broke it. Now when I compile the bombchu script, the bombchu item doesn't work at all ingame. Even tried with just the Bombchu script now with no Bomb Arrow script attached and still nothing.

EDIT 2 - I've gotten the Bombchu re-enabled, but the Bomb Arrows still do nothing? I have both Arrows and Bombs in the counter, as well as the regular bow and arrow enabled, but nothing happens.

Edited by HylianGlaceon, 22 November 2010 - 05:45 PM.


#12 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 22 November 2010 - 06:16 PM

Try posting your complete script file so we can look at it.

#13 HylianGlaceon

HylianGlaceon

    Magus

  • Members
  • Location:Whatever dimension is between Sinnoh and Hyrule...

Posted 22 November 2010 - 06:35 PM

Okay, I think this is it, I had to export it from my quest file because the original .z document is on a different computer.

CODE
import "std.zh"

//Constants
const int CF_BCHU            = 104;        //Flag the Bombchu can pass through (even if solid)
const int T_BCHU            = 1342;        //ID number of first Bombchu tile. Tiles should be organised : Up, Down, Left, Right
const int BChuNumFrames        = 2;        //Number of frames of bombchu animation
const int BChuASpeed        = 10;        //Animation speed of bombchu
const int BChuCSet            = 7;        //CSet for bombchu
const int BChuDamage        = 4;        //Damage for Bombchu to deal. The wooden sword deals 2 damage
const int BChuSpeed            = 150;        //Speed Bombchu moves at, in hundredths of pixels per frame
const int BChuExpType        = 1;        //Type of explosion. 0 for a normal bomb, 1 for a superbomb

//Variables
int UseBChu;
int BChuDir;
int BChuX;
int BChuY;
int StoreHP;

//Input constants
const int ArrowDamage    = 2;        //Damage for Arrow to deal. Wooden sword deals 2 damage
const int BombDamage     = 8;        //Damage for explosion to deal
const int ArrowSpeed    = 300;        //Speed arrow moves at, in hundredths of pixels per frame
const int T_BOMBARROW    = 855;        //Arrange tiles in the order 'Up,Down,Left,Right' on the tilesheet. Set up-facing bomb arrow tile here

//Variables
int UseBombArrow;
int ArrowX; int ArrowY;

//Functions
//Check inherent and regular flags at the same time
//Solidity Check, by Saffith
bool isSolid(int x,int y){
if(x<0 || x>255 || y<0 || y>175) return false;
int mask = 1111b;
if(x%16<8) mask &= 0011b;
else mask &= 1100b;
if(y%16<8) mask &= 0101b;
else mask &= 1010b;
int ret = Screen->ComboS[ComboAt(x,y)]&mask;
return ret != 0;
}

global script Slot_2{
    void run(){
        while(true){
            //Call Bombchu functions
            if(UseBChu > 0) Bombchu();
            
        Waitframe();
        }
    }
    //Bombchu functions
    void Bombchu(){
        if(UseBChu == 1){
            int X; int Y;
            if(Link->Dir>1) X = (Link->Dir-2)*32-16;
            if(Link->Dir<2) Y = Link->Dir*32-16;
            
            if(Link->X > 16 && Link->X < 240 && Link->Y > 16 && Link->Y < 152){
                lweapon BChu = Screen->CreateLWeapon(LW_SCRIPT1);
                BChu->X = Link->X+X;
                BChu->Y = Link->Y+Y;
                BChuDir = Link->Dir;
                BChu->Dir = BChuDir;
                BChu->Step = BChuSpeed;
                
                BChu->OriginalTile = T_BCHU+Link->Dir*BChuNumFrames;
                BChu->Tile = T_BCHU+Link->Dir*BChuNumFrames;
                BChu->NumFrames = BChuNumFrames;
                BChu->ASpeed = BChuASpeed;
                BChu->CSet = BChuCSet;
                
                Link->Action = LA_ATTACKING;
                Game->PlaySound(SFX_PLACE);
                Game->Counter[CR_SCRIPT1]--;
                UseBChu++;
            }else{
                Explosion(BChuX,BChuY,BChuExpType);
                UseBChu--;
            }
        }else{
            bool Found;
            for(int i=1;i<=Screen->NumLWeapons();i++){
                lweapon BChu = Screen->LoadLWeapon(i);
                if(BChu->ID == LW_SCRIPT1){
                    if(Link->InputUp) BChuDir = DIR_UP;
                    if(Link->InputDown) BChuDir = DIR_DOWN;
                    if(Link->InputLeft) BChuDir = DIR_LEFT;
                    if(Link->InputRight) BChuDir = DIR_RIGHT;
                    if((BChuDir == DIR_UP && BombchuCheck(BChu->X+8,BChu->Y+4))
                    || (BChuDir == DIR_DOWN && BombchuCheck(BChu->X+8,BChu->Y+12))
                    || (BChuDir == DIR_LEFT && BombchuCheck(BChu->X+4,BChu->Y+8))
                    || (BChuDir == DIR_RIGHT && BombchuCheck(BChu->X+12,BChu->Y+8))) BChu->DeadState = 0;
                
                    BChu->Dir = BChuDir;
                    BChu->OriginalTile = T_BCHU+BChuDir*BChuNumFrames;
                    BChu->Tile = T_BCHU+BChuDir*BChuNumFrames;
                    BChuX = BChu->X;
                    BChuY = BChu->Y;
                    
                    if(Link->HP < StoreHP) BChu->DeadState = 0;
                    NoAction();
                    Found = true;
                    break;
                }
            }
            if(!Found){
                Explosion(BChuX,BChuY,BChuExpType);
                UseBChu-=2;
            }
        }
        StoreHP = Link->HP;
    }
    //Create an explosion
    void Explosion(int x, int y, int type){
        int BombType;
        if(type == 0) BombType = LW_BOMBBLAST;
        else BombType = LW_SBOMBBLAST;
        lweapon Exp = Screen->CreateLWeapon(BombType);
        Exp->X = BChuX;
        Exp->Y = BChuY;
        Exp->Damage = BChuDamage;
    }
    //Check whether the bombchu can enter a tile
    bool BombchuCheck(int x,int y){
    if((isSolid(x,y) && !ComboFI(x,y,CF_BCHU))
    || ComboFI(x,y,CF_BOMB) || ComboFI(x,y,CF_SBOMB)
    || Screen->ComboT[ComboAt(x,y)] == CT_WATER) return true;
    }
}
//bomb arrow functions
    void BombArrow(){
        if(UseBombArrow == 1){
            lweapon Arrow = Screen->CreateLWeapon(LW_ARROW);
            int x; int y;
            if(Link->Dir > 1) x = (Link->Dir-2)*16-8;
            else y = Link->Dir*16-8;
            Arrow->X = Link->X+x;
            Arrow->Y = Link->Y+y;
            Arrow->Dir = Link->Dir;
            Arrow->Tile = T_BOMBARROW;
            Arrow->Tile += Link->Dir;
            
            Arrow->Damage = ArrowDamage;
            Arrow->Step = ArrowSpeed;
            Game->PlaySound(SFX_ARROW);
            Link->Action = LA_ATTACKING;
            UseBombArrow++;
        }else{
            lweapon Arrow;
            bool Found;
            for(int i=1;i<=Screen->NumLWeapons();i++){
                Arrow = Screen->LoadLWeapon(i);
                if(Arrow->ID != LW_ARROW) continue;
                Found = true;
            }
            if(Found){
                ArrowX = Arrow->X;
                ArrowY = Arrow->Y;
                for(int j=-4;j<=4;j+=4){
                    for(int k=-4;k<=4;k+=4){
                        if(isSolid(Arrow->X+8+j,Arrow->Y+8+k)
                        || ComboFI(ComboAt(Arrow->X+8+j,Arrow->Y+8+k),CF_BOMB)) Arrow->DeadState = 0;
                    }
                }
            }else{
                lweapon Exp = Screen->CreateLWeapon(LW_BOMBBLAST);
                Exp->Damage = BombDamage;
                Exp->X = ArrowX;
                Exp->Y = ArrowY;
                UseBombArrow = 0;
            }
        }
    }


global script Slot_3{
    void run(){
        UseBChu = 0;
    }
}

item script Bombchu{
    void run(){
        if(Game->Counter[CR_SCRIPT1] > 0) UseBChu++;
    }
}
item script BombArrows{
    void run(){
        if(Game->Counter[CR_BOMBS] > 0 && Game->Counter[CR_ARROWS] > 0 && UseBombArrow == 0){
            UseBombArrow++;
            Game->Counter[CR_BOMBS]--;
            Game->Counter[CR_ARROWS]--;
        }
    }
}



#14 HylianGlaceon

HylianGlaceon

    Magus

  • Members
  • Location:Whatever dimension is between Sinnoh and Hyrule...

Posted 26 November 2010 - 08:32 PM

Is there anywhere else that may be effecting this such as scripts or how the counter reference is set to? I really have no idea on what else might be wrong.


Nevermind, I think I fixed it, it appears to be working, hopefully nothing else breaks..

Edited by HylianGlaceon, 27 November 2010 - 03:39 PM.



0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users