What's 'call' for?

SineCosine

I'm still looking for my Tangent
Reaction score
77
Umm..
I made a mistake in my codes like this:

JASS:

set i = 1
            loop
            exitwhen i > NumberOfLightnings
                DestroyLightning(.Beam<i>)
                set .Beam<i> = null
                DestroyLightning(.Beam2<i>)
                set .Beam2<i> = null
                DestroyLightning(.Beam3<i>)
                set .Beam3<i> = null
            set i = i + 1
            endloop
</i></i></i></i></i></i>



As you can see, I had [lJASS]DestroyLightning(.Beam)[/lJASS] without the word [lJASS]call[/lJASS] in front..
And it compiled nicely and even worked properly o_O

So..
Why DOES it work? o.0
 

Komaqtion

You can change this now in User CP.
Reaction score
469
Huh ?!

Don't think that's possible...
It should definately not compile in JassHelper ! :S

Are you sure that the trigger is enabled :S
Maybe you have duplicates, and one is disabled (This one) and the other one isn't, and that one has [ljass]call[/ljass] :S
Can't see too many reasons XD
 

SineCosine

I'm still looking for my Tangent
Reaction score
77
Nope, one of a kind trigger here =P
And, yea, it is enabled, how else would I know that it runs perfectly? o.0

It even removes the lightnings and stuff xD
Removing the 'call' from BJDebugMsg(string) works, too

Never tried it on anything else, though
 

Jindo

Self
Reaction score
460
I don't know JASS, but I'm assuming that this language requires you to use call to call the function, rather than simply call it as you would in most other languages. Like how it uses loop and endloop and other variations instead of { and }. (Correct me if I'm wrong somebody who knows the language!)
 

Komaqtion

You can change this now in User CP.
Reaction score
469
Well, do you have the latest bersion of JassHelper ? :S
Maybe there is a version where Vex enabled this feature, but I can't do it and I have the latest...
 

jig7c

Stop reading me...-statement
Reaction score
123
what version is your jasshelper, and post the entire code... i want to put that code in my map and see if it works or not!
what features are turned on/off in the NewGen pack...
 

SineCosine

I'm still looking for my Tangent
Reaction score
77
Lol, how would I know what version it is xD
It's really old, haven't updated it since I got it ._.

My JASSHelper version: 0.A.2.7

The entire code is..

JASS:
scope NexusRay initializer NRInit

    globals
        private constant integer SpellId = &#039;A00A&#039;
        private constant string Lightning = &quot;MBUR&quot;
        
        private constant real Distance = 5000.00
        private constant integer NumberOfLightnings = 5
        private constant real TimeTaken = 3.00
        private constant real ZHeight = 100.00
        private constant real StartingDistanceFromCaster = 100.00
        private constant integer DummyId = &#039;h002&#039; //Has to be invisible
        
        private constant integer CameraLock = R2I(NumberOfLightnings / 2)
    endglobals

    private struct NR
        
        private static NR data = 0
        
        unit caster //Done
        player playcast //Done
        lightning array Beam[NumberOfLightnings] //Done
        lightning array Beam2[NumberOfLightnings] //Done
        lightning array Beam3[NumberOfLightnings] //Done
        unit array dummies[NumberOfLightnings] //Done
        
        real array dummyX[NumberOfLightnings] //Done
        real array dummyY[NumberOfLightnings] //Done
        
        group PushBack //Done
        group TBPushBack //Done
        
        real Damage //Done
        integer AbilityLevel //Done
        
        real radian //Done
        real facing //Done
        
        real array LightningX[NumberOfLightnings] //Done
        real array LightningY[NumberOfLightnings] //Done
        
        real casterx //Done
        real castery //Done
        
        integer ticks //Done
        integer distancePerTick //Done
        real radianCurrent
        
        //Cinematic preparations
        real array PlayerCameraX[3]
        real array PlayerCameraY[3]
        
        private method periodic takes nothing returns nothing
            local NR nr = this
            local integer i = 1
            local integer ticking = R2I(TimeTaken / 0.03125)
            local real x
            local real y
            
            if nr.ticks &lt; ticking + 1 then
                loop
                exitwhen i &gt; NumberOfLightnings
            
                    set nr.LightningX<i> = nr.LightningX<i> + (nr.distancePerTick) * Cos(nr.facing)
                    set nr.LightningY<i> = nr.LightningY<i> + (nr.distancePerTick) * Sin(nr.facing)
                    
                    call SetUnitPosition(nr.dummies<i>, nr.LightningX<i>, nr.LightningY<i>)
                    
                    set nr.dummyX<i> = GetUnitX(nr.dummies<i>)
                    set nr.dummyY<i> = GetUnitY(nr.dummies<i>)
                    
                    call MoveLightningEx(Beam<i>, true, nr.casterx, nr.castery, 50.00, nr.dummyX<i>, nr.dummyY<i>, ZHeight)
                    call MoveLightningEx(Beam2<i>, true, nr.casterx, nr.castery, 50.00, nr.dummyX<i>, nr.dummyY<i>, ZHeight)
                    call MoveLightningEx(Beam3<i>, true, nr.casterx, nr.castery, 50.00, nr.dummyX<i>, nr.dummyY<i>, ZHeight)
                    
                set i = i+1
                endloop
            
                set x = nr.dummyX[CameraLock]
                set y = nr.dummyY[CameraLock]
                
                
                set i = 0
                loop
                exitwhen i == 4
                    
                    if (GetLocalPlayer() == Player(i)) then
                        call PanCameraToTimed(x, y, 0)
                    endif
                
                set i = i+1
                endloop
            
                set nr.ticks = nr.ticks + 1
            
            else
                call nr.stopPeriodic()
                call nr.destroy()
            endif
        endmethod
        
        implement T32x
        
        static method NRSummon takes nothing returns nothing
            local NR nr = NR.data
            local timer t = GetExpiredTimer()
            local integer i
            
            call DestroyTimer(t)
            set t = null
            
            set i = 1
            loop
            exitwhen i &gt; NumberOfLightnings
            
                set nr.radianCurrent = nr.radianCurrent - nr.radian
                set nr.LightningX<i> = nr.casterx + (StartingDistanceFromCaster) * Cos(nr.radianCurrent)
                set nr.LightningY<i> = nr.castery + (StartingDistanceFromCaster) * Sin(nr.radianCurrent)
                set nr.dummies<i> = CreateUnit(nr.playcast, DummyId, nr.LightningX<i>, nr.LightningY<i>, nr.radianCurrent*bj_RADTODEG)
                
                set nr.dummyX<i> = GetUnitX(nr.dummies<i>)
                set nr.dummyY<i> = GetUnitY(nr.dummies<i>)
                
                set nr.Beam<i> = AddLightningEx(Lightning, true, nr.casterx, nr.castery, 50.00, nr.dummyX<i>, nr.dummyY<i>, ZHeight)
                set nr.Beam2<i> = AddLightningEx(Lightning, true, nr.casterx, nr.castery, 50.00, nr.dummyX<i>, nr.dummyY<i>, ZHeight)
                set nr.Beam3<i> = AddLightningEx(Lightning, true, nr.casterx, nr.castery, 50.00, nr.dummyX<i>, nr.dummyY<i>, ZHeight)
                
            set i = i+1
            endloop
            
            call nr.startPeriodic()
        
        endmethod
        
        static method NRAct takes nothing returns nothing
            local NR nr = NR.allocate()
            local integer i = 1
            local real radianStart
            local timer time = CreateTimer()
            
            set nr.caster = GetTriggerUnit()
            set nr.playcast = GetTriggerPlayer()
            set nr.PushBack = CreateGroup()
            set nr.TBPushBack = CreateGroup()
            set nr.AbilityLevel = GetUnitAbilityLevel(nr.caster, SpellId)
            set nr.Damage = nr.AbilityLevel
            set nr.radian = 3.14156265 / NumberOfLightnings
            set nr.facing = GetUnitFacing(nr.caster) * bj_DEGTORAD
            set nr.casterx = GetUnitX(nr.caster)
            set nr.castery = GetUnitY(nr.caster)
            set nr.ticks = 1
            
            set nr.distancePerTick = R2I(Distance / R2I((TimeTaken / 0.03125)))
            
            set radianStart = nr.facing + (3.14156265/2)
            set nr.radianCurrent = radianStart + nr.radian
            
            call PauseUnit(nr.caster, true)
            
            //CinematicPrepare
            set i = 0
            loop
            exitwhen i == 4
                if (GetLocalPlayer() == Player(i)) then
                    set nr.PlayerCameraX<i> = GetCameraEyePositionX()
                    set nr.PlayerCameraY<i> = GetCameraEyePositionY()
                endif
            set i = i+1
            endloop
            
            call CinematicModeBJ( true, GetPlayersAll() )
            
            set i = 0
            loop
            exitwhen i == 4
                if (GetLocalPlayer() == Player(i)) then
                    // Use only local code (no net traffic) within this block to avoid desyncs.
                    call PanCameraToTimed(nr.casterx, nr.castery, 1)
                    call SetCameraField(CAMERA_FIELD_ANGLE_OF_ATTACK, -20, 1)
                    call SetCameraRotateMode(nr.casterx, nr.castery, nr.facing, 1)
                endif
            set i = i + 1
            endloop
            
            call SetCinematicScene(GetUnitTypeId(nr.caster), ConvertPlayerColor(11), &quot;Gabriel&quot;, &quot;Come! |nShadow spawn!&quot;, 4.00, 4.00)
            
            set NR.data = nr
            
            call TimerStart(time, 2.00, false, function NR.NRSummon)
            set time = null
            
        endmethod
        
        method onDestroy takes nothing returns nothing
            local integer i = 1
            
            call CinematicModeBJ( false, GetPlayersAll() )
            
            set i = 0
            loop
            exitwhen i == 4
                if (GetLocalPlayer() == Player(i)) then
                    // Use only local code (no net traffic) within this block to avoid desyncs.
                    call PanCameraToTimed(.PlayerCameraX<i>, .PlayerCameraY<i>, 1)
                    call SetCameraField(CAMERA_FIELD_ANGLE_OF_ATTACK, -70, 1)
                endif
            set i = i + 1
            endloop
            
            call PauseUnit(.caster, false)
            
            set .caster = null
            set .playcast = null
            
            set i = 1
            loop
            exitwhen i &gt; NumberOfLightnings
                DestroyLightning(.Beam<i>) //Look, mom! No call!
                set .Beam<i> = null
                DestroyLightning(.Beam2<i>)
                set .Beam2<i> = null
                DestroyLightning(.Beam3<i>)
                set .Beam3<i> = null
                
                call KillUnit(.dummies<i>)
                call RemoveUnit(.dummies<i>)
                set .dummies<i> = null
            set i = i + 1
            endloop
        
        endmethod
        
    endstruct

    private function NRCond takes nothing returns boolean
        return GetSpellAbilityId() == SpellId
    endfunction

    private function NRInit takes nothing returns nothing
        local trigger t = CreateTrigger()
        local integer i = 0
        
        loop
        exitwhen i == 4
            call TriggerRegisterPlayerUnitEvent(t, Player(i), EVENT_PLAYER_UNIT_SPELL_CAST, null)
        set i = i+1
        endloop
        
        call TriggerAddCondition(t, Condition(function NRCond))
        call TriggerAddAction(t, function NR.NRAct)
        
    endfunction

endscope

</i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i>



[EDIT]
ANOTHER queer oddity..
You know that Nova-spawning-nova spell which, I complained, lagged on my PC?

The spell works, right?
I JUST reviewed the code and I used certain variables wrongly MULTIPLE times and the spell still worked without a hitch ._.

Like sf.DummyFirst ->>> I used DummyFirst

That variable shouldn't exist..
But apparently, it didn't matter ._.
The spell works fine with it all wrong and jumbled up ._.

But I DID fix those up..
Who knows how many other codes I screwed up..
Lol, but they work, so, meh
 

Romek

Super Moderator
Reaction score
964
If you use cJass, then that allows you to exclude certain words from your code, such as [ljass]call[/ljass], [ljass]set[/ljass] or [ljass]local[/ljass].

Without cJass, this is possible in Zinc, which can compile in the regular Jasshelper. However, Zinc code needs to be in a [ljass]//! zinc[/ljass] block. Perhaps there's a nice little error there? :p
 

SineCosine

I'm still looking for my Tangent
Reaction score
77
uhh..
Hmm..
Ahh..
mm..

*Thinks*
I'm starting to think, more and more, that I somehow have cJass in my PC and don't know it -____-

First the 'Killing Vexorian' error, now this..
hmm..
 

Sevion

The DIY Ninja
Reaction score
413
This is strange indeed.

First non-existent variables work, then omission of 'call'.

o_O'
 

SineCosine

I'm still looking for my Tangent
Reaction score
77
So..
What are the benefits of cJass?

I don't see many people talking about it here..
I do recall something about it being an 'ungodly' mix of C+/C++ and Jass
 

Sevion

The DIY Ninja
Reaction score
413
It's not talked about here because many people dislike it.

Something about "too many standards" and yet they accept Zinc the moment it comes out -_-'

cJASS would be something like:

JASS:
scope asdf initializer init {
    void init () {
        int i = 11
        do { BJDebugMsg(I2S(i)); somefuncinanotherliborscope(i);}
        whilenot ( i-- == 0 )
    }
}


You can also have user defines etc:

JASS:
scope asdf initializer init {
    define {
        Lololol = BJDebugMsg(&quot;Lololol&quot;);
    }
    void init () {
        Lololol
    }
}


Read more about it: http://www.cjass.xgm.ru/

WTF WHY ARE YOU UP SO EARLY!? IT'S 4:20 AM THERE!!!
 

SineCosine

I'm still looking for my Tangent
Reaction score
77
I stay up till about 7-8am and sleep till..
I duno, 4+ pm?

Hmm..
It does look messy ._.

But is there an advantage to cJass?
 

Sevion

The DIY Ninja
Reaction score
413
It's only messy if you don't usually program in anything like C.

There is an advantage. Read the manual.
 

PurgeandFire

zxcvmkgdfg
Reaction score
509
It is essentially just an interface for those who prefer to code similar to C rather than JASS/vJASS.

There are no huge advantages, but I heard cJASS's defines are useful, I haven't really used cJASS myself though.

They probably have some cool features, but a lot of them are probably doable with vJASS or normal JASS.
 

SineCosine

I'm still looking for my Tangent
Reaction score
77
Ouh.
So it's nothing I can't live without?

I almost contemplated learning cJass for a moment there..
 

Sevion

The DIY Ninja
Reaction score
413
Truly, the only thing in cJASS over vJASS is defines. Read up on them, they're pretty nice ;)

You don't have to use full on cJASS to use defines. Defines can be also used in standard JASS block format:

JASS:
define
MyDefine = Whatever
enddefine


If nothing, I'd get it for that alone.

Its formatting is much better than [ljass]//! textmacro[/ljass] and you can even define overload!
 

Troll-Brain

You can change this now in User CP.
Reaction score
85
cJass doesn't seem to work well together with vJass.
textmacro optional are not supported.
And each time i try to use it, i got pjass compilation errors (all bugs are reported on the link mentioned).
Honestly it is a good idea but they really should have choice an other language to make the compiler.
I don't care about several seconds of compilation if it works well, which is not the case actually ...

I can't forget all vJass because module and struct are useful.
 

Sevion

The DIY Ninja
Reaction score
413
You shouldn't use textmacros anyways o_O' They're ugly :D

The reason defines were introduced was to replace textmacros anyhow.

And what do you mean forget all vJASS? modules and structs work fine in cJASS o_o'
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top