Missing "}"? But I'm Looking Right At It!

Eorzea Time
 
 
 
言語: JP EN FR DE
日本語版のFFXIVPRO利用したい場合は、上記の"JP"を設定して、又はjp.ffxivpro.comを直接に利用してもいいです
users online
フォーラム » Windower » Support » Missing "}"? But I'm looking right at it!
Missing "}"? But I'm looking right at it!
Offline
Posts: 250
By oyama 2014-09-25 13:23:10  
I just started with gearswap, I haven't used it at all before (not even other people's files), and this is my first attempt at writing a custom lua. I want to keep it really simple. So I started writing out some sets and functions, and I went to go test out a CDC precast followed with a generic aftercast. Before I even got the chance, when everything loaded up the console gave an error in my BLU.lua user file at line 13.
Here is my BLU.lua file up to the line that is reported as having an error (the lines are showing up at line+1 in this post for some reason, so line 8 here corresponds to line 7 in my file):
Code
function get_sets()

	--Precast Sets	
	
	sets.precast = {}

	sets.precast['Chant du Cygne'] = {ammo="Jukukik Feather", head="Uk'uxkaj cap", neck="Light Gorget", ear1="Thunder Pearl", ear2="Brutal Earring", 
	body="Assimilator's Jubbah +1", hands="Buremte gloves", ring1="Epona's ring", ring2="Rajas Ring", 
	back="Rancorous mantle", waist="Windbuffet belt", legs="Manibozho brais", feet="Assimilator's Charuqs +1"}
	
	sets.precast.FC = {}
	
	sets.precast.BlueFC = {body="Mavi Mintan +2"}


The error says there is an "}" expected (to close "{" at line 7), near 'back.' But I'm looking right at it, there's a "}" in line 9 after my feet gear that closes the "{" at line 7. What gives?
 Bahamut.Milamber
Offline
サーバ: Bahamut
Game: FFXI
user: milamber
Posts: 3691
By Bahamut.Milamber 2014-09-25 13:27:17  
oyama said: »
I just started with gearswap, I haven't used it at all before (not even other people's files), and this is my first attempt at writing a custom lua. I want to keep it really simple. So I started writing out some sets and functions, and I went to go test out a CDC precast followed with a generic aftercast. Before I even got the chance, when everything loaded up the console gave an error in my BLU.lua user file at line 13.
Here is my BLU.lua file up to the line that is reported as having an error:
Code
function get_sets()

	--Precast Sets	
	
	sets.precast = {}

	sets.precast['Chant du Cygne'] = {ammo="Jukukik Feather", head="Uk'uxkaj cap", neck="Light Gorget", ear1="Thunder Pearl", ear2="Brutal Earring", 
	body="Assimilator's Jubbah +1", hands="Buremte gloves", ring1="Epona's ring", ring2="Rajas Ring", 
	back="Rancorous mantle", waist="Windbuffet belt", legs="Manibozho brais", feet="Assimilator's Charuqs +1"}
	
	sets.precast.FC = {}
	
	sets.precast.BlueFC = {body="Mavi Mintan +2"}


The error says there is an "}" expected (to close "{" at line 7), near 'back.' But I'm looking right at it, there's a "}" in line 9 after my feet gear that closes the "{" at line 7. What gives?
Not really a gearswap expert, but:
Possibly a weird line termination? Try having line 9 continue on line 8 (e.g. place cursor after ',' in line 8, and hit delete until line 9 is on line 8). Give that a shot, at least it won't take much to try.
*edit* Generally, parsing errors like that may mean that something unrelated may be wrong. Try using an empty set (e.g. {}) and see if the problem goes away; if not then your issue is with something else you have done.
Offline
Posts: 250
By oyama 2014-09-25 13:31:21  
Yea I thought the same thing and tried that, didn't work. Plus, the error doesn't show up until line 13, and I create a separate empty set between line 7 and 13 with apparently no issue.
 Fenrir.Mariane
Offline
サーバ: Fenrir
Game: FFXI
user: leo
Posts: 1766
By Fenrir.Mariane 2014-09-25 13:32:35  
Some text editors can be programmed to highlight language syntax using a sort of macro sign language.

A good example is Notepad++. It would let you know easily which bracket is misplaced.
[+]
Offline
Posts: 250
By oyama 2014-09-25 13:35:58  
Yea I wrote it in Notepad++, using Lua as the language, and it's not showing any errors, at leas that I can tell.
 Bahamut.Milamber
Offline
サーバ: Bahamut
Game: FFXI
user: milamber
Posts: 3691
By Bahamut.Milamber 2014-09-25 13:38:47  
Is line 5 valid when using it as you do in line 7?
Offline
Posts: 250
By oyama 2014-09-25 13:43:22  
Well it doesn't return an error. The first and only error reported on the console in game is on line 13, where it wants a "}", though I don't know where it wants it. Line 5 just creates the table sets.precast, cuz I read in the tutorial that you have to make sure the table exists before using it to make sub tables, such as gear sets.
 Bahamut.Milamber
Offline
サーバ: Bahamut
Game: FFXI
user: milamber
Posts: 3691
By Bahamut.Milamber 2014-09-25 13:47:36  
oyama said: »
Well it doesn't return an error. The first and only error reported on the console in game is on line 13, where it wants a "}", though I don't know where it wants it. Line 5 just creates the table sets.precast, cuz I read in the tutorial that you have to make sure the table exists before using it to make sub tables, such as gear sets.
If
Code
sets.precast['Chant du Cygne'] = {}

still gives you an error, then try
Code
--sets.precast['Chant du Cygne'] = {}

If that removes the error, then place your code back to the original, and try
Code
--sets.precast = {}
 Phoenix.Craptaculous
Offline
サーバ: Phoenix
Game: FFXI
Posts: 57
By Phoenix.Craptaculous 2014-09-25 13:50:43  
just a thought, but do you have a CR/LF after the last line?

If that is your .lua exactly, line for line, it could be be being odd since you don't have a line end at the end of the last line.

Short/easy version: Press enter after the last line:
-------------------
sets.precast.BlueFC = {body="Mavi Mintan +2"}

-------------------

Some coding languages get weird with command when you don't have a CR/LF (enter) after them.
 Cerberus.Spirachub
Offline
サーバ: Cerberus
Game: FFXI
user: Spiraboo
Posts: 516
By Cerberus.Spirachub 2014-09-25 13:54:18  
that can't be the entirety of his GS, or he's missing a end for his function.

If you are really clueless, there's a mundane way of figuring it out: comment out everything until it stops complaining (like an empty function if you're that stuck), and just keep pasting back each line. Do what Milamber suggested if you got to your CDC line and it's throwing out errors, and if it compiles with an empty set, add your gear back in your CDC set piece by piece.
Offline
Posts: 250
By oyama 2014-09-25 13:55:35  
Code
I tried adding sets.precast['Chant du Cygne'] = {}

before the actual gearset itself, and it still gives the same error. I tried commenting it out, same error. I forgot to mention, though, every time I try to save the .lua file in notepad++, it says the save failed and to check if file is open in another program, but when I close it and reopen it, the changes have been saved. Before, I tried shutting down the game and then making the changes with FFXI off but it still says the save failed and to check to see if program is open in another program, and still saves the changes anyway. Is it possible that the file's changes have not been saved this whole time and it's just giving me the saved changes back because it has them stored for next time I open notepad++?
Offline
Posts: 250
By oyama 2014-09-25 13:59:12  
This is the entirety of the lua file:
Code
function get_sets()

	--Precast Sets	
	
	sets.precast = {}

	sets.precast['Chant du Cygne'] = {}
	
	sets.precast['Chant du Cygne'] = {ammo="Jukukik Feather", head="Uk'uxkaj cap", neck="Light Gorget", ear1="Thunder Pearl", ear2="Brutal Earring", body="Assimilator's Jubbah +1", hands="Buremte gloves", ring1="Epona's ring", ring2="Rajas Ring", back="Rancorous mantle", waist="Windbuffet belt", legs="Manibozho brais", feet="Assimilator's Charuqs +1"}
	
	sets.precast.FC = {}
	
	sets.precast.BlueFC = {body="Mavi Mintan +2"}

	sets.precast.Diffusion = {}

	sets.precast.CA = {feet="Assimilator's Charuqs +1", head="Mavi Kavuk+2"}

	sets.precast.MagicAcc = {neck="Stoicheion medal"}

	--Aftercast sets

	sets.aftercast = {}

	sets.aftercast.TP = {}	

	sets.aftercast.TP.DD = {ammo="Honed Tathlum", head="Whirlpool Mask", neck="Asperity Necklace", ear1="Suppanomimi", ear2="Brutal Earring",
	body="Qaaxo Harness", hands="Qaaxo Mitaines", ring1="Epona's ring", ring2="Rajas Ring",
	back="Atheling Mantle", waist="Windbuffet belt", legs="Manibozho brais", feet="Qaaxo Leggings"} 
	
	sets.aftercast.TP = sets.aftercast.TP.DD

end

function precast(spell)
	if sets.precast[spell.english] then
	equip(sets.precast.[spell.english])
	end
end

function aftercast(spell)
	equip(sets.aftercast.TP)
	end
	
	


I just put in the precast and aftercast functions to test out the CDC gearswap. The whole thing is still in progress but I just wanted to test out the CDC thing cuz it would be easy and CDC and TP sets were finished.
Offline
Posts: 250
By oyama 2014-09-25 14:08:28  
Wow, I just commented out every single line in the entire file and when I //gs r it gave the exact same error. It obviously has not been saving changes or something. Closed FFXI and restarting computer and gonna see what I can do then.
 Asura.Isiolia
Offline
サーバ: Asura
Game: FFXI
user: Isiolia
Posts: 455
By Asura.Isiolia 2014-09-25 14:16:52  
I would double check that Notepad++ is working with the same copy of the file as Gearswap is even looking at. I've had it "reopen" files from the old location before, which led to the same kind of hair-pulling frustration.
 Fenrir.Deiago
Offline
サーバ: Fenrir
Game: FFXI
user: Deiago
Posts: 6
By Fenrir.Deiago 2014-09-25 14:21:56  
If there is a possibility it isn't saving your changes, try intentionally putting an error in above that. Like take out a curly brace.
OR...
You could try saving you lua file to your desktop with the changes noted above, then delete the one that is in your windower file (windower/addons/gearswap/library... i think). Then put your newly saved file back into the windower folder where they usually go and try to reload.
[+]
 Lakshmi.Zerowone
Offline
サーバ: Lakshmi
Game: FFXI
user: Zerowone
Posts: 6949
By Lakshmi.Zerowone 2014-09-25 14:28:03  
Sounds like version control. Are you sure the updated file is in the correct directory?

You might be saving it to desktop and not in the data folder.
Offline
Posts: 250
By oyama 2014-09-25 14:39:35  
Yep, I had 2 copies of BLU.lua, one in GS's data folder and one in a regular document folder on my computer where I was going to store copies of any luas I made. When I deleted the BLU.lua from data, I no longer got the "save failed, check to see if file is open in another program" message when trying to save it in notepad++. Now it's telling me that I don't have permission to save it in the data folder, and to contact the administrator to get permission >_<. GDI I am the administrator! Cutting and pasting the file doesn't work, gives the same save failed message when I try to save it.
 Bahamut.Milamber
Offline
サーバ: Bahamut
Game: FFXI
user: milamber
Posts: 3691
By Bahamut.Milamber 2014-09-25 14:59:47  
Right click on icon prior to starting notepad++, select run as administrator.
Offline
Posts: 250
By oyama 2014-09-25 15:11:57  
Oh, didn't know about that, thanks! I got around it by copying and pasting the file to GS data folder from my regular document folder, and then deleting the original from the document folder, lol.
Offline
Posts: 250
By oyama 2014-09-25 15:26:17  
Yep, ok got it to work. The error was actually a missing comma after "Rajas ring", which I already knew about cuz I caught it the first time GS gave an error, and I fixed it. Problem was the fix wasn't ever saved to the correct version of the file. So now I managed to save the fix in the correct file and it works fine now. Thank you all for your help, much appreciated!