Zinc

kingkingyyk3

Visitor (Welcome to the Jungle, Baby!)
Reaction score
216
The syntax of "scope" in Zinc is? (or use library instead scope?)

How to use double boolean expression in Zinc?
Example :
JASS:
if x > 0 and y < 0 then


Do I need to use?
JASS:
if (x>0)
{
    if (y<0)
    {
       //My script here. =)
    }
}
 

Vexorian

Why no custom sig?
Reaction score
187
why isnt this possible:

JASS:

local integer test

test += 10


@ king:

try && for and and || for or
I think I will add += , /=, *= and -= to Zinc (to be used exclusively in statements).

kingkingyyk3: Zinc requires libraries instead of scopes, it is not a big issue besides adding all the requirements you need . I know it is annoying but it is best this way, imho.
 

Xorifelse

I'd love to elaborate about discussions...........
Reaction score
87
I think I will add += , /=, *= and -= to Zinc (to be used exclusively in statements).

kingkingyyk3: Zinc requires libraries instead of scopes, it is not a big issue besides adding all the requirements you need . I know it is annoying but it is best this way, imho.
Well, if you're gonna add that.. at least add i++ / i-- to it as well.
 

kingkingyyk3

Visitor (Welcome to the Jungle, Baby!)
Reaction score
216
kingkingyyk3: Zinc requires libraries instead of scopes, it is not a big issue besides adding all the requirements you need . I know it is annoying but it is best this way, imho.

It will be trouble to my spells if I use Zinc to code them. I need to add large amount of requirements since they use many libraries.

90136796.jpg

I am working on a map, which uses Zinc. Jasshelper gave me this error just now.

This is the function which causes error.
JASS:
    public function TransmissionFromUnitByType(integer whichType, player whichPlayer, string whichTitle, string whichText, real whichDuration)
    {
        SetCinematicScene(whichType, GetPlayerColor(whichPlayer), whichTitle, whichText, whichDuration, 0.);
    }
 

Vexorian

Why no custom sig?
Reaction score
187
Are you using 0.A.0.0 ? I fixed a bug that looked like that in that version.

I need to add large amount of requirements since they use many libraries.
Yes.

The best approach to this is to just add requirements to the library as you use those functions... you could have a wrapper library that requires all your most common libraries and just require that one, I guess.
 

Vexorian

Why no custom sig?
Reaction score
187
Well, if you're gonna add that.. at least add i++ / i-- to it as well.
why?

x+=1; is ...better, ++ would make sense if I wanted pre-increment and post-increment, but since those things are only useful when used as expressions and not as statements, then there would be no point in that.

I am not even that sure I want += it is a little worthless.
 

kingkingyyk3

Visitor (Welcome to the Jungle, Baby!)
Reaction score
216
The best approach to this is to just add requirements to the library as you use those functions... you could have a wrapper library that requires all your most common libraries and just require that one, I guess.
Hmm, nice idea.

I am using 0.9.Z.5, I will update it.

Update : I have 0.A.0.0 now, but it still give me the error.

If I code the function in vJass, it does not give me any error.
 

Vexorian

Why no custom sig?
Reaction score
187
Always report crash errors in jasshelper's thread . It stops me from forgetting, I need the whole code (library included), because the function you gave me does not crash for me.
 

kingkingyyk3

Visitor (Welcome to the Jungle, Baby!)
Reaction score
216
JASS:
//! zinc
library Hashtable
{
    public hashtable Hashtable_ht = InitHashtable();
    
    //! textmacro HASHTABLE_OBJECT takes PREFIX, NAME, SOURCE, OBJECT, OBJECT2ID
    $PREFIX$ struct $NAME$
    {
    
        static method operator[]=($OBJECT$ which$OBJECT$, integer whichData)
        {
            SaveInteger(Hashtable_ht,$SOURCE$,$OBJECT2ID$(which$OBJECT$),whichData);
        }
        
        static method operator[]($OBJECT$ which$OBJECT$) -> integer
        {
            return LoadInteger(Hashtable_ht,$SOURCE$,$OBJECT2ID$(which$OBJECT$));
        }
        
        method onDestroy()
        {
            FlushChildHashtable(Hashtable_ht,$SOURCE$);
        }
        
    }
    //! endtextmacro
    
    struct Data
    {
    }
    
    public function AllocateIndex() -> integer
    {
        return Data.create();
    }
}
//! endzinc


JASS:
//! zinc
library TimerStack requires Hashtable
{
    timer Timers [];
    integer Count = 0;
    timer t;
    integer Statusz;
    
    //! runtextmacro HASHTABLE_OBJECT("private","Status","Statusz","timer","GetHandleId")
    
    function NewTimer() -> timer
    {
        if (Count > 0)
        {
            Count = Count - 1;
            t = Timers[Count + 1];
            Status[t] = 1;
            return t;
        }
        t = CreateTimer();
        Status[t] = 1;
        return t;
    }
    
    function ReleaseTimer(timer whichTimer)
    {
        PauseTimer(whichTimer);
        if (Status[whichTimer] == 1)
        {
            Count = Count + 1;
            Timers[Count] = whichTimer;
            return;
        }
    }
    
    function onInit()
    {
        Statusz = AllocateIndex();
    }
}
//! endzinc


JASS:
//! zinc
library CameraFunc
{
    player LocalPlayer;
    playercolor pc[];
    
    public function StartCinematic (player whichPlayer)
    {
        if (LocalPlayer == whichPlayer)
        {
            ShowInterface(false,bj_CINEMODE_INTERFACEFADE);
            EnableUserControl(false);
            EnableOcclusion(false);
        }
    }
    
    public function EndCinematic (player whichPlayer)
    {
        if (LocalPlayer == whichPlayer)
        {
            ShowInterface(true, bj_CINEMODE_INTERFACEFADE);
            EnableUserControl(true);
            EnableOcclusion(true);
        }
    }
    
    public function LockCameraToTarget(player whichPlayer, unit whichUnit)
    {
        if (LocalPlayer == whichPlayer)
        {
            SetCameraTargetController(whichUnit, 0., 0., false);
        }
    }
    
    public function TransmissionFromUnit(unit whichUnit, string whichTitle, string whichText, real whichDuration)
    {
        SetCinematicScene(GetUnitTypeId(whichUnit), GetPlayerColor(GetOwningPlayer(whichUnit)), whichTitle, whichText, whichDuration, 0.);
    }
    
    public function TransmissionFromUnitByType(integer whichType, player whichPlayer, string whichTitle, string whichText, real whichDuration)
    {
        SetCinematicScene(whichType, GetPlayerColor(whichPlayer), whichTitle, whichText, whichDuration, 0.);
    }
    
    public function ResetCamera(player whichPlayer)
    {
        if (LocalPlayer == whichPlayer)
        {
            ResetToGameCamera(0.);
        }
    }
    
    public function PanCamera(player whichPlayer, real x, real y)
    {
        if (LocalPlayer == whichPlayer)
        {
            PanCameraTo(x,y);
        }
    }
    
    public function IssueSelectUnit(player whichPlayer, unit whichUnit)
    {
        if (LocalPlayer == whichPlayer)
        {
            SelectUnit(whichUnit,true);
        }
    }
    
    function onInit()
    {
        LocalPlayer = GetLocalPlayer();
    }
}
//! endzinc


Jasshelper gives error when :
Hashtable + Timer Stack + Whole Camera Func including TransmissionFromUnitByType
Hashtable + Whole Camera Func including TransmissionFromUnitByType
Timer Stack + Whole Camera Func including TransmissionFromUnitByType

Does not give error :
Hashtable + Timer Stack + Whole Camera Func without TransmissionFromUnitByType
Hashtable + Whole Camera Func without TransmissionFromUnitByType
Timer Stack + Whole Camera Func without TransmissionFromUnitByType

Tested in several map, jasshelper gives same error.
 

Vexorian

Why no custom sig?
Reaction score
187
ok got it, something odd about the input line stuff becoming greater than expected,
 

Lyerae

I keep popping up on this site from time to time.
Reaction score
105
A new langauge?
What's the point? Why not just improve vJASS, instead of creating a new language?

Anyway, I don't really see any advantages behind using Zinc over vJASS, but I haven't had a chance to read the manual yet, so meh.
 

Romek

Super Moderator
Reaction score
964
> Zinc is for lazy people, like me, IMO.
No, it's not.
 

Vexorian

Why no custom sig?
Reaction score
187
A new langauge?
What's the point? Why not just improve vJASS, instead of creating a new language?

Anyway, I don't really see any advantages behind using Zinc over vJASS, but I haven't had a chance to read the manual yet, so meh.
JASS:
library InstantKill
{
    constant integer SPELL_ID = 'A000';
    function onInit()
    {
        trigger t = CreateTrigger();
        TriggerRegisterAnyUnitEventBJ(t, EVENT_UNIT_SPELL_EFFECT);
        TriggerAddCondition(t, function()->boolean {
            return SPELL_ID == GetSpellAbilityId();
        });
        TriggerAddAction(t, function() {
            KillUnit(GetSpellTargetUnit() );
        });
    }
}

Well, I can't just fix vJass without exploring first, zinc is a new ground in which I can try stuff without breaking backwards compatibility. Boa is coming soon so we are going to have 3 languages, the other idea is to give more choice for people. and when/if vJass2 comes down, we'll have 4 languages...

Anyway, I prefer Zinc right now, not because of the C syntax but because it is structured much better, implicit private and things like no scopes and the fact there are anonymous functions/methods and most importantly, while and for ... But the whole point of this is to allow people to choose what they want, so if you want to stick to vJass please do it.

Edit: PS improving vJass and creating a new language are not mutually exclusive.
 

Romek

Super Moderator
Reaction score
964
> Yes, IYO.
You use Zinc because you're lazy. That doesn't mean Zinc is made for the lazy.
Note that Zinc introduces new features; which is the reason that JASSers are switching to Zinc - Not laziness.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Monovertex Monovertex:
    How are you all? :D
    +1
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • 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!
  • 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

      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