Help With Game

Hello Everyone,
I am making a video game, and I am currently working on a 3D wave and I am using a BSplineSurface.cs script file and it is giving me a parsing error and I don’t know what to do.
Here are the details.
It originally had 148 lines. Now it has 418.

using UnityEngine;


using System.Collections;


using System.Collections.Generic;





public class BSplineSurface {





  /*


9.  * THESE VALUES MUST BE SET BEFORE CALCULATING


10.  */


  //size of the control net (e.g. 3x4 net)


  public int NI = 4; //setting these to high can crash unity


  public int NJ = 4;


  //Grid of control points


  public Vector3[,] controlGrid;


  //The degree in each direction


  public int TI = 3;


  public int TJ = 3;


  //output GRID resolution (e.g. 30x40)


  public int RESOLUTIONI = 150; //setting these to high can crash unity


  public int RESOLUTIONJ = 150;


  //the output Grid


  public Vector3[,] outputGrid;





  /*


26.  * INTERNAL VALUES


27.  */


  //internal knots in each direction


  private int[] knotsI;


  private int[] knotsJ;


  //internal variables


  private int i, j, ki, kj;


  private float intervalI, incrementI, intervalJ, incrementJ, bi, bj;





  //FUNCTIONS


  private BSplineMath bmath = new BSplineMath();





  //constructor


  public BSplineSurface()


  {


  Init();


  }








  //MUST BE CALLED FIRST


  public void Init () {





  controlGrid = new Vector3[NI+1,NJ+1];


  outputGrid = new Vector3[RESOLUTIONI, RESOLUTIONJ];





  //init step size (the increment steps)


  incrementI = (NI-TI+2) / ((float)RESOLUTIONI - 1);


  incrementJ = (NJ-TJ+2) / ((float)RESOLUTIONJ - 1);





  //Calculate KNOTS


  knotsI = bmath.SplineKnots(NI, TI);


  knotsJ = bmath.SplineKnots(NJ, TJ);





  }





  // Use this for random initialization


  public void InitRandomGrid () {





  //init control points (random z)


  for(i=0; i<=NI; i++)


  {


  for(j=0; j<=NJ; j++)

  {


  controlGrid[i, j].x = i;


  controlGrid[i, j].y = j;


  controlGrid[i, j].z = Random.value;


  }


  }


  }





  // Use this for grid input (remember to set NI and NJ before(the grid size) and call Init)


  public void InitGrid (Vector3[,] inputGrid) {





  //init control points (random z)


  for(i=0; i<=NI; i++)


  {


  for(j=0; j<=NJ; j++)


  {


  controlGrid[i, j] = inputGrid[i, j];


  }


  }


  }








  public void Calculate()


  {


  //MAIN CALCULATIONS


  intervalI = 0;


  for(i = 0; i < RESOLUTIONI-1; i++)


  {


  intervalJ = 0;


  for(j = 0; j < RESOLUTIONJ-1; j++)


  {


  outputGrid[i, j] = Vector3.zero;


  for(ki = 0; ki <= NI; ki++)


  {


  for(kj = 0; kj <= NJ; kj++)


  {


  bi = bmath.SplineBlend(ki, TI, knotsI, intervalI);


  bj = bmath.SplineBlend(kj, TJ, knotsJ, intervalJ);

  outputGrid[i, j].x += (controlGrid[ki, kj].x * bi * bj);


  outputGrid[i, j].y += (controlGrid[ki, kj].y * bi * bj);


  outputGrid[i, j].z += (controlGrid[ki, kj].z * bi * bj);


  }


  }


  intervalJ += incrementJ;


  }


  intervalI += incrementI;


  }





  intervalI = 0;


  for(i = 0; i < RESOLUTIONI-1; i++)


  {


  outputGrid[i, RESOLUTIONJ-1] = Vector3.zero;


  for(ki = 0; ki <= NI; ki++)


  {


  bi = bmath.SplineBlend(ki, TI, knotsI, intervalI);


  outputGrid[i, RESOLUTIONJ-1].x += (controlGrid[ki, NJ].x * bi);


  outputGrid[i, RESOLUTIONJ-1].y += (controlGrid[ki, NJ].y * bi);


  outputGrid[i, RESOLUTIONJ-1].z += (controlGrid[ki, NJ].z * bi);


  }


  intervalI += incrementI;


  }


  outputGrid[i, RESOLUTIONJ-1] = controlGrid[NI, NJ];





  intervalJ = 0;


  for(j = 0; j < RESOLUTIONJ-1; j++)


  {


  outputGrid[RESOLUTIONI-1, j] = Vector3.zero;


  for(kj = 0; kj <= NJ; kj++)


  {


bj = bmath.SplineBlend(kj, TJ, knotsJ, intervalJ);


outputGrid[RESOLUTIONI-1, j].x += (controlGrid[NI, kj].x * bj);


outputGrid[RESOLUTIONI-1, j].y += (controlGrid[NI, kj].y * bj);


outputGrid[RESOLUTIONI-1, j].z += (controlGrid[NI, kj].z * bj);

intervalJ += incrementJ;
outputGrid[RESOLUTIONI-1, j] = controlGrid[NI, NJ]; }

[code ][/code ] tags, there is a sticky at the top of the forum on them…

??

http://forum.unity3d.com/threads/using-code-tags-properly.143875/

Parsing error usually mean you have too many or not enough “{” or “}”

BTW It would help a lot if some1 could send a download link to the Correct File for the BSplineSurface.cs script file.

This is very hard for me.

The error will tell you what line the problem is on. What exactly is the error message you are getting?

Count the number of { & compare it to the # of }, a quick count looks wrong (but it’s early here so I could be wrong myself). Also, is the constructor correct?

Don’t take this personally. If you want to copy and paste someone’s code they provided and don’t have the time to go through the code yourself and see you missed about 3 }'s towards the end of the script I’m not sure your quite ready to make video games yet. Go through the code yourself after pasting, format it correctly and you will see what your missing a mile away. Good luck.

Nope didn’t do that. I wrote it myself after looking at it online. What happened is it worked the first time, but then the little script editor thingy didn’t save my work the second time. Then that script up above showed up.

I can’t tell if it is because my cat stepped on my F4 Key [Since I have a Lenovo laptop, the F4 key force closes the current window open.] and closed the window, or if the script editor crashed… or something…

Still… could someone PLEASE write this script as well as BSplineMath script and post a link to a download site for me. I am a beginner… so I kinda might do a bad job on my game. But if someone could post a download, I will post pictures and see what you think of it SO FAR. Very little content, but I will still show pictures.

If you want someone to write your script for you you need to post in the collaboration thread.