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 +04: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 25/08/09 23:06
Dark Dragon

ohh and i found an bug in old defines with arguments, most likely ADOLF wanted to fix it in this new one!
// this paint text will compile
// but will compile like i wrote this
// paint_text(DIAL_CLR, DIAL_CLR) insted of
// paint_text(txt, DIAL_CLR)
define private dial_set_msg(d, txt) = DialogSetMessage(d, paint_text(txt, DIAL_CLR))
define private paint_text(file, color) = color+file+"|r"
Greets!
~DD
I see... ADOLF didn't fix it. I've told him, he should look into it tomorrow
Fixed
ADOLF

posted at 25/08/09 22:49
Dark Dragon

i see np and thanks :)

posted at 25/08/09 22:46
Dark Dragon

k to keep it simple...
define test(x, y, z) = DoNothing()
nothing test2() {
test(2,3,4) //error missing arguments
}
if define has only one argument then it will work but 2 or more will cause errors if i dont use <>
OMG, what a mess.. I don't know, what's the matter, so <a href="http://cjass.xgm.ru/files/?cJass_AdicHelper_v01030309_exe.zip">here</a> is a link to 1.3.3.9 for now.
I'll contact ADOLF tomorrow because he's already sleeping now.
VD

posted at 25/08/09 22:42
Dark Dragon

DialogAddButton(d, paint_text(name1, NAM_CLR)+paint_text(hkey, HKEY_CLR)+paint_text(name2, NAM_CLR), str_to_ascii(hkey))
this worked before patch but now does not!
paint_text is an define
define private paint_text(file, color) = color+file+"|r"
its just one example but all define dont work if i dont use <>! even if there is no () i have to use <>, it worked before so yeah...
i hope u can tell that to ADOLF or can i get 01 03 03 09 again! for now so i can continue to work xD
Greets!
~DD

posted at 25/08/09 18:16
Strilanc

I can't figure out how to place a macro variable inside a string. For example:
assert(condition) = {if not condition then
call BJDebugMsg("Assertion Failure: ??condition??")
endif}
If there's a way to do it, please put it on the syntax page. Otherwise please add a way to do it.
For now it's `...` like
<div class="code"><b>define</b> assert(condition) = {
&nbsp;&nbsp;if (!condition) {
&nbsp;&nbsp;&nbsp;&nbsp;BJDebugMsg("Assertion Failure: " + `condition`)
&nbsp;&nbsp;}
}</div>
And soon both #condition will be added, which does the same thing, and parsing this inside of the string will be done.
The manual is coming later this week, just be patient and keep asking about things, which you don't know.
VD

posted at 25/08/09 15:49
Dark Dragon

k thanks!

posted at 25/08/09 15:32
Dark Dragon

hmm but if i do allocate() its same as allocate!
so if i use your example i wont be able to do this:
onCreate() {
allocate()
// but ill be forced to do this
allocate
}
anyway allocate works but that define while (cond) does not work, it says that i passed to much arguments but i passed only one...
after that if i use <> it will compile it but laiter where i used
while (<SubString(sx.as_str(), --i, i+len) != str and i >= 0>) { }
it ends here: >= 0> see what i mean... but as i said i change that while define so that it does not take arguments :)
anyway greets!
~DD
if you define &lt;allocate()&gt;, the thing will be replaced only if you write
<div class="code">onCreate() {
&nbsp;&nbsp;allocate()
&nbsp;&nbsp;...
}</div>
, so it's the right way of doing it.
As for while define, "whilenot cond { ... }" is already an in-language construct and can be used without round braces around the condition, so you just have to replace "whilenot" to "whilenot not" like
<div class="code">define while = whilenot not</div>
VD

posted at 25/08/09 15:19
Dark Dragon

omg sry i forgot to add this:
onCreate = static thistype create
onDestroy = nothing on ## Destroy
onInit= static nothing on ## Init
onCopy= static thistype copy
<allocate> = thistype this = thistype.alloc ## ate
In this case, you should use
<div class="code">&lt;allocate()&gt; = thistype this = thistype.alloc ## ate()</div>
or
<div class="code">&lt;allocate()&gt; = { thistype this = thistype.alloc ## ate() }</div>
for better readability.
VD

posted at 25/08/09 15:00
Dark Dragon

gezz... now i changed define while (cond) to just define while = whilenot not
now works but anyway you might wanna check why it does not want to compile...
Greets!
~DD

posted at 25/08/09 14:56
Dark Dragon

k!
i dont know why my strings dont compile but maybe you will know...
while is defined like u said:
define while (cond) = whilenot not (cond)

posted at 25/08/09 14:24
Dark Dragon

ohh now it works sry when i change || to or then its fine xD
Adolf will fix that now =)
VD

posted at 25/08/09 14:19
Dark Dragon

an bug!
define private char_is_num(chr) = (chr == "0" || chr == "1" || chr == "2" || chr == "3" || chr == "4" || chr == "5" || chr == "6" || chr == "7" || chr == "8" || chr == "9")
nothing test(string str) {
if (!char_is_num(str)) {
}
}
well u will see what i mean...
just parse it and JassHelper will tell you whats wrong.
Best Regards!
~DD
Fixed.
ADOLF

posted at 25/08/09 02:55
Strilanc

The latest update finally works with power towers. Way to go!
I found a bug. Locals declared past the start of the function carry their initialization with them when moved.
This can cause a change in behavior (eg. a call to CreateUnit gets moved earlier than it should be). The proper way to do this is to place a non-initialization declaration at the top and an assignment in the body to replace the initialization.
I know that. For now, the way is to separate the declaration and initialization of the variables that shouldn't be moved up, eg:
unit u; u = CreateUnit(...)
Hope, I will be able to persuade Adolf to implement the detection algorithm for such cases.
VD

posted at 25/08/09 02:39
Dark Dragon

yeah thats much better then my example... k ill let u guys decide do u want it or not :)

posted at 24/08/09 21:12
Dark Dragon

Nice work as always guys!
i have some nice c++ suggestion, at least in my option would be nice...
nothing test() {
integer i = GetRandomInt(1, 5)
// *** here we have random chance to kill some unit...
KillUnit((i <= 2)? GetTriggerUnit() : GetKillingUnit())
}
would be compiled to:
unit cjass__temp_unit = null
nothing test() {
integer i = GetRandomInt(1, 5)
// *** here we have random chance to kill some unit...
if (i <= 2) {cjass__temp_unit = GetTriggerUnit()}
else {cjass__temp_unit = GetKillingUnit()}
KillUnit(cjass__temp_unit)
}
np it would not bug or leak to much... coz u only need to create that global once you detect that this type is not created jet... so next time if i use unit u will use that one cjass__temp_unit, no need to create new one! i think this will be one of best features ever!
Greets!
~DD
I understand, what you're talking about. I think, it could be
void test() {
integer i = GetRandomInt(1, 5)
if (i <= 2) { KillUnit(GetTriggerUnit()) }
else { KillUnit(GetKillingUnit()) }
}
to avoid excessive variables. We'll discuss ternary operator with Adolf later =)
VD

posted at 23/08/09 22:16
Dark Dragon

Omg my librarys have compiled jez... awesome work ADOLF for fixing it and Van Damm for founding out why it crashes... lol i could never found out why it crashed, lol about externals i was lucky coz i just randomly tested it :)
anyway great job out there!
~Dark Dragon

posted at 22/08/09 18:37
Dark Dragon

Lol i missed that xD anyway thanks!

posted at 22/08/09 18:01
Dark Dragon

So every macro i wrote i will need to change to textmacro_once?
well np i can do that! ofc thats for next cjass version...
no)
from vJass readMe:
Hint: You can use textmacro_once in a similar way to library_once.

posted at 22/08/09 17:37
ADOLF

//! textmacro_once ...
пиздец, синтаксис)
it would be necessary to correct

posted at 22/08/09 17:32
Dark Dragon

K i see then ill do it that way!
however the array ++ and -- seem not to work like this:
Acts[id:NActs++] = ...
NActs is not an array! thats what cjass thinks but it is! anyway that can be fixed if i change it to NActs[id]++
Greets!
~DD
thx, i fix it (and ++.n) too =)
ADOLF

posted at 22/08/09 15:04
Dark Dragon

Uhh i think its just another little bug!
nothing test() {
CreateNUnitsAtLoc(...)
unit u = bj_lastCreatedUnit
}
compiled to:
nothing test() {
unit u = bj_lastCreatedUnit
CreateNUnitsAtLoc(...)
}
it should be compiled to:
nothing test() {
unit u
CreateNUnitsAtLoc(...)
u = bj_lastCreatedUnit
}
Greets!
~DD
no, its not bug, all variable declaration go on top
use:
nothing test() {
CreateNUnitsAtLoc(...)
unit u /* <--- be moved */; u = bj_lastCreatedUnit
}
ADOLF

posted at 22/08/09 13:26
Dark Dragon

Hi ADOLF!
that will be great! however i have only one question!
if i now write:
define a (x, y) = ...
a(<GetUnitX(u)>, <GetUnitY(u)>)
will i need in next version to remove <> or will it be fine?
Thanks and greets!
~Dark Dragon
yes, <> will work too
ADOLF

posted at 22/08/09 11:11
ADOLF

Ќя!
in 1.3.3.5 (coming soon) at processing of arguments the amount of brackets will be considered in the call of define
i.e.
define a (x, y) = //...
a (GetUnitX(), GetUnitY())
now cjass will search a comma after closing of all of the opened brackets and correctly find next arguments

posted at 22/08/09 01:46
Dark Dragon

K to help u guys on this, i found that smth else causes crash as well!
//! external ObjectMerger .\ddup\lib_v2\war3map.w3a
//! external ObjectMerger .\ddup\lib_v2\war3map.w3u
//! external FileImporter .\ddup\lib_v2\dummy.mdx dummy.mdx
i just put this in an empty map and cjass crashed!
so i guess macros are not the main problem... i think that //! causes problems... still not sure just wanted to let u know!
Greets!
~DD

posted at 22/08/09 01:40
Dark Dragon

I see! well then ill wait for next version!
thanks for ur time and checking of libs!
~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]