error line(6): Variable '[' is already defined.

Started by Joseph DiPerla, Wed 14/09/2005 00:57:33

Previous topic - Next topic

Joseph DiPerla

This is the code: function room_a() {
  // script for Room: First time player enters screen
Character[cHomer].Think("What am I going to do?");
 
}

And the topic is the error I get. Sounds newbieish. What am I doing wrong?
Joseph DiPerla--- http://www.adventurestockpile.com
Play my Star Wars MMORPG: http://sw-bfs.com
See my Fiverr page for translation and other services: https://www.fiverr.com/josephdiperla
Google Plus Adventure Community: https://plus.google.com/communities/116504865864458899575

Joseph DiPerla

You know what... I just figured out. I feel like an idiot. The script language changed and I have to the new scripting, which makes the script into : cHomer.Think. Sorry. You could delete.
Joseph DiPerla--- http://www.adventurestockpile.com
Play my Star Wars MMORPG: http://sw-bfs.com
See my Fiverr page for translation and other services: https://www.fiverr.com/josephdiperla
Google Plus Adventure Community: https://plus.google.com/communities/116504865864458899575

monkey0506

You don't have to use cHomer.Think... you could do Character[cHomer.ID].Think if you really wanted to. :=

strazer

Actually, I think it would be character[cHomer.ID] or character[HOMER]. But of course the cHomer shortcut is much nicer.

Joseph DiPerla

Actually Monkey, I tried those, and thats what also gave me this error for some reason.
Joseph DiPerla--- http://www.adventurestockpile.com
Play my Star Wars MMORPG: http://sw-bfs.com
See my Fiverr page for translation and other services: https://www.fiverr.com/josephdiperla
Google Plus Adventure Community: https://plus.google.com/communities/116504865864458899575

Gilbert

Use cHomer as recommended by many then, it should work.

Ishmael

I used to make games but then I took an IRC in the knee.

<Calin> Ishmael looks awesome all the time
\( Ö)/ ¬(Ö ) | Ja minähän en keskellä kirkasta päivää lähden minnekään juoksentelemaan ilman housuja.

monkey0506

Quote from: Joseph DiPerla on Thu 15/09/2005 03:35:09
Actually Monkey, I tried those, and thats what also gave me this error for some reason.

Well that's because I accidentally used a 'C' instead of a 'c', as strazer pointed out.  "Character" should be used when defining a pointer, i.e., Character *chara = Character.GetAtScreenXY(mouse.x, mouse.y).  "character" is the globally defined array of all the characters in the game.

Joseph DiPerla

I was using AGS 2.71 beta 4. I got it working now. Like I said, I dropped the Character[cHomer].Think to cHomer. Think and it worked.
Joseph DiPerla--- http://www.adventurestockpile.com
Play my Star Wars MMORPG: http://sw-bfs.com
See my Fiverr page for translation and other services: https://www.fiverr.com/josephdiperla
Google Plus Adventure Community: https://plus.google.com/communities/116504865864458899575

SMF spam blocked by CleanTalk