strange syntax error

General talk about editing, cheating, and deprotecting maps.

Moderator: Cheaters

User avatar
itsonlyaname
Senior Member
Posts: 195
Joined: February 13th, 2008, 5:30 pm

strange syntax error

Post by itsonlyaname »

hi, i 'finaly' registered :lol:, while editing a script with jasscraft i found 2 "syntax error's" - 'non valid escape sequences in string'

the code is part of the save/load system, so i cant change it, else it wont work anymore.
the error makes the map unable to start (like every error in the script) tough, the war3map.j is extracted right after i used x-dep. is it possible the script got 'corrupted' by that ?

this is one of the triggers wich gives a error: (it seems to be the "\f" part)
Spoiler:
function AsciiCharToInteger takes string char returns integer
local string charMap=" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"
local string u=SubString(char,0,1)
local string c
local integer i=0
if u=="" or u==null then
return 0
elseif u=="\b" then
return 8
elseif u=="\t" then
return 9
elseif u=="\n" then
return 10
elseif u=="\f" then
return 12
elseif u=="\r" then
return 13
endif
loop
set c=SubString(charMap,i,i+1)
exitwhen c==""
if c==u then
return i+32
endif
set i=i+1
endloop
return 0
endfunction
User avatar
JJ2197
Legendary Genius
Posts: 1311
Joined: August 8th, 2007, 8:10 am
Title: Legendary Genius²
Location: St. George Utah

Re: strange syntax error

Post by JJ2197 »

I'm not totally sure but I think you can't use \ in a string... not sure why?
Computer Specs:
Motherboard: GA-990FXA-UD3
CPU: FX-8350 @ 4.0GHz
PSU: Corsair CX500
RAM: G.Skill Ripjaws X 8GB @ 1866
GPU: Radeon HD 4870 1GB
HDD: OCZ Vertex series 30GB SSD
Case: Antec 900
Monitor: Toshiba 32"
OS: Windows 7 Ultimate
User avatar
Aero
Forum Staff
Posts: 829
Joined: January 28th, 2007, 8:10 pm
Title: JASS Programmer
Location: Canada

Re: strange syntax error

Post by Aero »

When indicating paths in jass (For example Units\Orc\SomeHeroSkin.blp), two '\' are used (Therefore it would be "Units\\Orc\\SomeHeroSkin.blp" in jass)
This is what the syntax error is referring to.

I havn't tested it personally but I don't see why it wouldn't work in an actual game.
I would ignore it.
User avatar
itsonlyaname
Senior Member
Posts: 195
Joined: February 13th, 2008, 5:30 pm

Re: strange syntax error

Post by itsonlyaname »

the code is to prevent having a '\' and any of 'b t n f r' next to eachother, becous if wc3 would show that string as text on the screen, it would be converted. like \n = new line
(the checks for \b \t \n \r all work fine tough.)

i think it's jasscraft that shows the error on the wrong line (like, i knowingly made a error on line 4857, and jasscraft sad the error was on line 3486.
i'll try it with a other jass editing program when i have some time.
User avatar
Aero
Forum Staff
Posts: 829
Joined: January 28th, 2007, 8:10 pm
Title: JASS Programmer
Location: Canada

Re: strange syntax error

Post by Aero »

That's not correct. \n is not new line. |n is new line.

A pipe is used to indicate similar string manipulations not backslashes.
User avatar
itsonlyaname
Senior Member
Posts: 195
Joined: February 13th, 2008, 5:30 pm

Re: strange syntax error

Post by itsonlyaname »

ah, ok :lol:

i tried again, the map works online tough after deprotection (with x-dep) the script gives a error -while xdep says 'OK' on everything-
and, indeed "\f" as a string gives a error, while "\b" doesn't . . . strange

(it's this map: http://www.epicwar.com/maps/41180/ )
User avatar
Aero
Forum Staff
Posts: 829
Joined: January 28th, 2007, 8:10 pm
Title: JASS Programmer
Location: Canada

Re: strange syntax error

Post by Aero »

You could try concatenation.

Instead of saying "\f" try "\" + "f".

I wouldnt imagine that ever giving an error.
User avatar
itsonlyaname
Senior Member
Posts: 195
Joined: February 13th, 2008, 5:30 pm

Re: strange syntax error

Post by itsonlyaname »

ive tried that - wich is even stranger
in this:
"\ " text
the 'text' is normal color (white)

in this:
"\" text
the 'text' is blue - like a string

both make the line that's next to it give errors . .
however, if itestse set a string "\\" and then take the first character out as a substring it works fine.

ive looked to other scripts using backslashes and they always use double or this: "\"f" (wich doesn't give errors)
it seems to me that backslash needs a extra " to close it or something :?

and, why would it only give a error with \f while \b works fine ?

edit: tested ingame, using either substring or "\"f" makes the ingame 'player list' (where u can set comp players & such) disepear while there isn't a error in jass.
and "\" + "f" gives errors lol ; see image:
Image
the f seems to be no part of the string.
Last edited by itsonlyaname on February 15th, 2008, 11:23 pm, edited 1 time in total.
User avatar
Aero
Forum Staff
Posts: 829
Joined: January 28th, 2007, 8:10 pm
Title: JASS Programmer
Location: Canada

Re: strange syntax error

Post by Aero »

Beats me.
But it seems like it's not longer an issue so all's good.
User avatar
itsonlyaname
Senior Member
Posts: 195
Joined: February 13th, 2008, 5:30 pm

Re: strange syntax error

Post by itsonlyaname »

shal i post it in the request section then ? (or come on chat :) )