Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

[XP] This error doesn't make sense!!!

Okay, I was getting a syntax error for a the first line of this array in a quest log script:

Code:
  @description[2] = ("Upon reaching Sundi, I spoke with the village's", 
                    "Elder. Apparently, a young man has been taken in", 
                    "after surviving an attack by the very raiders I have", 
                    "been chasing. I am curious to see if he knows anything.", 
                    "The mere fact that he survived an attack intrigues me.", 
                    "Only the most skilled fighters can manage that...",
                    "...Unless one is incredibly lucky.')

Well, I couldn't figure out for the life of me what was wrong with it, so just because I needed to try SOMETHING, I changed the first line so that it used single quotes instead of double quotes.... and it worked. This error happens with the first line of all of these arrays... and I don't get it.

Now, this wouldn't be a big deal if it weren't for the fact that - obviously - that line needs an appostrophy in 'villiage's', which would count as a single quote.

....Anybody know why this is happening? It's really irritating. The script was working just fine before, and there was even a quest in it using those double-quotes.
 
ummm...is that supposed to be an array declaration? because I've never seen that way to declare arrays before and I just tested and it didn't work...
An array declaration goes with [] not with ().
Also you forgot to change the last quote in the last line.

Later!
 
I changed that, but I'm still getting the error with the double-quotes. It's only for the first line with the array name and the first string. (The () were working somehow, but I changed it and it didn't fix the problem)
 
Code:
@description = []
@description[2] = ["Upon reaching Sundi, I spoke with the village's", 
                    "Elder. Apparently, a young man has been taken in", 
                    "after surviving an attack by the very raiders I have", 
                    "been chasing. I am curious to see if he knows anything.", 
                    "The mere fact that he survived an attack intrigues me.", 
                    "Only the most skilled fighters can manage that...",
                    "...Unless one is incredibly lucky."]

That worked fine for me
 
Here's the script. It's initialized in the class.

Code:
#-------------------------------------------------------------------------------
# This class holds all the data for the quests.
# If you want a new quest, add it in here.
# This is the class name. If you add another list, you need a different class name.
# It's a good idea to just use Quest_Data2/3/4/5/6/etc...
class Quest_Data
  attr_accessor :description, :questname, :objectives,
				:useoutlines, :descoutline, :desctext, :incompoutline, 
				:incomptext, :compoutline, :comptext, :menuoutline,
				:menutext, :backpicture
  def initialize
	@questname = []
	@description = []
	@objectives = []
	for i in 0...10000
	  @description[i] = []
	  @objectives[i] = []
	end
# These are options you can change:
# These control the colors of the text.
# The code for this is:
# Color.new(Amount of Red, Amount of Green, Amount of Blue, Opacity)
# Each of these can be set from 0-255, 255 being the highest.
@useoutlines = true# Set to false if you don't want the text to have an outline
@descoutline = Color.new (0, 0, 0, 255)# Outline color for description text
@desctext = Color.new (255, 255, 255, 255)# Text color for description text
@incompoutline = Color.new(0, 0, 0, 255)# Outline color for incomplete objectives
@incomptext = Color.new(255, 0, 0, 255)# Text color for incomplete objectives
@compoutline = Color.new(0, 0, 0, 255)# Outline color for completed objectives
@comptext = Color.new(0, 255, 0, 255)# Text color for completed objectives
@menuoutline = Color.new(0, 0, 0, 255)# Outline color the in progress list
@menutext = Color.new(255, 255, 255, 255)# Text color for the in progress list
#-------------------------------------------------------------------------------
# This is the filename of the background picture for quests in progress:
@backpicture = "InProgressQuestList-red"
# It needs to be placed in the Graphics/Pictures folder.
#-------------------------------------------------------------------------------
# This is the data that is displayed when there are no quests active.
# I'll be using it to explain how to set up a quest, too:
	@questname[0] = "No Quests" # This will be the name of your quest.
#   This is the description for the quest. The format is:
#   @description[quest number] = ["line 1", "line 2", "line 3", "etc..."]
#   Note that if you have too many lines of description you can run out of room
#   for objectives.
	@description[0] = ["I am not currently on any quests."]
#   The format is the same for @objectives if the quest has any.
#-------------------------------------------------------------------------------
	# Quest 1
	@questname[1] = "Break the Cycle"
	@description[1] = ["I've been wandering through this forest chasing", 
                    "a group of raiders on horseback. I've eliminated", 
                    "several of them already, but I know this is just a", 
                    "small portion of their army. I need to reach the", 
                    "village to the east of here; perhaps they can give me", 
                    "more information.", " ", 
                    "I've been chasing them for two years now...", 
                    "It almost seems hopeless, but I'm not about to quit."]
	@objectives[1] = []
  #Quest 2
  @questname[2] = "Interest"
  @description[2] = ['Upon reaching Sundi, I spoke with the village's", 
                    "Elder. Apparently, a young man has been taken in", 
                    "after surviving an attack by the very raiders I have", 
                    "been chasing. I am curious to see if he knows anything.", 
                    "The mere fact that he survived an attack intrigues me.", 
                    "Only the most skilled fighters can manage that...",
                    "...Unless one is incredibly lucky."]
   end
end
 
Well I don't see anything wrong with it... are you sure it gives you syntax error? Could you post the error message?
And btw, theres not need to initialize the description's and objectives' arrays' arrays, I'm talking about this part:
Code:
for i in 0...10000
	  @description[i] = []
	  @objectives[i] = []
	end
That's unnecesary, you can delete that if you want.

Later

EDIT

...
where are you "fixing" the code? outside rpg maker or what? There's still a single quote in the BEGINNING of @description[2], but it's fixed in your 1st post...
 
It's not my script, so I don't want to mess with it. There's another section to it too... I don't really know if that has something to do with it.

The error says:

'Script 'QuestLog' line 61: syntax error occured'

...I have this problem with programming C++ as well. At one point I had to put like... 3 ";"s at the end of a line for no reason, or it wouldn't work.
 
When it's a syntax error, it basically means you have been structuring your code in a way that RGSS doesn't support.
Unless you did change the last part from "text' to "text", then I don't see what the error could be. By having "text', the string doesn't close, meaning the ] is included, and the array doesn't close.

When I tried the code in the first post, just with that fix and [], it didn't give me any errors.
Is line 61 this line? If you have fixed the base syntax errors pointed out, it shouldn't be. If it is, please repost the block so we can have a look if something was done wrong.
 
Okay, this is the entire section of code in my editor. I've indicated line 61 - the line with the error - and line 71, which is where the next error occurs if I change line 61 to have single quotes. Like I said, this wouldn't be a problem, but my string has an apostrophy in it.

Code:
#-------------------------------------------------------------------------------
# This class holds all the data for the quests.
# If you want a new quest, add it in here.
# This is the class name. If you add another list, you need a different class name.
# It's a good idea to just use Quest_Data2/3/4/5/6/etc...
class Quest_Data
  attr_accessor :description, :questname, :objectives,
				:useoutlines, :descoutline, :desctext, :incompoutline, 
				:incomptext, :compoutline, :comptext, :menuoutline,
				:menutext, :backpicture
  def initialize
	@questname = []
	@description = []
	@objectives = []
	for i in 0...10000
	  @description[i] = []
	  @objectives[i] = []
	end
# These are options you can change:
# These control the colors of the text.
# The code for this is:
# Color.new(Amount of Red, Amount of Green, Amount of Blue, Opacity)
# Each of these can be set from 0-255, 255 being the highest.
@useoutlines = true# Set to false if you don't want the text to have an outline
@descoutline = Color.new (0, 0, 0, 255)# Outline color for description text
@desctext = Color.new (255, 255, 255, 255)# Text color for description text
@incompoutline = Color.new(0, 0, 0, 255)# Outline color for incomplete objectives
@incomptext = Color.new(255, 0, 0, 255)# Text color for incomplete objectives
@compoutline = Color.new(0, 0, 0, 255)# Outline color for completed objectives
@comptext = Color.new(0, 255, 0, 255)# Text color for completed objectives
@menuoutline = Color.new(0, 0, 0, 255)# Outline color the in progress list
@menutext = Color.new(255, 255, 255, 255)# Text color for the in progress list
#-------------------------------------------------------------------------------
# This is the filename of the background picture for quests in progress:
@backpicture = "InProgressQuestList-red"
# It needs to be placed in the Graphics/Pictures folder.
#-------------------------------------------------------------------------------
# This is the data that is displayed when there are no quests active.
# I'll be using it to explain how to set up a quest, too:
	@questname[0] = "No Quests" # This will be the name of your quest.
#   This is the description for the quest. The format is:
#   @description[quest number] = ["line 1", "line 2", "line 3", "etc..."]
#   Note that if you have too many lines of description you can run out of room
#   for objectives.
	@description[0] = ["I am not currently on any quests."]
#   The format is the same for @objectives if the quest has any.
#-------------------------------------------------------------------------------
	# Quest 1
	@questname[1] = "Break the Cycle"
	@description[1] = ["I've been wandering through this forest chasing", 
                    "a group of raiders on horseback. I've eliminated", 
                    "several of them already, but I know this is just a", 
                    "small portion of their army. I need to reach the", 
                    "village to the east of here; perhaps they can give me", 
                    "more information.", " ", 
                  "I've been chasing them for two years now...", 
                    "It almost seems hopeless, but I'm not about to quit."]
  @objectives[1] = []
  #Quest 2
  @questname[2] = "Interest"
61: @description[2] = ['Upon reaching Sundi, I spoke with the village's",[/b] 
                    "Elder. Apparently, a young man has been taken in", 
                    "after surviving an attack by the very raiders I have", 
                    "been chasing. I am curious to see if he knows anything.", 
                    "The mere fact that he survived an attack intrigues me.", 
                    "Only the most skilled fighters can manage that...",
                    "...Unless one is incredibly lucky."]
  @objectives[] = []
	#Quest 3
  @questname[3] = "Diplomacy?"
71: @description[3] = ["We need a horse to get over the blockade in the road", 
                    "to the north, but the girl who is supposed to sell us", 
                    "one - not that we could afford it - won't even speak", 
                    "to anyone. We need to find a way to coax her into",
                    "telling us what her problem is. Perhaps we could aid",
                    "her..."]
  @objectives[3] = []
  #Quest 4
  @questname[4] = "Sunfire"
  @description[4] = ["Well, we've finally found a use for Ares in the form"
                    "of his... erm... 'boyish charm', if it can be called",
                    "that. Now we know that Lilly's distress is caused by",
                    "the disappearance of her beloved horse, Sunfire.",
                    "She has claimed that the animal is unmistakable in",
                    "appearance and is probably not located anywhere in",
                    "Sundi. I believe the proper course of action is clear.",
                    "Here's hoping that this will prove beneficial to us."]
  @objectives[4] = ["-Locate Sundfire the horse", 
                    "-Return Sunfire to Lilly in Sundi Stables"]
  #Quest 5
  @questname[5] = "A Special Request"
  @description[5] = ["We have received a request to retrieve an item from",
                    "Sundi Inn with the promise of a reward."]
  @objectives[5] = ["-Speak to the Innkeeper about the request",
                    "-Retrieve the item from a chest in the indicated room",
                    "-Return the item to its owner near the Elder's home"]
  #Quest 6
  
  #Quest 6
  @questname[6] = "The Mysterious Refugee"
  @desciption[6] = ["While heading north, we were confronted by a large",
                    "group of raiders demanding that we hand Ares over to",
                    "them. While Orealis had foreseen that this would",
                    "happen and probably will continue to happen, I just",
                    "don't feel that it is right to hand the poor boy over", 
                    "to such evil. I suppose I still have some of my father's",
                    "selflessness and generousity within me, though I",
                    "consider it a weakness now days...", " ", 
                    "In any case, I want to know more about this boy. He",
                    "doesn't seem to remember anything about his past",
                    "Perhaps that will change. Only time will tell."]
  @objectives[6] = []
  #Quest 7
  @questname[7] = "Wolf Den"
  @description[7] = ["We've reached the easter coast just north of Sundi",
                    "and already we've made an interesting discovery. On", 
                    "the shoreline there is a large stone outcropping, and", 
                    "near the base is a cave. Within the cave is a pack of",
                    "wolves. As if this wasn't strange enough, we were not",
                    "attacked or even warded off upon entering the cave; it",
                    "was as if we were trusted completely... Orealis has",
                    "stated that he's never been attacked in all of his",
                    "years spent in the forests. It's all very odd.",
                    "Perhaps someone in the port city of Venell knows",
                    "something about this."]
  @objectives[7] = []
  end
end

As you can see, the error doesn't happen with @descriptions[0] and [1], only the ones I added... which don't look any different, as far as I can tell.
 
61 has a very obvious syntax error, because you see the 's' after the first apostrophe as black. It's because the string was opened with aan apostrophe (single-quote). So this code should be:
Code:
@description[2] = ["Upon reaching Sundi, I spoke with the village's",
                    "Elder. Apparently, a young man has been taken in", 
                    "after surviving an attack by the very raiders I have", 
                    "been chasing. I am curious to see if he knows anything.", 
                    "The mere fact that he survived an attack intrigues me.", 
                    "Only the most skilled fighters can manage that...",
                    "...Unless one is incredibly lucky."]
The 0 and 1 descriptions are perfectly fine and don't have this error. Simple defintion: If you start with a single-quote, end with a single-quote and vice versa for double-quotes.

Now what appears to be the problem at line 71? I don't get any errors for that.
 
All right... I think it's finally working. It didn't look that way at first; that was just because I was messing with it. I guess each time I did an edit I missed SOMETHING.

So, hopefully I can just fix up the rest without ripping my hair out. ^_^ Thanks you guys. I appreciate the help. (I'm visually impared, so I tend to miss little things every so often. Heh...)
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top