Feedback: golden choice


#1

Hi all! Please, help! Dont understand what wrong… mb bug, mb i stupid))
Seems that everything did right, but write error…

and write error if code likes so

local function makeGoldMap(coins)

end

if i comment “function” then not error…


#2

Problems decide) I delete part comments (table) and error desappear) lvl very interesting=)


#3

Well, it’s kind of hard to tell exactly what the problem is without seeing the code, but the error message is listing quite a lot of different tokens that it could next accept, but ‘/’ is not one of them. So, your error seems to be right where there is a ‘/’ (or just in front of it) but the parser expected something else.


#4

i dont know, but when i removed annotated example table - something like this:
[1,1,1,1,1,1,1,
11,1,1,11,1,1,1
1,1,1,11,1,1,1,1]

error desappear)


#5

It looks weird. I think it could be a problem.


#6

no))) you dont understand))) its no code - its comment for code=)


#7

Was there the lua sample code?


#8

Removing only comments will never fix an error: either they weren’t comments, or you have otherwise changed something besides the comments. (Well, that is always going to be the case for true Python code. There is some extra stuff going on behind the scene in this game and so there could be intermediate problems/bugs that manifest themselves in strange ways.)

Trying to build a list with extra commas such as you showed will indeed throw an error, but I would not expect the error message that this thread started with.

$ python
Python 2.7.5 (default, Mar  9 2014, 22:15:05) 
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> l = [1,2,,3]
  File "<stdin>", line 1
    l = [1,2,,3]
             ^
SyntaxError: invalid syntax
>>>

#9

This dont redact code.

[spoiler]
// Вы должны собрать требуемое количество золота.
// Хранитель врат скажет вам сколько вам нужно.
// Всё время двигаетесь в направлении выхода.
// В каждом ряды вы можете взять лишь одну монету.
// Выберите только одну из ближайших монет в слудующем ряду.

// Дистанция между рядами и монетками.
local distanceX = 4;
local distanceY = 6;
local zeroPoint = {x: 14, y: 14};
local coinLines = 10;

local function makeGoldMap(coins) {
local template = [];
for (var i = 0; i < coinLines; i++) {
template[i] = [];
for (var j = 0; j < 2 * coinLines - 1; j++) {
template[i][j] = 0;
}
}
for (var c = 0; c < coins.length; c++) {
local row = Math.floor((coins[c].pos.y - zeroPoint.y) / distanceY);
local col = Math.floor((coins[c].pos.x - zeroPoint.x) / distanceX);
template[row][col] = coins[c].value;
}
return template;
}

// Подготовьте карту золота. Она выглядит так:
// [[1, 0, 9, 0, 4],
// [0, 1, 0, 9, 0],
// [8, 0, 2, 0, 9]]
var goldMap = makeGoldMap(hero.findItems());

// Найдите ваш путь. [/spoiler]


#10

@GAIGAL Can you be a bit more specific about why you are posting that code sample? Do you need help with it? Are you demonstrating a bug in the level? Something else?


#11

I dont know bug is or not, but on this part code an error occurred while I did not delete this part-

–// Подготовьте карту золота. Она выглядит так:
–// [[1, 0, 9, 0, 4],
–// [0, 1, 0, 9, 0],
–// [8, 0, 2, 0, 9]]

but guys writes, that its impossible.


#12

Oh I see, thanks for explaining!

It seems this level lacks the starting code for Lua. When I try to play this level in Lua, I get the starting code in JavaScript.

Note that comments in Lua begin with --, unlike JavaScript comments which begin with //.

It is a syntax error if you have // in your Lua code, they should be --. Was that the problem?


#13

No, in fact of the matter) I play on lua and first thing was commented all and rewrite all. But in this time in this comment arose error:
–// Подготовьте карту золота. Она выглядит так:
–// [[1, 0, 9, 0, 4],
–// [0, 1, 0, 9, 0],
–// [8, 0, 2, 0, 9]]
until i delete it.