User Tag List

Results 1 to 6 of 6

Thread: Trying to learn Zscript

  1. #1
    Lynel Revfan9's Avatar
    Join Date
    Jun 2005
    Location
    In front of a screen. I never leave.
    Age
    31
    Posts
    1,160
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    3,390
    Level
    18
    vBActivity - Bars
    Lv. Percent
    71.08%

    Trying to learn Zscript

    I have Zasm down, and I am trying to figure out Zscript so my scripts will be more professional, more flexible, etc. So as my first Zscript, I tried to convert my "Moonwalk (Link walks backwards)" script from Zasm to Zscript... Here is what I have.

    Code:
    ffc script Link_Moonwalks
    {
    	void run()
    	{
    	while (true)
    		{
    		if (Link->InputUp)
    		Link->Y+=2;
    		if (Link->InputDown)
    		Link->Y-=2;
    		if (Link->InputRight)
    		Link->X-=2;
    		if (Link->InputLeft)
    		Link->X+=2;
    		void Waitframe()
    		}
    	}
    }
    By everything I have read up on Zscript, it should work fine. However, it doesn't compile. However, my Zasm version worked fine:

    Code:
     SETR d0,linkx
     SETR d1,linky
    WAIT WAITFRAME
     COMPAREV INPUTUP,1
     GOTOFALSE A
     SETR linky,d1
     ADDV linky,2
     SETR d1,linky
    A COMPAREV INPUTDOWN,1
     GOTOFALSE B
     SETR linky,d1
     SUBV linky,2
     SETR d1,linky
    B COMPAREV INPUTLEFT,1
     GOTOFALSE C
     SETR linkx,d0
     ADDV linkx,2
     SETR d0,linkx
    C COMPAREV INPUTRIGHT,1
     GOTOFALSE WAIT
     SETR linkx,d0
     SUBV linkx,2
     SETR d0,linkx
     GOTO WAIT
     QUIT
    What did I do wrong? A theory of mine is that I used a different method in the Zasm script (cancel input, then go the other way) and in the Zscript version I just had Link move backwards right on the button press.

    But what mystifies me most of all is that it gets an error on void Waitframe().

  2. #2
    Is this the end?
    ZC Developer
    Saffith's Avatar
    Join Date
    Jan 2001
    Age
    41
    Posts
    3,389
    Mentioned
    178 Post(s)
    Tagged
    6 Thread(s)
    vBActivity - Stats
    Points
    6,433
    Level
    24
    vBActivity - Bars
    Lv. Percent
    70.08%

    Re: Trying to learn Zscript

    Change void Waitframe(); to just Waitframe();. It should work then.
    You only need the "void" when you're defining the function, not when you're just calling it.

  3. #3
    On top of the world ShadowTiger's Avatar
    Join Date
    Jun 2002
    Location
    Southeastern New York
    Posts
    12,231
    Mentioned
    31 Post(s)
    Tagged
    3 Thread(s)
    vBActivity - Stats
    Points
    29,579
    Level
    46
    vBActivity - Bars
    Lv. Percent
    60.36%
    Achievements It's over 9000!

    Re: Trying to learn Zscript

    ... and while we're practicing, ..

    Code:
    ffc script increasehealth 
    {
      void run()
      {
        While(True)
        {
          If(Link->InputR)
          {
            Link->HP += 16;
            Waitframe();
          }
        }
        Waitframe();
      }
    }
    This code, hopefully, should give Link an extra 16 HP whenever you press R. I'm not checking it for validity in terms of maximum health or anything, as that would come later. It's just not validating though. What am I doing wrong?

  4. #4
    Developer
    ZC Developer
    jman2050's Avatar
    Join Date
    Jun 2001
    Location
    Do you really need to know
    Age
    37
    Posts
    3,883
    Mentioned
    8 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    5,709
    Level
    23
    vBActivity - Bars
    Lv. Percent
    46.19%

    Re: Trying to learn Zscript

    Move the first Waitframe from inside the Link->InputR loop to outside of it. It should work fine then.

    Code:
    ffc script increasehealth 
    {
      void run()
      {
        While(True)
        {
          If(Link->InputR)
          {
            Link->HP += 16;
          }
          Waitframe();
        }
        Waitframe();
      }
    }
    AGN's Resident Zelda Classic Developer and Sonic the Hedgehog Fanboy

  5. #5
    On top of the world ShadowTiger's Avatar
    Join Date
    Jun 2002
    Location
    Southeastern New York
    Posts
    12,231
    Mentioned
    31 Post(s)
    Tagged
    3 Thread(s)
    vBActivity - Stats
    Points
    29,579
    Level
    46
    vBActivity - Bars
    Lv. Percent
    60.36%
    Achievements It's over 9000!

    Re: Trying to learn Zscript

    Thanks, but copying/pasting this code doesn't mean it'll compile. It doesn't... ... The error is on line 6. Unexpected LBrace, expected semicolon.

    Why?

  6. #6
    Developer
    ZC Developer
    jman2050's Avatar
    Join Date
    Jun 2001
    Location
    Do you really need to know
    Age
    37
    Posts
    3,883
    Mentioned
    8 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    5,709
    Level
    23
    vBActivity - Bars
    Lv. Percent
    46.19%

    Re: Trying to learn Zscript

    True shouldn't be capitalized.
    AGN's Resident Zelda Classic Developer and Sonic the Hedgehog Fanboy

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Armageddon Games is a game development group founded in 1997. We are extremely passionate about our work and our inspirations are mostly drawn from games of the 8-bit and 16-bit era.
Social