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
963
> 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
963
> 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:
    So what it really is me trying to implement some kind of better site navigation not change the whole theme of the site
  • Varine Varine:
    How can you tell the difference between real traffic and indexing or AI generation bots?
  • The Helper The Helper:
    The bots will show up as users online in the forum software but they do not show up in my stats tracking. I am sure there are bots in the stats but the way alot of the bots treat the site do not show up on the stats
  • Varine Varine:
    I want to build a filtration system for my 3d printer, and that shit is so much more complicated than I thought it would be
  • Varine Varine:
    Apparently ABS emits styrene particulates which can be like .2 micrometers, which idk if the VOC detectors I have can even catch that
  • Varine Varine:
    Anyway I need to get some of those sensors and two air pressure sensors installed before an after the filters, which I need to figure out how to calculate the necessary pressure for and I have yet to find anything that tells me how to actually do that, just the cfm ratings
  • Varine Varine:
    And then I have to set up an arduino board to read those sensors, which I also don't know very much about but I have a whole bunch of crash course things for that
  • Varine Varine:
    These sensors are also a lot more than I thought they would be. Like 5 to 10 each, idk why but I assumed they would be like 2 dollars
  • Varine Varine:
    Another issue I'm learning is that a lot of the air quality sensors don't work at very high ambient temperatures. I'm planning on heating this enclosure to like 60C or so, and that's the upper limit of their functionality
  • Varine Varine:
    Although I don't know if I need to actually actively heat it or just let the plate and hotend bring the ambient temp to whatever it will, but even then I need to figure out an exfiltration for hot air. I think I kind of know what to do but it's still fucking confusing
  • The Helper The Helper:
    Maybe you could find some of that information from AC tech - like how they detect freon and such
  • Varine Varine:
    That's mostly what I've been looking at
  • Varine Varine:
    I don't think I'm dealing with quite the same pressures though, at the very least its a significantly smaller system. For the time being I'm just going to put together a quick scrubby box though and hope it works good enough to not make my house toxic
  • Varine Varine:
    I mean I don't use this enough to pose any significant danger I don't think, but I would still rather not be throwing styrene all over the air
  • The Helper The Helper:
    New dessert added to recipes Southern Pecan Praline Cake https://www.thehelper.net/threads/recipe-southern-pecan-praline-cake.193555/
  • The Helper The Helper:
    Another bot invasion 493 members online most of them bots that do not show up on stats
  • Varine Varine:
    I'm looking at a solid 378 guests, but 3 members. Of which two are me and VSNES. The third is unlisted, which makes me think its a ghost.
    +1
  • The Helper The Helper:
    Some members choose invisibility mode
    +1
  • The Helper The Helper:
    I bitch about Xenforo sometimes but it really is full featured you just have to really know what you are doing to get the most out of it.
  • The Helper The Helper:
    It is just not easy to fix styles and customize but it definitely can be done
  • The Helper The Helper:
    I do know this - xenforo dropped the ball by not keeping the vbulletin reputation comments as a feature. The loss of the Reputation comments data when we switched to Xenforo really was the death knell for the site when it came to all the users that left. I know I missed it so much and I got way less interested in the site when that feature was gone and I run the site.
  • Blackveiled Blackveiled:
    People love rep, lol
    +1
  • The Helper The Helper:
    The recipe today is Sloppy Joe Casserole - one of my faves LOL https://www.thehelper.net/threads/sloppy-joe-casserole-with-manwich.193585/

      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