HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Adding the extra "\" to make jass work for SFX

08-01-2007, 03:51 AM#1
Immoralis
Whenever I put this into my map, it causes the editor to crash. Its supposed to detect when thers a "\" and then add another. I think its because the "\" causes the rest of the code to comment. Does anyone know how to represent it without causing it to comment?

Collapse JASS:
function JassiflyString takes string taken returns string
    local integer counter = 1
    local string sub = ""
    local string final = ""
    
    loop
    exitwhen
        sub = SubString( taken,counter,counter )
        if (sub == "\" ) then
            set final = SubString( taken,1,counter) + "\"
            set final = SubString( sub,counter+2, StringLength)
        endif
    endloop
    return final
    
endfunction
08-01-2007, 04:12 AM#2
PipeDream
"\\"
Edit: BTW, SFX paths use single \. It's just the JASS lexer which uses \ for control codes and \\ to represent \.
08-01-2007, 04:21 AM#3
Immoralis
hmm map still crashes
08-01-2007, 05:07 AM#4
Vexorian
since you are using the normal editor it could be anything that makes it crash

but:

Collapse JASS:
call effectgiberish("abilities\\spells\\thunderclap.mdl")
should be enough not to crash the editor.

If it is still crashes post the code you are trying to type
08-01-2007, 05:11 AM#5
MaD[Lion]
whatever editor also cause my WE to crash, but its random crash, no reason. It just crash when it wants.

This is a bit off topic btw
08-01-2007, 05:16 AM#6
Immoralis
i did post the code its at the top
08-01-2007, 05:20 AM#7
MaD[Lion]
Collapse JASS:
function JassiflyString takes string taken returns string
    local integer counter = 1
    local string sub = ""
    local string final = ""
    
    loop
    exitwhen
        sub = SubString( taken,counter,counter )
        if (sub == "\\" ) then
            set final = SubString( taken,1,counter) + "\\"
            set final = SubString( sub,counter+2, StringLength)
        endif
    endloop
    return final
    
endfunction

this should work...
Edit: you didnt set an exitwhen condition there. Which will cause an infinite loop and crash
08-01-2007, 06:11 AM#8
Ammorth
Your jass needs to compile with "\\" for a single "\" regardless if it is for a SFX or just a string.
08-01-2007, 06:15 AM#9
DioD
you cant pass path string with single "/" to map, you cant Jassifly string becouse it already passed as "Jassiflyed"