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.
  • The Helper The Helper:
    What is up WildTurkey?
  • The Helper The Helper:
    Looks like Google fixed whatever mistake that made the recipes on the site go crazy and we are no longer trending towards a recipe site lol - I don't care though because it motivated me to spend alot of time on the site improving it and at least now the content people are looking at is not stupid and embarrassing like it was when I first got back into this like 5 years ago.
  • The Helper The Helper:
    Plus - I have a pretty bad ass recipe collection now! That section of the site is 10 thousand times better than it was before
  • The Helper The Helper:
    We now have a web designer at my job. A legit talented professional! I am going to get him to redesign the site theme. It is time.
  • Varine Varine:
    I got one more day of community service and then I'm free from this nonsense! I polished a cop car today for a funeral or something I guess
  • Varine Varine:
    They also were digging threw old shit at the sheriff's office and I tried to get them to give me the old electronic stuff, but they said no. They can't give it to people because they might use it to impersonate a cop or break into their network or some shit? idk but it was a shame to see them take a whole bunch of radios and shit to get shredded and landfilled
  • The Helper The Helper:
    whatever at least you are free
  • 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!

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top