Jump to content

Photo

Learning Zscript


  • Please log in to reply
20 replies to this topic

#16 lucas92

lucas92

    Defender

  • Members

Posted 25 July 2008 - 04:23 PM

Something I've tried out:

CODE
ffc script link_asleep{
    
        void run (int layer, int xpos, int ypos, int tile, int width, int height, int cset, bool InputA, bool InputB, bool InputDown, bool InputLeft, bool InputR, bool InputRight, bool InputStart, bool InputUp, bool InputL){
        
        int transparency;
            int opacity = 128;
            int i;
                for(i=0;i<240;i++){
                Link->InputA=false; InputB=false; InputDown=false; InputL=false; InputLeft=false; InputR=false; InputRight=false; InputStart=false; InputUp=false;
                Screen->DrawTile(1, 96, 96, 4, 1, 1, 6, 1,0,0,0,0, 1, 128);
                Waitframe();
            }
        Link->Warp(1, 77);
    }
}


This is supposed to draw a tile with Link asleep, and to not give the opportunity to the player to move (I could have done it with combos, but I prefer it that way) then after 4 seconds it warps to an another screen.

But there's the problem:

IPB Image

IPB Image

It compiles all well, but there's that window. What am I doing wrong?

#17 Gleeok

Gleeok

    It's dangerous to dough alone, bake this.

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

Posted 25 July 2008 - 06:58 PM

Too many arguments. It goes from arg0 - arg7, and they must be between 0000.0001 and 9999.9999. At least I'm 90% sure that is the problem.



Also, for the topic of learning language; I had no programming knowledge prior to learning zscript, none whatsoever. What I've learned though, is that zscript is far simpler than C, Java, or Basic, as it should be, seeing how it was meant to be that.

Edited by Gleeok, 25 July 2008 - 07:07 PM.


#18 lucas92

lucas92

    Defender

  • Members

Posted 25 July 2008 - 07:23 PM

Got it to work with this:

EDIT:

A code using arguments, yay!

CODE
ffc script link_asleep{
    
//Arguments
//Layer=D0
//xpos=D1
//ypos=D2
//width=D3
//height=D4
//dmap=D05 'Dmap you want to be warped to
//screen=D06 'Screen you want to be warped to
//Thanks to Joe123 and Xiion for making me understand the basics of Zscript. Hopefully I will be able to do other scripts. :)      

void run (int layer, int xpos, int ypos, int width, int height, int dmap, int screen){
        int i;
        int Action;
        int cset;
        int transparency;
        int opacity;
                for(i=0;i<240;i++){
                Link->Action=0;
                Screen->DrawTile(layer, xpos, ypos, 4, width, height, 6, 1,0,0,0,0, 1, 128);
                Waitframe();
            }
        Link->Warp(dmap, screen);
    }
}


Though, when I set the screen to 77, it warps me to 54??? The warp void is a little tricky, it does everything I don't want to... Anyone can test this script and tell me how to set the dmap and screen argument? I just don't get it.

Edited by lucas92, 25 July 2008 - 08:31 PM.


#19 lucas92

lucas92

    Defender

  • Members

Posted 25 July 2008 - 09:13 PM

CODE
global script GrimReaperScene {

    void run (int NumDeaths, int dmap, int screen)
    {
        if (Game->NumDeaths==1) {
        Link->Warp(dmap, screen);
        }
    }
}


A Grim Reaper scene Global script as seen as in Conker Bad Fur Day on N64! The first time you die, you will get warped to a screen for a second chance. After that, you die. icon_razz.gif

http://ca.youtube.co...h?v=cTVoci2iNUQ

Didn't test it out, but I would want to know how that warp void method works first. icon_confused.gif

#20 lucas92

lucas92

    Defender

  • Members

Posted 28 July 2008 - 10:48 AM

Alright, I've got this:

CODE
ffc script guard_move_vertical
{
    void run (int ffcnumber, int string, int string2, int item1, int item2)
    {
        int X;
        int Y;
        float X;
        float Y;
        int Dir;
        int Wait;
        float Ay;
        ffc guard;
        Screen->LoadFFC(ffcnumber);
        guard->Flags [2];
        bool Item;
        
        
        if (Link->Y<96)
        {
            guard->Y==96;
        }
        else
        {
            guard->Y==Link->Y;
        }
        if (Link->X==guard->X-16)
        {
            Screen->Message(string);
            if (Link->Item[item1]==true && Item[item2]==true)
            {
                for (Wait==0;Wait==128;Wait++)
                    {
                    Waitframe();
                    }
                Screen->Message(string2);
                while (guard->Y!=96)
                {
                    guard->Ay==-1;
                }
            }
            else
            {
            Link->Dir==2;
            Link->X==guard->X-32;
            }
        }
    }
}


But there's one problem:
IPB Image

Also, I would want to know how to make a ffc solid because I really doubt that with my method, it would make it solid...

Oh, the script is basically a guard that is blocking the way to Link if he doesn't has the first sword and a shield, a little bit like the guy blocking the way to Link in Ocarina of Time. So, if Link has the first sword and shield, the guy moves up and stay at one location, so he let pass Link.

#21 Alestance

Alestance

    Saint Alestance - Eliminator of the ZGP format

  • Members
  • Real Name:Lonk
  • Location:Pennsylvania

Posted 28 July 2008 - 06:19 PM

QUOTE(Joe123 @ Jul 24 2008, 10:05 AM) View Post

The only language I know is ZScript (well, and HTML), I never learnt C++ or anything.
I just learnt from reading other people's scripts and asking lots of questions really.


I, on the other hand, HAVE experience with C++, SL script, and various other C-like programming languages/scripting engines, and I CAN'T for the life of me get a grasp of ZScript.


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users