HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

PJASS - blizzard.j Error

07-31-2009, 11:38 PM#1
TGhost
Hi there,

I recently tried getting back into JASS, so I have started creating some basic spells. Of course I am now using the JNGP, which has been working flawelessly. Until now. I wanted to create a spell that periodically moved a projectile, but since the fixing of the infamous return bug, I read that you should now use hashtables instead.

Now, I was able to update TESH with the new functions and jasshelper to the newest versions, but after also updating pjass.exe I get an error in blizzard.j whenever I try to save my map.

Line 7118: Cannot convert returned value from real to integer.
Collapse JASS:
function GetFadeFromSeconds takes real seconds returns integer
    if (seconds != 0) then
        return 128 / seconds
    else
        return 10000
    endif
endfunction

So I am unable to save any maps as of now. Also, when I syntax check this code:
Collapse JASS:
globals
    hashtable ht = InitHashtable()
endglobals
I get the following errors from the syntax checker:
Line 6: Undefined type hashtable
Line 6: Undeclared function InitHashtable()

So it would seem like the new functions haven't been added to the syntax checker, so another question is how do I do that... and is this also related to my other bug?

If it is of importance, I am running 1.23b warcraft but the WE is the 1.21 from the JNGP. Without the use of the new functions, before updating any of the JNGP files my triggers worked fine and blizzard.j showed no errors.

NOTE: I also updated jasshelper.conf to say:
Collapse JASS:
[lookupfolders]
// Just type the folders where //! import would look for if relative paths where used, include the final \
// embed them in quotes
// example: "c:\"
// The order causes priority:
".\jass\"

[jasscompiler]
//this is to specify what compiler to use, normally pjass.exe, 
// though you may also want to use JassParserCLI.exe ...
"pjass.exe"
// The next line specifies the jass syntax checker's arguments:
"$COMMONJ +rb $BLIZZARDJ -rb $WAR3MAPJ"
// i.e. You can change it to "$COMMONJ +rb $BLIZZARDJ -rb $WAR3MAPJ"
// in case of a recent  PJass version ...


[externaltools]
// this is for //! external NAME args the syntax is "NAME","executable path"
// example:
//"OBJMERGE","c:\kool.exe"
(Sorry for making it JASS, I didn't know how else to make it 'closeable'.

I have been trying to fix this for some time and am going to bed now, so I am afraid I can't answer any questions regarding my problem until tomorrow morning.
Any help will be greatly appreciated!

To sum it up: I updated TESH to include the new hashtable functions and updated pjass to try and fix the syntax'ing, but I keep on getting this weird bug in blizzard.j whenever I try to save.
08-01-2009, 12:52 AM#2
DioD
1.23b

hashtable for 124

if you cant typecast real to integer via return bug use R2I native.
08-01-2009, 08:02 AM#3
TGhost
Okay, that was retarded of me.

But about that function, it's in blizzard.j and fails the parse with the newest pjass, which was what was really worrying me. But more likely than not this is just a side effect of me updating my files to versions that support a wc3 version beyond the one I'm running...
08-01-2009, 05:32 PM#4
DioD
pjass is damn smart thing and dont allow you do do stupid mistakes.

typecast real to integer and get REAL ID not this real "just converted to integer" you will get real id that have random value.
08-03-2009, 06:06 AM#5
Sophismata
Quote:
Originally Posted by TGhost
Line 7118: Cannot convert returned value from real to integer.
Collapse JASS:
function GetFadeFromSeconds takes real seconds returns integer
    if (seconds != 0) then
        return 128 / seconds
    else
        return 10000
    endif
endfunction

Just to clarify, the syntax error here is "Cannot convert returned value from real to integer". You are trying to return a real when your function is supposed to return an integer.

Personally, I think that's an excellent syntax error.
08-05-2009, 10:35 AM#6
TGhost
I am very much aware why that particular piece of code is an error, and how it could be fixed but that function the error exists in was inside blizzard.j, not in my map. I never created that function, which is what was really worrying me.

EDIT: After reading around, it seems like this has already been pointed out previously by, among others, Vexorian. No need to discuss it further in here I suppose.
08-05-2009, 04:16 PM#7
Sophismata
Ah, my apologies.