Skip to main content
gamedev.net
🔒 Locked 🎮 Unity

i got a small peice of beginner JS script and getting a build error, need some help

Started by scrap 1 reply 900+ views
Original Post
scrap
scrap
function Update ()
{
/*
var ammoBoxInt : int = 10;
var ammoBoxFloat : float = 5.567;
var ammoBoxString : String = "amoBox";
var ammoBoxBoolean : boolean = true;

print (ammoBoxInt);
print(ammoBoxFloat);
print(ammoBoxString);
print(ammoBoxBoolean);
*/

var inventory = Array ("spellBook", 23, 10.56,"ammo");
print (inventory);
var inventoryBooks = inventory(0);
print(inventoryBooks);
}

aight heres my code, the top part is commented out just for current teaching reasons for my self. the bottom part gets an error at line var inventoryBooks = inventory(0); not sure why i cant print out that part of an array, i just did as the tutoriol said and iv changed it a thousand times and i cant seem to figure it out!

any help please thanks guys!
Oberon_Command
Oberon_Command
Shouldn't that be inventory[0], not inventory(0)?
saejox
saejox
What ide/browser do you use?

All have consoles that outputs any error,
Chrome has "Developer Tools" Shift+Alt+I
Firefox has an excellent ad-don FireBug.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.