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 29/09/09 23:33
Dark Dragon

Hi again!
i was overloading defines and this is the one:
<new integer> = pNewInt(0)
<new integer> (i) = pNewInt(i)
i added:
<new integer> (i) = pNewInt(i)
before i only had the one with no arguments and now when i added one with arguments all other ones with no arguments crashed, saying that i did not pass enough arguments, but its wrong i did pass enough arguments coz i have one which is defined as taking no arguments...

nothing test() {
pointer p = new integer, p2 = new integer(5)
}

this wont compile...
so its not my bug coz before i added one with arguments all was working and it works when i remove it... so i guess u can fix that :)
Greets!
~DD
It's not a bug, and it's mentioned in the manual. If you have a define with no arguments in a group of overloaded defines, you have to call it with empty braces (). ADOLF told that he'll think of a way to get rid of this limitation, but for now it's so.
~VD

posted at 29/09/09 20:17
Dark Dragon

i guess there is an bug but anyway it wont compile!
_______________________________
enum (dooroption) {OPEN, CLOSE, DESTROY}
nothing modify_gate(destructable d, dooroption dopt)
{...}
_______________________________
Greets!
~DD
That's not a bug. For now enums act like enums in C, not C++. They are all integer, not their own types. I asked ADOLF and he told me that he'll think about extending them with C++ like behaviour.
~VD

posted at 29/09/09 17:55
Dark Dragon

thanks vD!
yes thats what i wanted to ask and i am glade it works that way now :)
Greets!
~DD

posted at 29/09/09 02:16
Dark Dragon

* Fixed local variables parsing logic.
that means:
[cjass]
CreateNUnitsAtLoc(...)
unit u = bj_lastCreatedUnit
[/cjass]
will now work, or am i wrong?
Greets!
~DD
<div class="code">void test () {
&nbsp;&nbsp;CreateNUnitsAtLoc(1,'hfoo',GetLocalPlayer(),Location(0,0),0)
&nbsp;&nbsp;unit u = bj_lastCreatedUnit
}</div>
will become
<div class="code">function test takes nothing returns nothing
&nbsp;local unit u
&nbsp;&nbsp;call CreateNUnitsAtLoc(0,0x68666F6F,GetLocalPlayer(),Location(0,0),0)
&nbsp;&nbsp;set u=bj_lastCreatedUnit
endfunction</div>
You can test it yourself =)
~VD

posted at 27/09/09 20:03
Dark Dragon

ok, ill wait for 1.4 and update JNGPS with that stable version.
about TESH it would really be great if u can fix this comments... as well please add GetSpellTargetX/Y natives... a lot of people are saying that this natives are missing :S
Greets!
~DD
Ok, I've added <span class="code">GetSpellTargetX/Y</span> - they will be present in the release version.
VD

posted at 27/09/09 19:25
Dark Dragon

k, i would as well like:
[jass]
int J[65536]
void tst() {
int j[]
}
[/jass]
about cTesh:
keywords new, delete, #if, #else...
and if possible like you said that comments change color from green to grey if default ones are!
for cjass in 1.4.0.0 i would really like:
  1. default arguments
  2. no "function" keyword but "&" char maybe
  3. private: and public:
  4. "for" loop
  5. [] instead of "array" keyword
thats all, but ofc it might be a lot of work but ill wait with JNGPS 1.3 until you make full cTESH and cJass 1.4.0.0 is out.
Greets!
~DD
Yeah, I think the arrays will be as you suggest.
I'm still thinking about comments =)
And about 1.4 - it will be out soon and will contain no significant changes except reworked updater, included manual and increased stability. After the release we'll maintain two branches: stable and development.
VD

posted at 27/09/09 17:53
Dark Dragon

yes i tested it and it works. however this seems to be an bug.
integer i, array j, b
"b" will be an array...
Greets!
~DD
That's not a bug, rather a feature. While we use classic array definition style, it will be so. Hope, ADOLF will implement <span class="code">int j[]</span> -like array declarations.
VD

posted at 27/09/09 15:29
Dark Dragon

nice add-ons but maybe this would be nice:
debug {
nothing test() {}
}
compiled to:
#if DEBUG
nothing test() {}
#endif
Greets!
~DD
This won't happen because of parser internal logic.
Btw, can you please perform intensive testing of +=, -=, /=, *=, ++ and -- operations on different sets of data including arrays etc? We need to know if there are any bugs with code generation. You can find generated code in "war3map_parsed.j" in AdicHelper folder.
Code like this: <span class="code">a += b[c()]++ + b[c()]++</span> or <span class="code">a = ++b[c(++b[c(i)])]</span> etc, etc,

posted at 27/09/09 11:31
Guest

It's too bad that the DATE and TIME are for the latest map save ; |. I mean, I guess it could work well for versions or w/e, but yea ^_^.
If you could have actual DATE and TIME, and be able to record like MAP_SAVE_DATE_TIME or w/e, that would be pretty pimp o-o.
oh, and vJASS already has a debug keyword that works better?
Also, COUNTER seems bugged o-o.
include "cj_types.j"
include "cj_typesEx.j"
include "cj_print.j"
scope Demo initializer Initialization
globals
endglobals

private function Initialization takes nothing returns nothing
local integer x
loop
set x = COUNTER
exitwhen x == 3
call printf(I2S(COUNTER))
endloop
endfunction
endscope
I just get spammed with 1 =P.
Your code won't work as you expect because all references to system values are replaced at map save. So the COUNTER isn't bugged, you're just using it in wrong way:
<div class="code">scope Demo initializer Initialization
&nbsp;&nbsp;private function Initialization takes nothing returns nothing
&nbsp;&nbsp;&nbsp;&nbsp;local integer x
&nbsp;&nbsp;&nbsp;&nbsp;loop
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;set x = COUNTER <i>//COUNTER is replaced to 0</i>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;exitwhen x == 3
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;call printf(I2S(COUNTER)) <i>//COUNTER is replaced to 1</i>
&nbsp;&nbsp;&nbsp;&nbsp;endloop
&nbsp;&nbsp;endfunction
endscope</div>
It's obvious.
We can't have current date and time in the game because war3 doesn't have corresponding functions and this cannot be fixed without hacking the game.
And as for DEBUG - it's better than vJass's debug cause it can be used to make lots of code debug-only, like:
<div class="code">#if DEBUG
void debug_func() {
...
...
}
#endif</div>
So the <span class="code">debug_func</span> will be in the map only if "Debug mode" is checked.
or
<div class="code">void debug_func() {
&nbsp;&nbsp;...
&nbsp;&nbsp;<i>// code #1</i>
&nbsp;&nbsp;...
&nbsp;&nbsp;#if DEBUG
&nbsp;&nbsp;...
&nbsp;&nbsp;<i>// debug-only code</i>
&nbsp;&nbsp;...
&nbsp;&nbsp;#endif
&nbsp;&nbsp;...
&nbsp;&nbsp;<i>// code #2</i>
&nbsp;&nbsp;...
}</div>
VD

posted at 26/09/09 17:26
Guest

DATE
TIME
How to use these keywords for msg or other string ?
can't Work:
void Test () {
BJDebugMsg("Today is "+"##DATA##")
}
<div class="code">include "cj_print.j"
void Test () {
&nbsp; &nbsp;printf("Today is ^v",DATE)
}
</div>
or
<div class="code">define GetDateString = `DATE`
void Test () {
&nbsp; &nbsp;BJDebugMsg("Today is " + GetDateStirng)
}
</div>
VD

posted at 24/09/09 03:02
Mooglefrooglian

You are amazing. I just read over this tool. If it is compatible with vJass like it says.. I can't believe this. Just THANK YOU.

posted at 24/09/09 00:26
Van Damm

System values are implemented in 1.3.4.21:
DATE extends to 2009.09.23 (current date without quotes)
TIME extends to 23:23:00 (current time without quotes)
COUNTER extends to integer number starting with 0 and increasing with every usage
DEBUG is 1 if "Debug mode" is checked and is 0 if it's not (you can use it like #if DEBUG ... #endif)
All these values can be used at any place in the code, not only inside of defines.

posted at 22/09/09 12:32
Guest

native declarations register as syntax errors : (.
constant native GetPlayerUnitTypeCount takes player p, integer unitid returns integer
constant native GetUnitGoldCost takes integer unitid returns integer
constant native GetUnitWoodCost takes integer unitid returns integer
constant native GetUnitBuildTime takes integer unitid returns integer
constant native CreepsOnMap takes nothing returns boolean
constant native UnitAlive takes unit id returns boolean
<s>Thanks for report, we'll fix that.</s>
Bug fixed in 1.3.4.20
VD

posted at 22/09/09 04:52
weaaddar

Is there/can there be a way to make a defines that insert code in the top of the map?
I ask because often i use defines to implement template like behavior, and as cJass currently doesn't support templates, I'd like to avoid having to do the following::
Define MyType(T) = ...
Define InitMyType(T) = ...
Then somewhere in my code I have to go and write::
InitMyType(int)
InitMyType(real)
InitMyType(...)
I'd like that on compile time I could have it be done by usage. Something like::
MyType(T) =
{
#if MyType(T)Defined == 0
#TOPSCRIPTKEYWORDHERE
/* init body over here */
#ENDTOPSCRIPTKEYWORDHERE
#endif
myList_##T
}
We'll implement templates soon.
VD

posted at 21/09/09 12:03
Dark Dragon

i see its an nice way of doing it as well :)
thanks for update!
~DD

posted at 21/09/09 00:17
Van Damm

Here you can see some examples of the new increment/decrement processing engine.
<div class="code">int test1 () {
&nbsp;&nbsp;&nbsp;int fx = 0
&nbsp;&nbsp;if (fx++ == ++fx) {
&nbsp;&nbsp;&nbsp;&nbsp;fx--
&nbsp;&nbsp;}
&nbsp;&nbsp;return ++fx + fx++
}</div>
will become
<div class="code">function test1 takes nothing returns integer
&nbsp;local integer cj_v666_r
&nbsp;local boolean cj_v666_b
&nbsp;local integer fx = 0
&nbsp;&nbsp;set fx = fx + 1
&nbsp;&nbsp;set cj_v666_b = fx==fx
&nbsp;&nbsp;set fx = fx + 1
&nbsp;&nbsp;if cj_v666_b then
&nbsp;&nbsp;&nbsp;&nbsp;set fx = fx - 1
&nbsp;&nbsp;endif
&nbsp;&nbsp;set fx = fx +1
&nbsp;&nbsp;set cj_v666_r = fx + fx
&nbsp;&nbsp;set fx = fx + 1
&nbsp;&nbsp;return cj_v666_r
endfunction</div>
And another example:
<div class="code">int test2 () {
&nbsp;&nbsp;int fx = 0
&nbsp;&nbsp;if (++fx == 0) {
&nbsp;&nbsp;&nbsp;&nbsp;fx--
&nbsp;&nbsp;}
&nbsp;&nbsp;return ++fx
}</div>
will become
<div class="code">function test2 takes nothing returns integer
&nbsp;local integer fx=0
&nbsp;&nbsp;set fx = fx + 1
&nbsp;&nbsp;if fx==0x00 then
&nbsp;&nbsp;&nbsp;&nbsp;set fx = fx - 1
&nbsp;&nbsp;endif
&nbsp;&nbsp;set fx = fx + 1
&nbsp;&nbsp;return fx
endfunction</div>

posted at 19/09/09 20:32
Dark Dragon

k it seems that //! import again does not work :S

posted at 19/09/09 11:40
Dark Dragon

Hi VD and ADOLF!
in this new version i can see u added to detect is define defined so i was wondering is this correct syntax?
#if not __cj_abjb_incl
define __cj_abjb_incl
include "cj_antibj_base.j"
#endif
or did i do smth wrong, greets!
~DD

posted at 17/09/09 10:00
nestharus

No problem, I just made a print statement. In fact, you're also missing some C keywords, which I'm surprised at ^_^.
<const> = constant
And doesn't C have printf? Of course, there is DisplayTextToPlayer which would do everything needed, so why not add something like Perl's print statement, a simplified printf ^_^.
<print> (x) = DisplayTextToPlayer(GetLocalPlayer(), 0, 0, x)
I don't think you can argue that that's a pretty proper keyword that would fit perfectly with cJASS.
Oh yea, for squared results, the symbol is **, not ^ ><. ^ is xor ^_^, which would be helpful too.
**
^
%
And modulus symbol wouldn't be a function call. Just translation it into the equation and just make it auto do reals or something and convert the result into an integer so you knock off the decimals.
5%3 (just put in modulus equation and plug in values)
1
a = a^b (not sure how u'd pull this off without multiple lines)
b = a^b
swap
2**3 (would require the native)
8
As for 12, I can give you a pretty good reason why someone would want to do it.
Let's say that you create a library and you want people to be able to develop for that library and access their stuff thru that library and make that specific stuff have access to private members of that library. To make it easier to maintain, distribute, and install these add on features, the best way to implement them would be from outside the library, not within ^_^.
Why not use text macros?
Because at that point you might as well cnp the code in as the text macros would have to be cnp'd in anyways. Also, libraries that are fully macros would not compile as text macros don't go into text macros.
For define-
Expand on the normal C define. Add in some regular expression elements and allow people to retrieve input without the use of parentheses (if something is on the left side and something is on the right side etc). Allow people to determine how input is sep'd (spaces, parentheses, etc). I keep running into that wall ><. I want to do something like adding in struct contructors (new struct), but no way to format it without par, and at that point might as well just do struct.create().
Oh yes, and making 2 types of define (define outside of a macros and define within) would also be quite helpful ^_^. If it's not in a macro, run it first, and if it is run all macros first and then do the defines.
And for macros, I know there is a way to do macros within macros because I know how to do it. I wouldn't know how to explain it in assembly tho ^_^.
Oh yea, and another interesting feature. Rather than my idea of code that is inserted at very top no matter what, how about making it so that code that is put there, at the very top, would be like a higher level of library etc. Next (the interesting part), this code is only in the map if they are used atleast once =). What would this mean? You could have an all purpose Map Framework with things like recycling, stacks, bool expr utilities, and so on, all packed together into one easy to install thing and then, so that it's efficient, they only go into the map if they are used =). The idea of making systems require Recycling and BoolExpr and a whole slew of other crap every time I put in a library (stuff that pretty much just extends JASS language) is really annoying and time consuming ^_^.
Oh yea, and a very good example of a plugin would be my Player Utilities. I have a player tracking library that keeps dibs no all players and sorts them and so on through out the game. I also have a host add on. The player library is not in a struct.. there's no point, so I can't include it as a module. Next, a macro would be bad as people would have to write it out each time rather than a simple copy and paste. Next, the host add on is accessed through a different name when I want it to be accessed through the player library name, since it is technically a part of it. I'm trying to do that modularity, but it's impossible to do since there is "Nothing" in vjass that'll do this. Other people have tried to do things like this before too. I am pleading their case and I am also pleading in mine. There are many people who would praise the names of the author's of cJASS if they put in plugins.

posted at 16/09/09 23:40
nestharus

A lot of people have been asking for something like plugins from Vexorian and a lot of people have been wanting it, so I'm not alone here =). I remember many conversations from TheHelper.net irc chat =D.
Oh, and I guess ^ would should really be **.
For number 12, with the replacement. A lot of the stuff I make I make for other people : ), and so it would be nice if define keywords that should be used all the time be included with the main thing. There is literally no need to ever use BJDebugMsg when DisplayTextToPlayer(GetLocalPlayer(), 0, 0, "msg") does the same exact thing as is more than 12x faster : o.
We'll think about plugins, but I still bon't understabd them =]
As for 12. - you can just define it in your lib or use cj_antibj_base.j - it's included to all cjass distributions.
VD

posted at 16/09/09 17:05
Dark Dragon

from all this things i would like this two:
  1. func/method overloading
  2. % and ^ operators as you said call funcs...

posted at 16/09/09 14:26
nestharus

Here is my wishlist ^_^
1. macros inside of macros (not sure if you already did this ^^)
2. plugins (like modules for structs, except these goes into scopes and libraries). Plugins should be able to use plugins too : D. Rather than implementing them like modules are implemented, the plugins should work like this- library MySys {}
plugin Hello {}
new Hello for MySys
or
implement Hello/optional implement Hello
or something like that. Why? So people can put new features into a system and use the system's private stuff without having to go thru the system code. It allows for further extensibility =). In fact, if you could make modules work like that too, that would be awesome ^_^.
3. A section of code that goes before all other code and cannot require anything. Useful for map utilities that any given system might use.
4. A way to get away from the ugly vjass underscores for libraries and scopes : (.
5. The modulos operator (%)
6. Squared operator (^)
7. semi-colons (;). Just make the thing put lines together that don't have semi colons or w/e to work more like C ^_^.
8. a better keyword than initializer.. maybe main or something.
9. method/function overloading. Check for the parameters =). If two functions have the same name but dif parameters, rename one of them in the background and change the name of all the calls to it. Could be very beneficial ^_^.
10. Stacks ; o.
12. Replace BJDebugMsg with DisplayTextToPlayer(GetLocalPlayer(), 0, 0, "Message"). In fact, just make a keyword called DebugMsg or something that does what i just mentioned ; P.
Otherwise, so far I think this thing is fantastic : D.
<ol style="padding-left:30px"><li>Will never be possible.</li>
<li>I see no need in that =)</li>
<li>We'll think about that</li>
<li>That's vjass's internal parsing logic, or what do you mean?</li>
<li> see 6.</li>
<li> Anyway, those will be compiled to function calls, but we'll consider that idea</li>
<li>; are already there and is not necessary to avoid breaking backwards compatibility. Line continuations \ are also there.</li>
<li><span class="code">define main = initializer</span>, why not do it yourself?</li>
<li>For now - not, but maybe in the future.</li>
<li>Dunno why we have to include them. If you want, just write a library and usó it. maybe stacks will be included to our standard lib when templates arrive.</li>
<li>I'll look into that.</li>
<li>Again, define goes just well. Even more, there is cj_print.j, which you can use.</li></ol>
VD

posted at 16/09/09 01:06
MasterofRa

Thanks for the Immediate Response.I was expecting it to take at least a day. I sent the map.
Yeah, as I thought, the reason is that experimental thingy. Please use 1.3.4.10 until we fix it. And I will now remove .11 from autoupdate.
Thanks!
VD

posted at 16/09/09 00:23
MasterofRa

The Update today broke my map, so that when i save it, a AdicHelper:syntax error window pops up that didnt occur before.
the white box at the bottom says [00] Critical syntax error. the update seems to have caused this
Can you please <a href="mailto:EvilGreedyStalker@gmail.com">send me</a> the map or script, which causes the error?
It will help us determine what's wrong. The reason is we implemented one feature, which is not stable now, so you'll help us if you provide the map.
And for now you can disable autoupdate and download <a href="files/?cJass_AdicHelper_v01030410_exe.zip">older version</a> until we fix that new feature.
VD

posted at 15/09/09 20:52
weaaddar

I can't seem to get the new do while loops to work, it seems if you define a while it breaks.
define while = whilenot not
do
{
BJDebugMsg("test");
}while(false)
Doesn't compile.
Lol sry, this is my fault. I forgot to upload new exe for autoupdater. Please press "Check for updates" again and then everything will be OK.
VD

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]