Comments are closed

cJass on the Google Code.
Our BugTracker (recommend to post bugreports and features request there).
Beta tester notes.

all times are GMT +03:00
Latest posts

Pages: 1 2 3 4 [5] 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27

posted at 03/08/11 21:39
Raffy

Bug report! (processing of ;)
for (unit u; UnitsInRange(0,0,0)) {
        DoNothing()
    }
    call CleanLoc(loc);call CleanLoc(loc);call CleanLoc(loc)
where CleanLoc is defined as
define CleanLoc(loc) = {
    RemoveLocation(loc)
    set loc = null
}
Error message: "Unexpected : "
set cjlocgn_00000000=null,call RemoveLocation(cjlocgn_00000000)
set cjlocgn_00000000=null
My explanation: I think it's because of ; symbol, it conflicts with for loop, because for also uses ;

posted at 03/08/11 15:31
ADOLF

Hi!
I continue to develop and fix this new features. I fix some bugs - please update to the new 1.4.2.22 version.
The for loops is classical C-like loop with pre condition, they compile as
for (int a = 0; a<15; a++) { /* action */}
//
int a = 0
while (a<15) { /* action */; a++}
You also may use this loop without incremetn-action or without increment-action and condition. (for (int i = 0; i<15) {} or for (int i =0))
The forp is modifed for loop. It use post Condition, i.e.
forp (int a = 0; a<15; a++) { /* action */}
//
int a = 0
do { /* action */; a++} while (a<15)
They may be used in low level optimization.
for (unit u; UnitsInRange(x, y, r)) - enum units in temp group ad do actions with picked units.
    for (unit u; UnitsInRange(x, y, z)) {
        KillUnit (u)
    }
//
    globals
        group cjgrfgn_00000000=CreateGroup()
    endglobals
    call GroupEnumUnitsInRange(cjgrfgn_00000000,x,y,z,null)
    loop
        set cjlocgn_00000000=FirstOfGroup(cjgrfgn_00000000)
        exitwhen       cjlocgn_00000000==null
        call GroupRemoveUnit(cjgrfgn_00000000,cjlocgn_00000000)
        call KillUnit(cjlocgn_00000000)
    endloop
Why cJass use loop? It faster then boolexpr, passed to GroupEnumUnits*** as argument (we test it), and since some war3 patch this not couses leaks.
Now about locals: now you may use locals variables only in block (or nested blocks) where the were declared.
nothing fx () {
    if (true) {
        i = 0
    }
    i ++ // error
    if (true) {
            int i = 0 // no error
        if (true) {
            i ++ // all is well
        }
    }
}
This means that the variable, declared in for loops header may be used only in body of their loop.
About the ternary operator - I'll try to make it.

posted at 31/07/11 15:18
Raffy

I'm definitely going to use static vars, and for loop. Thanks for these. And I don't even know what flush locals is :D
  1. What is the difference between for and forp loops?
  2. What means "reworked locals variables processing" ?
2. for (unit u; UnitsInRange(x, y, r)) {} actually took me some time to understand how it works. (it just adds GroupEnum to UnitsInRange). I think you should mention such details to avoid confusion.
Bug report

posted at 29/07/11 01:35
Guest

It's great that you continue development. I'll test this as soon as I have time.
I wanted to voice a feature request. It woudl be nice if you added a trinary operator from C, which looks like:
max = a>b?a:b // instead of using 5-line if checks
This is one feature I'm really looking forward to using.
Thanks!

posted at 27/07/11 18:40
ADOLF

Hi to all! After a long hiatus, I again release a new version with new features.
I have not read the bug reports, published here, but I'm do it latter.
Now I post new dev version and I need more feedback. I not post in on main page because it may be bugged.
The new features:
=======
1.4.2.21
+ for and forp loops
+ for loop to pick units
+ reworked locals variables processing
+ /alf flag - automaticle flush locals (without "flush locals" instruction)
+ in functions static variable
+ fixed bug with locals, declared in "static if" block
+ and more in next stable release!
Sample of code:
unit fx () {
    real x, y, r
    unit pal = CreateUnit (Player(0), 'Hpal', 0., 0., 0.)
    for (unit u; UnitsInRange(x, y, r)) {
        KillUnit (u)
    }
    for (unit u; UnitsInRange(x, y, r)) {
        for (unit t; UnitsInRange(x, y, r)) {
            KillUnit (t)
        }
    }
    return pal
}

nothing fx () {
    static int i = 0
    for (int i = 0; i < 16; i++) {}
    forp (int i = 0; i < 16; i++) {}
    for (int i = 0; i < 16) {}
    forp (int i = 0; i < 16) {}
    for (int i = 0) {}
}
Also recommend to edit exehack.lua:
-- cJass#1
have_ah = grim.exists("adichelper\\adichelper.exe")
if have_ah then
	ah_menu = wehack.addmenu("cJass")
	ah_enable = TogMenuEntry:New(ah_menu,"Enable AdicParser",nil,true)
	ah_enableopt = TogMenuEntry:New(ah_menu,"Enable AdicOptimizer",nil,true)

	-- Flags

	wehack.addmenuseparator(ah_menu)

	ah_opt_remove = TogMenuEntry:New(ah_menu,"Remove unused code",nil,true)
	ah_alf_flag = TogMenuEntry:New(ah_menu,"Locals auto flush",nil,true)
	ah_igno_cjbj = TogMenuEntry:New(ah_menu,"Compile for default cj and bj",nil,true)

	-- Game version switch
	wehack.addmenuseparator(ah_menu)

	ah_version = MenuEntryGroup:New(ah_menu,"Game version switch")

	ah_ver23m = SwitchMenuEntry:New(ah_version,"Compile for game version 1.23")
	ah_ver24m = SwitchMenuEntry:New(ah_version,"Compile for game version 1.24+",true)

	-- Updater items

	wehack.addmenuseparator(ah_menu)

	if (grim.getregpair(confregpath,"First launch passed") ~= "yes") then
		ah_firstlaunch = true
	end

	if ah_firstlaunch then
		if (wehack.runprocess2("AdicHelper\\AHupdate.exe /ask") == 6) then
			ah_enableupdate = true
		end

		grim.setregstring(confregpath,"First launch passed","yes")
		if ah_enableupdate then
			grim.setregstring(confregpath,"Enable AutoUpdate","on")
		else
			grim.setregstring(confregpath,"Enable AutoUpdate","off")
		end
	end

	ah_enableupdate = TogMenuEntry:New(ah_menu,"Enable AutoUpdate",nil,false)

	if ah_enableupdate.checked then
		wehack.execprocess("adichelper\\AHupdate.exe /silent")
	end

	ah_update = MenuEntry:New(ah_menu,"Check for updates now", function() wehack.execprocess("adichelper\\AHupdate.exe") end)
	ah_updateopt = MenuEntry:New(ah_menu,"AutoUpdate settings", function() wehack.runprocess2("adichelper\\AHupdate.exe /options") end)

	-- About box

	wehack.addmenuseparator(ah_menu)
	ah_aboutm = MenuEntry:New(ah_menu,"About AdicHelper ...",function() wehack.execprocess("adichelper\\adichelper.exe") end)

end
-- /cJass#1

-- cJass#2
	if have_ah and ah_enable.checked then
		cmdline = "AdicHelper\\AdicHelper.exe"
		if ah_version.checked == 1 then
			cmdline = cmdline .. " /v23"
		else
			cmdline = cmdline .. " /v24"
		end
		if jh_debug.checked then
			cmdline = cmdline .. " /dbg"
		end
		if ah_alf_flag.checked then
			cmdline = cmdline .. " /alf"
		end
		if ah_igno_cjbj.checked then
			cmdline = cmdline .. " /ibj=\"0\" /icj=\"0\""
		end
		cmdline = cmdline .. " /mappars=\"" .. mappath.."\""
		adicresult = wehack.runprocess2(cmdline)
		if adicresult == 1 then
			mapvalid = false
			return
		end
	end
-- /cJass#2

posted at 17/07/11 17:19
Anonymous

This is a very neat thing. And I'd be very glad if you could continue updating it until a stable, bug-free version is released.
On a side note, where can I find a manual for the latest version (1.4.2.14)?

posted at 08/06/11 11:15
Dafling

Just wanted to let you know, that I use cJass extensively (for more than a year). It is an awesome tool with many features which I'm still learning.
My fav part of cJass is macros, because of the capabilities they give you, and how you managed to make verbose jass syntax much much simpler.
Thanks for your work!
Hope you continue developing this.
Dafling aka developer of Warcraft Soccer map

posted at 14/04/11 09:42
Chris

cJass only spoils warcraft III's vJass it's much more fitting, i'm used to "call" and "local" and "set" and i do not mind calling globals above anything else, this is useless.

posted at 09/04/11 14:06
Msey

Все таки цЖасс не для меня )

posted at 07/11/10 02:21
Guest

I think this project is dead.

posted at 06/11/10 21:01
Guest

UPPPPPPPPDDDDDAAAAAAAATTTTEEEEEESS!?

posted at 04/11/10 01:07
Guest

So here are 2 bugs if anyone cares :\
Just paste code at these links to see them.
Keep in mind CliffBound needs two thingies (linked in post)
First has to do with local variable declarations in static ifs.
Second is /* */

posted at 16/09/10 22:05
Guest

здарова адик О_О

posted at 16/09/10 10:30
Nestharus

AMiHb, I don't think this is ever going to get updated... I stopped using this a long time ago because of the textmacros being broken yet again >.<.
At this point, my faith in cjass has been completely shattered = ). I'd just stick with vjass.

posted at 01/09/10 12:39
AMiHb

flush locals "выдумывает" переменные и затем их обнуляет.
Код до компиляции:
nothing func_periodic_face (unit u,unit targ,real cast,integer AnimIndex) {
integer i = 1, j=0
timer t = CreateTimer()
if cast < 0.3 { cast = 0.3 }
do{
if units_count_timer[i] == null {
units_count_timer[i]=u
units_count_timer[i+1]=targ
j=i
i=0
}
}whilenot (i++==0)
TimerStart(t, cast/30.0, true, function cast_face_unit)
SetVal(t,j)
set targ=null
set u=null
set t=null
}
После:
function func_periodic_face takes unit u,unit targ,real cast,integer AnimIndex returns nothing
local boolean cj_v666_b
local integer i=1
local integer j=0
local timer t=CreateTimer()
if cast < 0.3 then
set cast=0.3
endif
loop
if units_count_timer[i] == null then
set units_count_timer[i]=u
set units_count_timer[i + 1]=targ
set j=i
set i=0
endif
set cj_v666_b=( i == 0 )
set i=i + 1
exitwhen cj_v666_b
endloop
call TimerStart(t, cast / 30.0, true, function cast_face_unit)
call SetVal(t , j)
set Point=null
set proj=null
set t=null
set targ=null
set u=null
set t=null
endfunction

posted at 23/06/10 00:58
Guest

UPDATES PLOX.
(plox?)

posted at 14/06/10 11:25
Nestharus

So textmacros don't work anymore..
//! textmacro HI takes HO
//! endtextmacro

posted at 14/06/10 00:07
Guest

Updates plox.

posted at 03/06/10 03:34
Guest

counters with scope would be most helpful
struct Hi extends array {
    implement COUNTER //like interface types
}

struct Boo extends array {
    public static delegate Hi this = Hi.COUNTER
}
And a way to easily extend off of arrays with multi extension and dynamic this depending on which properties are being accessed = )
struct Hi extends array {
    implement Extend
    implement COUNTER

    public int rawr
}

struct Hi2 extends array {
    implement Extend
    implement COUNTER

    public int rawr2
}
//extends array also as Hi extends array
//Hi = 0, Hi2 = 0
//this = Hi
struct Boo extends Hi, Hi2 {
}

//Hi2 = 1
//this = Hi2
struct Boo2 extends Hi2 {
}

//Hi = 1, Hi2 = 2
//this = Hi
struct Boo3 extends Hi, Hi2 {
}

void test() {
    Boo.rawr = 5
    Boo.rawr2 = 6
}
Dynamic multi extension would also be nice
struct Rawr extends array {
    implement Extend
}

struct Bleh extends array {
    implement Extend
}

//Rawr = 0, Bleh = 0
//this = Rawr
struct Ho extends Rawr, Bleh {
}
Another point is that when a dynamic instance of Ho is accessed, the Rawr value is used (first struct extended off of)
Then again, with SC2 coming out soon, I'm guessing you will be doing a cGalaxy? Andromeda is too much Java : (.
If you do cGalaxy, can you please make sure you code it in c++? Assembly is making this current project go so slowly and is making bugs so hard to mess with = ). Hell, you could even do it in c# : P.
Speed of compiler isn't too important as long as it doesn't take an inane amount of time : ). Speed of the code that is compiled, speed of development, and speed of debugging to me is more important ; D.
ty ty

posted at 20/05/10 13:37
DarkDragon

yeah i hope ADOLF fixes bugs asap :)

posted at 20/05/10 05:14
TigerCN

------||DarkDragon||------
Hm, maybe it`s a bug of cjass syntax.So you need to wait ADOLF`s answer.What`s more,I find a big bug, that is, when I use "enum" and "flush locals" at the same time, the compiler will report error.If you have interest, you could have a try.For eexample:
library Program initializer Main {
enum (Hero) {MountainKing,ArchMage}
private void Main() {
unit u;
integer id [];
id[MountainKing] = 'Hmkg';
id[ArchMage] = 'Hamg';
u = CreateUnit(Player(0),id[ArchMage],0,0,0);
flush locals

}
}

posted at 19/05/10 22:14
DarkDragon

@TigerCN
i could, but its hook so its ok!

posted at 19/05/10 07:37
TigerCN

Hello,DarkDragon!Why don`t you modify "CreateTrigger" to "RegisterTrigger" or other name?
I guess that "CreateTrigger" is conflict with the original.

posted at 16/05/10 11:43
Guest

Extension methods and extension properties with get/set and modifiable accessors + static or non-static
Change lambda expressions to just functions/methods without names. No ~ or anything, just no name.
void() { }
int() { }
And { } would be an initialization block that takes nothing and returns nothing.
Another pretty nice thing would be generics, but eh.

posted at 16/05/10 08:47
DarkDragon

Hi ADOLF!
thanks for update and new features, i am currently not on my pc coz it stopped working and i am currently making my campaign on my moms laptop!
there is a cjass bug from time lambda funcs where implemented... and i kept living with it and tried to get rid of it by any way i knew. reason why i did not report it is coz i dont know how to explain it. however today my campaign wont compile at all and i really need this bug to be fixed... so ill try to explain it!
bug is somewhere in code where lambda funcs where used in define...
#define <init_test()> = {
  CreateTrigger(null, lambda boolean() {
   ....
   return false
}, null)
}
i passed 3 args but it has 4 (its overloaded define).
this is just an example of my code but its not just at one place.
so when i parse my map, 2 things can happen!
cjass crashes or says too much args passed to define! there is one more bug! sometimes when i write:
CreateTrigger(lambda boolean() {
 ...
})
is compiled to:
CreateTrigger_hook(null, function anonym)
but i defined it as:
CreateTrigger(event=null, cond=null, act=null, data=0)
so in that define i can pass 0 to 4 args!
i as well have defined:
#define call
so all calls are replaced coz i have some hooks and i would need to hook <call ...> and <...> so its just a mess.
i fix this bug by adding triggers in map (empty) ones or ones which have few acts but converted to jass and removed words call, set... so basically removing vjass/jass syntax will fix the problem, stuff is i need GUI for some things to be done faster and btw setting starting units as well causes the crash...
but main point are lambda funcs it is sure bug with them coz when i found one place where it had lambda func i fixed it and it worked...

thats all i can say, i hope u can find it and fix asap!
Regards and thanks for all ur hard work guys!
~DD

Pages: 1 2 3 4 [5] 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27

[back to top]