How to add a script to my script ?

I mean… Someone told me that I should put a boolean to my script, so it would work as I want, but I don’t know how (I’m very noob, yes).
This is my script:

var nextLevel : String;


function OnTriggerEnter() {


    Application.LoadLevel (0);



He told me to put this boolean to my script:

var hasBook : boolean;
var pos2 : GameObject;
function OnTriggerEnter (other : Collider)
      player.transform.position = pos2.transform.position

Can you made the script for me ? Please don’t tell me to learn how to code first, I’m making a SIMPLE game and I want to finish it as soon as possible.

boolean is a true/false statement

so on line 6 it is saying :

if hasbook (your key) is “true” do this.

from what i understand, you have a portal and a player that will enter the portal

if so, you should do something like this :

on the script from the player add :

static var hasBook : boolean;

then on line 6 of your portal script instead of if (hasbook) you put :

if(player.hasBook == true)
// do something

“player” should be the script name on you player

then on the book (key) script you should add :

player.hasBook = true;

probably in the ontrigger function.

the “static” in front of the var hasBook makes it accessible from other scripts.