Jump to content

Photo

Please help!


  • Please log in to reply
8 replies to this topic

#1 Dwiese1998

Dwiese1998

    Recipient of Ways

  • Members
  • Real Name:Dylan
  • Location:Bismarck North Dakota

Posted 05 July 2011 - 05:14 PM

Okay ive been trying to sscript for 2 weeks now and I NEED HELP! ive been trying to just set it up and every time it says that there is some error so please guys could you fix this for me so i can stop getting god dang errors? please!? so here is what im trying to do: Cliff jump,Sign messages,and finally NPC's... im using 2.5 build 1401 from shardstorm.com please help! icon_cry.gif
CODE

import "std.zh""

ffc script FFCJumpCliff{

    void run(int verticalmovement, int horizontalmovement, int directiontopress) {
    
        int directiontopressmoreleft;
        int directiontopressmoreright;
        int LinkHmovementdone = 0;
        bool ffcsentlinkjumping = false;
    
        if (directiontopress==DIR_DOWN) {
            directiontopressmoreleft = DIR_RIGHTDOWN;
            directiontopressmoreright = DIR_LEFTDOWN;
        }
    
        else {
            if (directiontopress==DIR_UP) {
                directiontopressmoreleft = DIR_LEFTUP;
                directiontopressmoreright = DIR_RIGHTUP;
            }
            else {
                if (directiontopress==DIR_LEFT) {
                    directiontopressmoreleft = DIR_LEFTDOWN;
                    directiontopressmoreright = DIR_LEFTUP;
                }
                else {
                    if (directiontopress==DIR_RIGHT) {
                        directiontopressmoreleft = DIR_RIGHTUP;
                        directiontopressmoreright = DIR_RIGHTDOWN;
                    }
                    else {
                        if (directiontopress==DIR_LEFTDOWN) {
                            directiontopressmoreleft = DIR_DOWN;
                            directiontopressmoreright = DIR_LEFT;
                        }
                        else {
                            if (directiontopress==DIR_RIGHTDOWN) {
                                directiontopressmoreleft = DIR_RIGHT;
                                directiontopressmoreright = DIR_DOWN;
                            }
                            else {
                                if (directiontopress==DIR_LEFTUP) {
                                    directiontopressmoreleft = DIR_LEFT;
                                    directiontopressmoreright = DIR_UP;
                                }
                                else {
                                    if (directiontopress==DIR_RIGHTUP) {
                                        directiontopressmoreleft = DIR_UP;
                                        directiontopressmoreright = DIR_RIGHT;
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }


        while (true){
    
            if (Link->Z==0) {
                LinkHmovementdone=0;
                ffcsentlinkjumping = false;
            }
    
            if ( (ffcsentlinkjumping)&&(LinkHmovementdone<Abs(horizontalmovement)) ) {
                if (horizontalmovement<0) {Link->X--;}
                if (horizontalmovement>0) {Link->X++;}
                LinkHmovementdone++;
            }
    
            if ( (LinkCollision(this))
                && ( (Link->Dir==directiontopress)
                ||(Link->Dir==directiontopressmoreleft)
                ||(Link->Dir==directiontopressmoreright) ) ) {
                
                if (Link->Z==0) Game->PlaySound(SFX_JUMP);
                ffcsentlinkjumping=true;
                Link->Y=Link->Y+verticalmovement;
                Link->Z=Link->Z+verticalmovement;
            }
            
            Waitframe();
        }
    }
}

ffc script RealNPC{
    void run(int m, int sfx, int defdir, int d, int ffcnumber, int input){
        ffc NPC = this;
        if(ffcnumber != 0) Screen->LoadFFC(ffcnumber);
        NPC->Misc[0] = NPC->Data;
        if(d == 0) d = 40;
        
        while(true){
            SetGraphic(NPC,defdir,d);
            if(CanTalk(NPC,input)){
                SetInput(input,false);
                if(sfx != 0) Game->PlaySound(sfx);
                Screen->Message(m);
            }
            Waitframe();
        }
    }
    bool CanTalk(ffc NPC,int input){
        return (SelectPressInput(input) && Abs(NPC->X-Link->X) < 24 && Abs(NPC->Y-Link->Y) < 24 && Link->Z == 0);
    }
    void SetGraphic(ffc NPC, int defdir, int d){
        int dx = NPC->X-Link->X; int ax = Abs(dx);
        int dy = NPC->Y-Link->Y; int ay = Abs(dy);
        if(defdir != 0){
            if(ax < d && ay < d){
                if(ax <= ay){
                    if(dy >= 0) NPC->Data = NPC->Misc[0]+DIR_UP;
                    else NPC->Data = NPC->Misc[0]+DIR_DOWN;
                }else{
                    if(dx >= 0) NPC->Data = NPC->Misc[0]+DIR_LEFT;
                    else NPC->Data = NPC->Misc[0]+DIR_RIGHT;
                }
            }else NPC->Data = NPC->Misc[0]+(defdir-1);
        }
    }
}

//Only include these two functions once in your script file
bool SelectPressInput(int input){
    if(input == 0) return Link->PressA;
    else if(input == 1) return Link->PressB;
    else if(input == 2) return Link->PressL;
    else if(input == 3) return Link->PressR;
}
void SetInput(int input, bool state){
    if(input == 0) Link->InputA = state;
    else if(input == 1) Link->InputB = state;
    else if(input == 2) Link->InputL = state;
    else if(input == 3) Link->InputR = state;
}

item script Message{
    void run(int m){
        Screen->Message(m);
    }
}

ffc script Signpost{
    void run(int m,int input){
        int loc = ComboAt(this->X,this->Y);
        while(true){
            while(!AgainstComboBase(loc) || !SelectPressInput(input)) Waitframe();
            SetInput(input,false);
            Screen->Message(m);
            Waitframe();
        }
    }
    bool AgainstComboBase(int loc){
        return Link->Z == 0 && (Link->Dir == DIR_UP && Link->Y == ComboY(loc)+8 && Abs(Link->X-ComboX(loc)) < 8);
    }
}

//These functions should only be included in your script file once
bool SelectPressInput(int input){
    if(input == 0) return Link->PressA;
    else if(input == 1) return Link->PressB;
    else if(input == 2) return Link->PressL;
    else if(input == 3) return Link->PressR;
}
void SetInput(int input, bool state){
    if(input == 0) Link->InputA = state;
    else if(input == 1) Link->InputB = state;
    else if(input == 2) Link->InputL = state;
    else if(input == 3) Link->InputR = state;
}







ugh im sorry i dont know how to get it posted corectly...

#2 Jared

Jared

    Deified

  • Members
  • Real Name:Jared
  • Pronouns:He / Him
  • Location:New Hampshire

Posted 05 July 2011 - 05:15 PM

What is the error?
And it would probably help if you upgraded to 2.5 RC2 icon_wink.gif

#3 Mero

Mero

    Touch Fluffy Tail

  • Banned
  • Real Name:Tamamo No Mae
  • Location:Rainbow Factory

Posted 05 July 2011 - 05:17 PM

QUOTE(Lynker @ Jul 5 2011, 04:15 PM) View Post

What is the error?
And it would probably help if you upgraded to 2.5 RC2 icon_wink.gif


I'll check it out tonight. Busy helping others. icon_wink.gif

#4 Dwiese1998

Dwiese1998

    Recipient of Ways

  • Members
  • Real Name:Dylan
  • Location:Bismarck North Dakota

Posted 05 July 2011 - 05:40 PM

2.5 RC2? what is it?

#5 Mero

Mero

    Touch Fluffy Tail

  • Banned
  • Real Name:Tamamo No Mae
  • Location:Rainbow Factory

Posted 05 July 2011 - 05:51 PM

QUOTE(Dwiese1998 @ Jul 5 2011, 04:40 PM) View Post

2.5 RC2? what is it?


The most recent release canidate. Get it from shardstorm.

Had some free time and got it to compile.
CODE
import "std.zh""

ffc script FFCJumpCliff{

void run(int verticalmovement, int horizontalmovement, int directiontopress) {

int directiontopressmoreleft;
int directiontopressmoreright;
int LinkHmovementdone = 0;
bool ffcsentlinkjumping = false;

if (directiontopress==DIR_DOWN) {
directiontopressmoreleft = DIR_RIGHTDOWN;
directiontopressmoreright = DIR_LEFTDOWN;
}

else {
if (directiontopress==DIR_UP) {
directiontopressmoreleft = DIR_LEFTUP;
directiontopressmoreright = DIR_RIGHTUP;
}
else {
if (directiontopress==DIR_LEFT) {
directiontopressmoreleft = DIR_LEFTDOWN;
directiontopressmoreright = DIR_LEFTUP;
}
else {
if (directiontopress==DIR_RIGHT) {
directiontopressmoreleft = DIR_RIGHTUP;
directiontopressmoreright = DIR_RIGHTDOWN;
}
else {
if (directiontopress==DIR_LEFTDOWN) {
directiontopressmoreleft = DIR_DOWN;
directiontopressmoreright = DIR_LEFT;
}
else {
if (directiontopress==DIR_RIGHTDOWN) {
directiontopressmoreleft = DIR_RIGHT;
directiontopressmoreright = DIR_DOWN;
}
else {
if (directiontopress==DIR_LEFTUP) {
directiontopressmoreleft = DIR_LEFT;
directiontopressmoreright = DIR_UP;
}
else {
if (directiontopress==DIR_RIGHTUP) {
directiontopressmoreleft = DIR_UP;
directiontopressmoreright = DIR_RIGHT;
}
}
}
}
}
}
}
}


while (true){

if (Link->Z==0) {
LinkHmovementdone=0;
ffcsentlinkjumping = false;
}

if ( (ffcsentlinkjumping)&&(LinkHmovementdone<Abs(horizontalmovement)) ) {
if (horizontalmovement<0) {Link->X--;}
if (horizontalmovement>0) {Link->X++;}
LinkHmovementdone++;
}

if ( (LinkCollision(this))
&& ( (Link->Dir==directiontopress)
||(Link->Dir==directiontopressmoreleft)
||(Link->Dir==directiontopressmoreright) ) ) {

if (Link->Z==0) Game->PlaySound(SFX_JUMP);
ffcsentlinkjumping=true;
Link->Y=Link->Y+verticalmovement;
Link->Z=Link->Z+verticalmovement;
}

Waitframe();
}
}
}

ffc script RealNPC{
void run(int m, int sfx, int defdir, int d, int ffcnumber, int input){
ffc NPC = this;
if(ffcnumber != 0) Screen->LoadFFC(ffcnumber);
NPC->Misc[0] = NPC->Data;
if(d == 0) d = 40;

while(true){
SetGraphic(NPC,defdir,d);
if(CanTalk(NPC,input)){
SetInput(input,false);
if(sfx != 0) Game->PlaySound(sfx);
Screen->Message(m);
}
Waitframe();
}
}
bool CanTalk(ffc NPC,int input){
return (SelectPressInput(input) && Abs(NPC->X-Link->X) < 24 && Abs(NPC->Y-Link->Y) < 24 && Link->Z == 0);
}
void SetGraphic(ffc NPC, int defdir, int d){
int dx = NPC->X-Link->X; int ax = Abs(dx);
int dy = NPC->Y-Link->Y; int ay = Abs(dy);
if(defdir != 0){
if(ax < d && ay < d){
if(ax <= ay){
if(dy >= 0) NPC->Data = NPC->Misc[0]+DIR_UP;
else NPC->Data = NPC->Misc[0]+DIR_DOWN;
}else{
if(dx >= 0) NPC->Data = NPC->Misc[0]+DIR_LEFT;
else NPC->Data = NPC->Misc[0]+DIR_RIGHT;
}
}else NPC->Data = NPC->Misc[0]+(defdir-1);
}
}
}

//Only include these two functions once in your script file
bool SelectPressInput(int input){
if(input == 0) return Link->PressA;
else if(input == 1) return Link->PressB;
else if(input == 2) return Link->PressL;
else if(input == 3) return Link->PressR;
}
void SetInput(int input, bool state){
if(input == 0) Link->InputA = state;
else if(input == 1) Link->InputB = state;
else if(input == 2) Link->InputL = state;
else if(input == 3) Link->InputR = state;
}

item script Message{
void run(int m){
Screen->Message(m);
}
}

ffc script Signpost{
void run(int m,int input){
int loc = ComboAt(this->X,this->Y);
while(true){
while(!AgainstComboBase(loc) || !SelectPressInput(input)) Waitframe();
SetInput(input,false);
Screen->Message(m);
Waitframe();
}
}
bool AgainstComboBase(int loc){

        return Link->Z == 0 && (Link->Dir == DIR_UP && Link->Y == ComboY(loc)+8 && Abs(Link->X-ComboX(loc)) < 8);
}
}

Edited by blackbishop89, 05 July 2011 - 06:37 PM.


#6 Gleeok

Gleeok

    It's dangerous to dough alone, bake this.

  • Members
  • Real Name:Pillsbury
  • Location:Magical Land of Dough

Posted 05 July 2011 - 05:56 PM

Eh? 1401 = RC2. icon_eek.gif


To the OP: Please use tags.

edit: edited them in for you. icon_wink.gif

#7 Mero

Mero

    Touch Fluffy Tail

  • Banned
  • Real Name:Tamamo No Mae
  • Location:Rainbow Factory

Posted 05 July 2011 - 06:42 PM

Updated the code it should work now.

#8 Omega

Omega

    Yes

  • Members

Posted 06 July 2011 - 04:10 PM

If you can't get it to work let me know and I will edit the script I use into this post. It has cliff jump and the NPC script which also allows for sign posts.

Don't worry, I will remove the other scripts I use in the code. A last resort if anything.

#9 Saffith

Saffith

    IPv7 user

  • Members

Posted 07 July 2011 - 09:23 PM

Here:
CODE
import "std.zh"

ffc script FFCJumpCliff{

    void run(int verticalmovement, int horizontalmovement, int directiontopress) {
    
        int directiontopressmoreleft;
        int directiontopressmoreright;
        int LinkHmovementdone = 0;
        bool ffcsentlinkjumping = false;
    
        if (directiontopress==DIR_DOWN) {
            directiontopressmoreleft = DIR_RIGHTDOWN;
            directiontopressmoreright = DIR_LEFTDOWN;
        }
    
        else {
            if (directiontopress==DIR_UP) {
                directiontopressmoreleft = DIR_LEFTUP;
                directiontopressmoreright = DIR_RIGHTUP;
            }
            else {
                if (directiontopress==DIR_LEFT) {
                    directiontopressmoreleft = DIR_LEFTDOWN;
                    directiontopressmoreright = DIR_LEFTUP;
                }
                else {
                    if (directiontopress==DIR_RIGHT) {
                        directiontopressmoreleft = DIR_RIGHTUP;
                        directiontopressmoreright = DIR_RIGHTDOWN;
                    }
                    else {
                        if (directiontopress==DIR_LEFTDOWN) {
                            directiontopressmoreleft = DIR_DOWN;
                            directiontopressmoreright = DIR_LEFT;
                        }
                        else {
                            if (directiontopress==DIR_RIGHTDOWN) {
                                directiontopressmoreleft = DIR_RIGHT;
                                directiontopressmoreright = DIR_DOWN;
                            }
                            else {
                                if (directiontopress==DIR_LEFTUP) {
                                    directiontopressmoreleft = DIR_LEFT;
                                    directiontopressmoreright = DIR_UP;
                                }
                                else {
                                    if (directiontopress==DIR_RIGHTUP) {
                                        directiontopressmoreleft = DIR_UP;
                                        directiontopressmoreright = DIR_RIGHT;
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }


        while (true){
    
            if (Link->Z==0) {
                LinkHmovementdone=0;
                ffcsentlinkjumping = false;
            }
    
            if ( (ffcsentlinkjumping)&&(LinkHmovementdone<Abs(horizontalmovement)) ) {
                if (horizontalmovement<0) {Link->X--;}
                if (horizontalmovement>0) {Link->X++;}
                LinkHmovementdone++;
            }
    
            if ( (LinkCollision(this))
                && ( (Link->Dir==directiontopress)
                ||(Link->Dir==directiontopressmoreleft)
                ||(Link->Dir==directiontopressmoreright) ) ) {
                
                if (Link->Z==0) Game->PlaySound(SFX_JUMP);
                ffcsentlinkjumping=true;
                Link->Y=Link->Y+verticalmovement;
                Link->Z=Link->Z+verticalmovement;
            }
            
            Waitframe();
        }
    }
}

ffc script RealNPC{
    void run(int m, int sfx, int defdir, int d, int ffcnumber, int input){
        ffc NPC = this;
        if(ffcnumber != 0) Screen->LoadFFC(ffcnumber);
        NPC->Misc[0] = NPC->Data;
        if(d == 0) d = 40;
        
        while(true){
            SetGraphic(NPC,defdir,d);
            if(CanTalk(NPC,input)){
                SetInput(input,false);
                if(sfx != 0) Game->PlaySound(sfx);
                Screen->Message(m);
            }
            Waitframe();
        }
    }
    bool CanTalk(ffc NPC,int input){
        return (SelectPressInput(input) && Abs(NPC->X-Link->X) < 24 && Abs(NPC->Y-Link->Y) < 24 && Link->Z == 0);
    }
    void SetGraphic(ffc NPC, int defdir, int d){
        int dx = NPC->X-Link->X; int ax = Abs(dx);
        int dy = NPC->Y-Link->Y; int ay = Abs(dy);
        if(defdir != 0){
            if(ax < d && ay < d){
                if(ax <= ay){
                    if(dy >= 0) NPC->Data = NPC->Misc[0]+DIR_UP;
                    else NPC->Data = NPC->Misc[0]+DIR_DOWN;
                }else{
                    if(dx >= 0) NPC->Data = NPC->Misc[0]+DIR_LEFT;
                    else NPC->Data = NPC->Misc[0]+DIR_RIGHT;
                }
            }else NPC->Data = NPC->Misc[0]+(defdir-1);
        }
    }
}

item script Message{
    void run(int m){
        Screen->Message(m);
    }
}

ffc script Signpost{
    void run(int m,int input){
        int loc = ComboAt(this->X,this->Y);
        while(true){
            while(!AgainstComboBase(loc) || !SelectPressInput(input)) Waitframe();
            SetInput(input,false);
            Screen->Message(m);
            Waitframe();
        }
    }
    bool AgainstComboBase(int loc){
        return Link->Z == 0 && (Link->Dir == DIR_UP && Link->Y == ComboY(loc)+8 && Abs(Link->X-ComboX(loc)) < 8);
    }
}

//These functions should only be included in your script file once
bool SelectPressInput(int input){
    if(input == 0) return Link->PressA;
    else if(input == 1) return Link->PressB;
    else if(input == 2) return Link->PressL;
    else if(input == 3) return Link->PressR;
}
void SetInput(int input, bool state){
    if(input == 0) Link->InputA = state;
    else if(input == 1) Link->InputB = state;
    else if(input == 2) Link->InputL = state;
    else if(input == 3) Link->InputR = state;
}



1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users