![]() |
#1 |
reenignE
|
![]() NOTE: You have been redirected in order for our attachments to be made available to you. This will only last two minutes; these measures where taken to avoid hotlinking and bandwidth theft. To avoid these restrictions Log in or Register Reinventing the Craft 1.0 (Codename: Cake) Yep, the wait is over. RtC is a tool that allows you to easily add custom natives to Warcraft III using nAPI. Currently supported languages are C, C++ and Pascal (both Delphi and FreePascal/Lazarus), but any language with a compiler capable of producing a DLL and calling windows API functions is (in theory) supported. nAPI includes the following function exports (I'm aware how horrible the formatting is): Code:
AddNative (address: Pointer; name: String; params: String) // Registers a native StringMap (str: String): Integer StringGet (str: Integer): String // These two are used when passing Jass strings as parameters GetUnitInfoStruct (unit_rawcode: Integer): PW3UNITINFO GetAbilityInfoStruct (ability_rawcode: Integer): PW3ABILITYINFO // Allow access to Unit and Ability structs where you can both read and edit object editor data AddRCHandle (input: Pointer; datatype: Integer): Integer GetRCHandle (id, datatype: Integer): Pointer RecycleRCHandle (id, datatype: Integer): Pointer RegisterHandleDestructor (hdestructor: THandleDestructor): Integer // A handle system at your disposal GameDebugMessage (str: String) // nAPI's BJDebugMsg CreateTriggerGroup (): TTriggerGroup; DestroyTriggerGroup (whichTG: TTriggerGroup); TriggerGroupAdd (whichTG: TTriggerGroup; trigger: Jass_trigger); TriggerGroupRun (whichTG: TTriggerGroup); // TriggerGroups - easy way to make custom events GetWc3WindowHandle(): HWND; // Gets you the handle to WC3's main window MouseInfo : struct { MouseX, MouseY, MouseZ: Float; // Mouse X, Y and Z in in-game coordinates IsOverUI: LongBool; // Whether the mouse is currently over UI MouseRelativeX, MouseRelativeY: Float; // Mouse position relative to the screen } LastNativeName: String; // Name of the last native the game called so far The API also allows plugin DLLs to detect when the map's main function is called, when the map loads, exits, when the game is quit and when a WND procedure (such as keyboard press or moving the mouse wheel) is called. Other non-related RtC functionality controlled via config.ini:
We also included some nice natives for you to use: ![]() //============================================================================ // StopWatch API // native StopWatchCreate takes nothing returns integer native StopWatchMark takes integer stopwatch returns real native StopWatchDestroy takes integer stopwatch returns nothing //============================================================================ // Time API // native TimeGetTimestamp takes nothing returns integer native TimeGetSeconds takes nothing returns integer native TimeGetMinutes takes nothing returns integer native TimeGetHours takes nothing returns integer native TimeGetDayMonth takes nothing returns integer native TimeGetDayWeek takes nothing returns integer native TimeGetMonth takes nothing returns integer native TimeGetYear takes nothing returns integer native TimeGetMilliseconds takes nothing returns integer native GetTickCount takes nothing returns integer //============================================================================ // Vector API // native VectorCreate takes integer size returns integer native VectorDestroy takes integer vector returns nothing native VectorClear takes integer vector returns nothing native VectorGetSize takes integer vector returns integer native VectorSetSize takes integer vector, integer size returns nothing native VectorGet takes integer vector, integer index returns integer native VectorSet takes integer vector, integer index, integer value returns nothing native VectorPushBack takes integer vector, integer value returns nothing native VectorPopBack takes integer vector returns nothing native VectorBack takes integer vector returns integer native VectorEmpty takes integer vector returns boolean //============================================================================ // UserInput API // native GetMouseTerrainX takes nothing returns real native GetMouseTerrainY takes nothing returns real native GetMouseTerrainZ takes nothing returns real native GetMouseScaleX takes nothing returns real native GetMouseScaleY takes nothing returns real native GetMouseScreenX takes nothing returns integer native GetMouseScreenY takes nothing returns integer native SetMouseScreenX takes integer x returns nothing native SetMouseScreenY takes integer y returns nothing native SetMouseScreenPos takes integer x, integer y returns nothing native IsMouseOverUI takes nothing returns boolean native SetMouseBlock takes integer key, boolean doBlock returns nothing native GetTriggerWheelDelta takes nothing returns integer native TriggerRegisterMouseEvent takes trigger trig, integer etype returns nothing native TriggerRegisterKeyEvent takes trigger trig, integer etype returns nothing native GetTriggerKey takes nothing returns integer native SetKeyBlock takes integer key, boolean doBlock returns nothing native ForceKeyDown takes integer key returns nothing native ForceKeyUp takes integer key returns nothing native ForceKeyType takes integer key returns nothing //============================================================================ // Misc API // native StringReplace takes string input, string oldstr, string newstr returns string native StringPos takes string input, string substr returns integer native StringRPos takes string input, string substr returns integer native BitAnd takes integer o1, integer o2 returns integer native BitOr takes integer o1, integer o2 returns integer native BitXor takes integer o1, integer o2 returns integer native BitBSL takes integer o1, integer o2 returns integer native BitBSR takes integer o1, integer o2 returns integer native BitFlip takes integer o returns integer native Log takes real input returns real native Ln takes real input returns real How to use the included natives:
Now that you have a clear picture about the project's functionality and since this project is often followed by a lot of misunderstanding, I'll now try to explain anything else you might be curious about with the following Q&A. Why the hell did it take so long? MindWorX started the WarSoc project in mid 2007 with the aim of making it possible for more than 12 players to play a map. This would be done by creating custom natives for WinSock functions. I soon joined to help him with it and a lot of progress was made and we soon had working access to WinSock via WC3 natives. Initial success soon made the project expand and it was renamed to Reinventing the Craft (name idea by Whitehorn). RtC would become a large set of natives, with WarSoc being just one part of it. The project then entered development hell. The whole RtC code was, to this date, remade from scratch at least 4 times. WarSoc stopped being the focal point of the project and, considering several failed attempts to make it easy-to-use, was completely abandoned at one point. Mid 2009, we decided to change the aim of the project once more, by making an API which would allow other people to make custom natives. The project was remade one last time and we soon had a very stable, feature-rich nAPI. However, lack of free time made it enter development hell once more, despite it being nearly finished. Finally, just a month ago, we updated it for the latest patch and started working on it again. Now it's finally here and it's still very much alive, with even WarSoc being resurrected as a plugin in some future release. So I made a DLL with my own natives, now what? Just put it in the plugins directory. If you did everything right, RtC will load them automatically. Is C#/VB.NET supported? No, but it will be! A subproject called Jass.NET is currently on its way. It will allow loading custom natives from a .NET assembly. Is the source code available? No, it isn't. It might become at some later time though. I'm also willing to explain the mechanics on how it all works to anyone interested. All the plugins are open-source (GPL license), however. Where's the documentation on how to use all these functions? Sadly, no detailed documentation is provided at this time. We did our best to make the examples self-explanatory and the plugins we made are open-source. You are free to ask us for any help with using nAPI. Is Jass New Gen pack required in order to make RtC maps? Yes, but only to disable WE's syntax checker which will report errors when you use custom natives. What nAPI stands for? native API or possibly new API (with xttocs' jAPI being the old one). Does it work in multiplayer? Yes, it does. Do all players need to have RtC with the same plugins in order for it to work in multiplayer? Yes. Is this safe? I mean, since the plugins are DLLs, they can, in theory, do all kinds of malicious stuff to my PC, right? Absolutely. However, it's not any less safe than just about anything you download from the internet. My antivirus reports RtC as a virus, is it dangerous? No, it isn't. Your antivirus probably detected RtC's attempt to inject a DLL which malware often uses. All you need to do is add RtC to your antivirus' whitelist (same way you did for JNGP). You said WarSoc is being developed again! Does it mean we will finally get more than 12 players? Well, yes and no. Yes, it will be possible since you'll be able to access WinSock and thus have full control over what's being sent over the network, but it will never be possible to have more than 12 players "out of the box", without modifying a map. I want to make custom natives, where do I start? Start with checking out the API and the simple examples in the source\API folder. You can later move on to checking the plugin sources for some more advanced stuff. I noticed some batch scripts for compiling, what do I need in order to use them? TDM's GCC/mingw32 Build version 4.4.1 Feel free to ask if anything else remains unclear. Credits:
Last edited by SFilip : 04-04-2010 at 05:43 PM. |
![]() |
![]() |
Sponsored Links - Login to hide this ad! |
|
![]() |
#2 |
I blink, therefore I am.
Join Date: Sep 2006
Posts: 1,812
![]() ![]() ![]() ![]() |
![]() Windows 7 (64-bit).
__________________"Warcraft III has stopped working A problem caused the program to stop working correctly. Windows will close the program and notify you if a solution is available." the error log says this: "Test header message [14:01:56] Dll injected [14:01:56] kernel32.dll loaded [14:01:56] blizzard.ax loaded [14:01:56] game.dll loaded [14:01:56] game.dll found... [14:01:56] Loading external.ini..." Otherwise Im glad to see this finally released! |
![]() |
![]() |
![]() |
#3 |

Join Date: Feb 2008
Posts: 405
![]() ![]() |
![]() I can't run RtC.exe in windows 7 (32-bit).
I've tried all compatibility modes. EDIT: Forgot to patch wc3. Last edited by TriggerHappy : 04-03-2010 at 05:21 PM. |
![]() |
![]() |
![]() |
#4 | |
I blink, therefore I am.
Join Date: Sep 2006
Posts: 1,812
![]() ![]() ![]() ![]() |
![]() Quote:
Running it in compatability mode (XP SP2). I will tell you if anything blows up. Apparently compatability mode did nothing and its more of a roulette wheel trying to get it started. 25% of the time it works 100% of the time! Either way, I can finally test code now! Last edited by Ammorth : 04-02-2010 at 05:09 PM. |
|
![]() |
![]() |
![]() |
#5 |
User
Join Date: Dec 2006
Posts: 253
![]() ![]() |
![]() Heh, I thought this was an april's fool joke at first. But sweet, I'll test it out.
Btw, to those who don't know, the path for the common.j is scripts\common.j, since it wasn't mentioned. EDIT: Tested it, awesome mouse natives. =D Are you and MindworX going to create more natives/extend/work on RtC anymore, or are you completely done with the tool? (Aside from bug-fixing, if any) Last edited by PurgeandFire111 : 04-03-2010 at 05:46 AM. |
![]() |
![]() |
![]() |
#6 | |
I blink, therefore I am.
Join Date: Sep 2006
Posts: 1,812
![]() ![]() ![]() ![]() |
![]() Quote:
Mindy better be! I want more custom natives damnit! =D btw, I have pastebined some APIs and Trackables 2.0 (very basic right now) as well as a flyable camera map. Post 1 is APIs and Post 2 is Trackables 2.0: http://www.wc3c.net/pastebint.php?t=...3dfe96d8da1024 Map: http://www.wc3c.net/attachment.php?a...8&d=1270227146 Last edited by Ammorth : 04-03-2010 at 08:41 AM. |
|
![]() |
![]() |
![]() |
#7 |
reenignE
|
![]() It was Mindy's idea to release it on April Fools' day, make people think it's a joke while it isn't (well, all except the RickRoll). I'm glad people actually fell for it.
__________________![]() I'm installing WC3 in my VMWare Win7x64 right now, will test it later. Thanks for reporting that. Well, I can't replicate the crash in VMWare, tried to run it 6 times, no crash. I'll need some more information. Has this happened before with WC3, worldeditor or JNGP? Have you applied any Win7 updates (especially the one targeting WC3)? Any antivirus/firewall software? Anything else you could have installed or turned on in Windows 7 to increase protection against viruses? Which Win7 edition (Ultimate, Professional, Home...)? > Are you and MindworX going to create more natives/extend/work on RtC anymore, or are you completely done with the tool? As I said in the first post, this tool's goal is no longer about custom natives, but rather an API for easily adding more. It is not considered complete, we may add some more features like GetItemInfoStruct which is currently missing or maybe a DirectX hook, we may change it a bit, but point is that natives are not part of RtC. That said, we will release native packs for this project as time permits. I'm currently working on Jass.NET, native packs are more of Mindy's department so he can give more info on that. You are free to make native requests. It's difficult to define what's possible and what isn't ATM so let your imagination run wild and assume we can do it. ![]() Last edited by SFilip : 04-03-2010 at 01:33 PM. |
![]() |
![]() |
![]() |
#8 | |
Perfectionist noob
Join Date: Mar 2009
Posts: 255
![]() ![]() |
![]() Quote:
|
|
![]() |
![]() |
![]() |
#9 |
reenignE
|
![]() OK, I need all of you who experience this problem to try the debug build.
Replace the original rtc.dll and use it as you would use the original, but next time it fails, send me the contents of rctdebug.log. Also, do you run Windows Update regularly? Have you applied KB976264? |
![]() |
![]() |
![]() |
#10 |
Perfectionist noob
Join Date: Mar 2009
Posts: 255
![]() ![]() |
![]() Debug Log
__________________[14:01:10] Event 1 [14:01:10] Event 2 [14:01:10] Event 3 [14:01:10] Event 4 [14:01:10] Event 5 Yes, I've applied all recent updates. |
![]() |
![]() |
![]() |
#11 |
User
Join Date: Aug 2003
Posts: 203
![]() |
![]() Just wanted to tell you how much I appreciate your hard work! Thanks for that (and it works fine on XP 32 Bit)
|
![]() |
![]() |
![]() |
#12 |
Level 1 Neothelid
Tools Moderator
Join Date: Mar 2004
Posts: 254
![]() |
![]() Here's what RtC gives you when you're bored
http://www.wc3c.net/pastebint.php?t=...35067b421165f5 Uses only the UserInputAPI |
![]() |
![]() |
![]() |
#13 | |
reenignE
|
![]() Quote:
|
|
![]() |
![]() |
![]() |
#14 |
User
Join Date: Mar 2009
Posts: 147
![]() |
![]() Great that it's finally out!
Forgive me if I'm wrong, but this doesn't seem to give any way of telling if the key is pressed, released or held in the key event. Doesn't that make the key events pretty much useless? EDIT: Sorry, after looking at the source code for UserInputAPI I realised the "integer key" parameter of TriggerRegisterKeyEvent means down, up or held. I thought it just meant the key to detect, but it seems all keys are detected. You could have made it clearer by giving it a better parameter name... Last edited by Element of Water : 04-04-2010 at 05:54 PM. |
![]() |
![]() |
![]() |
#15 |
reenignE
|
![]() Right, the second integer parameter for TriggerRegisterKeyEvent and TriggerRegisterMouseEvent is not key, it's etype, that was a typo (fixed now).
Possible etype values for TriggerRegisterKeyEvent: ![]() constant integer EVENT_KEYUP = 0 constant integer EVENT_KEYDOWN = 1 constant integer EVENT_KEYTYPE = 2 ![]() constant integer EVENT_LMOUSEUP = 0 constant integer EVENT_LMOUSEDOWN = 1 constant integer EVENT_RMOUSEUP = 2 constant integer EVENT_RMOUSEDOWN = 3 constant integer EVENT_MMOUSEUP = 4 constant integer EVENT_MMOUSEDOWN = 5 constant integer EVENT_MOUSEWHEEL = 6 Attached the new common.j with these constants defined, but you can just type the numbers directly if you want. |
![]() |
![]() |
![]() |
Thread Tools | Search this Thread |
|
|