Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

Custom JASS Natives - (Requests & Submissions)

Discussion in 'The Lab' started by TriggerHappy, Nov 24, 2013.

  1. WaterKnight

    WaterKnight

    Joined:
    Aug 18, 2009
    Messages:
    4,035
    Resources:
    5
    Maps:
    1
    Tutorials:
    4
    Resources:
    5
    Positive. The only problem is if there are walkable destructables which alter the terrain height.
     
  2. Almia

    Almia

    Joined:
    Apr 24, 2012
    Messages:
    4,842
    Resources:
    35
    Spells:
    30
    Tutorials:
    4
    JASS:
    1
    Resources:
    35
    How about GetWidgetZ?
     
  3. chobibo

    chobibo

    Joined:
    Sep 24, 2005
    Messages:
    2,707
    Resources:
    0
    Resources:
    0
    Yeah, GetWidgetZ and GetUnitZ (Is it already implemented?)
     
  4. edo494

    edo494

    Joined:
    Apr 16, 2012
    Messages:
    3,846
    Resources:
    5
    Spells:
    1
    JASS:
    4
    Resources:
    5
    GetUnitZ exists in library, GetWidgetZ not yet
     
  5. EdwardElric

    EdwardElric

    Joined:
    Jun 19, 2010
    Messages:
    49
    Resources:
    0
    Resources:
    0
    REQUEST
    Also already PM-ed you TriggerHappy via wc3c.net as user "MasterofSickness".
    What I want/need is another function in the plugin Input.cs, sth. like:
    Code (vJASS):
    SetMouseTerrainX            takes real x                 returns nothing
    SetMouseTerrainY            takes real y                 returns nothing

    Similiar like already done here in the thread MouseAPI from MindWorX:
    http://www.hiveworkshop.com/forums/miscellaneous-460/mouseapi-36613/
    Im using SharpCraft 1.2.4.0, because I dont know how to use the current one. Already wrote it in MindWorX's thread on wc3c.net:
    http://www.wc3c.net/showthread.php?t=110643&page=3

    regards
     
  6. TriggerHappy

    TriggerHappy

    Code Moderator

    Joined:
    Jun 23, 2007
    Messages:
    3,793
    Resources:
    22
    Spells:
    11
    Tutorials:
    2
    JASS:
    9
    Resources:
    22

    Attached Files:

    Last edited: Sep 25, 2014
  7. EdwardElric

    EdwardElric

    Joined:
    Jun 19, 2010
    Messages:
    49
    Resources:
    0
    Resources:
    0
    thanks a lot for answering that fast!
    although real terrain X Y would have been much easier for my approach, im happy that I can try the function with integer X Y you gave. By the way, why dont you have a function for receiving the terrain real values, is it more complicated than integer mouse window X Y?

    and another thing, till now i never compiled a CS file (C-Sharp), but for using the new "Input.cs" I have to compile it to a DLL file right? i already found out that you simply can use a BAT file with "csc.exe" from Microsoft.NET like described here to get a DLL:
    http://stackoverflow.com/questions/7811600/how-to-compile-this-c-sharp-code-into-a-dll
    my BAT-file looks like this:
    Code (Text):
    c:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe /target:library Input.cs
    cmd
    but when i try to compile the code (the BAT is placed inside the SharpCraft plugins folder & aims the "Input.cs"), i get a bunch of errors, like:
    Code (Text):
    error CS0246: type- or namespacename 'TinkerWorX' couldnt be found.
    error CS0246: type- or namespacename 'GamePluginBase' couldnt be found.
    error CS0246: type- or namespacename 'JassRealRet' couldnt be found.
    ...
    how do i compile CS files for SharpCraft?
    i guess i need the source code... ahh, where was it again?...

    EDIT:
    ok, got the source code for my SharpCraft version 1.2.4.0 from here:
    https://github.com/TinkerWorX/SharpCraft/releases
    but how to proceed?
    do i really need to compile the CS-file to a DLL-file?
    oh wait!
    i compared the date of file creation & i guess the CS-files get compiled automatically?!
    have to test!

    EDIT2:
    yush!
    the CS-files are compiled automatically with every start of SharpCraft :grin:
     
    Last edited: Sep 25, 2014
  8. TriggerHappy

    TriggerHappy

    Code Moderator

    Joined:
    Jun 23, 2007
    Messages:
    3,793
    Resources:
    22
    Spells:
    11
    Tutorials:
    2
    JASS:
    9
    Resources:
    22
    Place the .cs in your plugins folder in your SharCraft directory. It will get compiled automatically.
     
  9. TriggerHappy

    TriggerHappy

    Code Moderator

    Joined:
    Jun 23, 2007
    Messages:
    3,793
    Resources:
    22
    Spells:
    11
    Tutorials:
    2
    JASS:
    9
    Resources:
    22
    Here's an updated THW Chatroom demo.

    Ralle made some changes to the way the chat works so I had to update it.
     

    Attached Files:

  10. Almia

    Almia

    Joined:
    Apr 24, 2012
    Messages:
    4,842
    Resources:
    35
    Spells:
    30
    Tutorials:
    4
    JASS:
    1
    Resources:
    35
    @TriggerHappy Wow
    So it can connect to the Hive Chatroom Right?
     
  11. Kazeon

    Kazeon

    Joined:
    Oct 12, 2011
    Messages:
    3,296
    Resources:
    38
    Icons:
    2
    Tools:
    1
    Maps:
    7
    Spells:
    21
    Tutorials:
    3
    JASS:
    4
    Resources:
    38
    @TH:
    Have you mentioned that mouse & keyboard natives should not been used in multiplayer map?
     
  12. EdwardElric

    EdwardElric

    Joined:
    Jun 19, 2010
    Messages:
    49
    Resources:
    0
    Resources:
    0
    @ Dalvengyr:
    your question was adressed to TriggerHappy, but as I recently tried to get some mouse/keyboard natives to work in multiplayer, i think it's ok to post some of my experinces here.

    the mouse & keyboard natives from TriggerHappy are declared in his "Input.cs" plugin for SharpCraft. i tried to use them in multiplayer, but all the event natives are causing a desync. these are the natives im talking about:
    Code (vJASS):
    native TriggerRegisterAnyKeyEvent   takes trigger whichTrigger, integer state returns nothing
    native TriggerRegisterAnyMouseEvent takes trigger whichTrigger, integer state returns nothing
    native TriggerRegisterKeyEvent      takes trigger whichTrigger, integer vkey, integer state returns nothing
    native TriggerRegisterMouseEvent    takes trigger whichTrigger, integer vkey, integer state returns nothing
    native TriggerRegisterMouseWheelEvent takes trigger whichTrigger returns nothing

    the reason behind the desync is a local execution of a trigger. when you use one of the above event natives in warcraft 3 world editor & register a trigger to the native, the plugin adds the trigger to a list of triggers which is called via "TriggerExecute" everytime the appropriate event fires. since you cant use "TriggerExecute", "ExecuteFunc", "EnableTrigger", "DisableTrigger ", "TriggerAddAction", "TriggerRemoveAction", and many more "common.j" natives locally, you get a desync. anyway, they work fine in singleplayer, only for multiplayer you must be aware that all mouse & keyboard natives are local natives, hence they are different on every machine. furthermore they arent synced automatically. but beside different syncing methods like:
    • gamecache natives (slow)
    • "network" from nestharus (faster than gamecache, search for it in the forums or - since most of nestharus resources seems to be removed - look here)
    • common.j native "SelectUnit" (my favorite, easy use, faster than gamecache, however still quite slow, see here under "Save/Load:")
    the other natives from TriggerHappy's SharpCraft mouse/keyboard plugin "Input.cs" arent causing direct desyncs as far as i remember, these are the ones:
    Code (vJASS):
    native GetMouseX                    takes nothing returns real
    native GetMouseY                    takes nothing returns real
    native GetMouseTerrainX             takes nothing returns real
    native GetMouseTerrainY             takes nothing returns real
    native GetMouseUIX                  takes nothing returns real
    native GetMouseUIY                  takes nothing returns real
    native GetTriggerKey                takes nothing returns integer
    native GetTriggerWheelDelta         takes nothing returns integer
    native GetTriggerKeyString          takes nothing returns string
    native IsMouseOverUI                takes nothing returns boolean
    native IsKeyDown                    takes integer vkey returns boolean

    if however you use them later on for natives which return handles (or even worse agents) its quite likely that the multiplayer game will desync!