wc3campaigns
WC3C Homepage - www.wc3c.netUser Control Panel (Requires Log-In)Engage in discussions with other users and join contests in the WC3C forums!Read one of our many tutorials, ranging in difficulty from beginner to advanced!Show off your artistic talents in the WC3C Gallery!Download quality models, textures, spells (vJASS/JASS), systems, and scripts!Download maps that have passed through our rigorous approval process!

Go Back   Wc3C.net > Warcraft III Modding > Developer's Corner > Warcraft Editing Tools
User Name
Password
Register Rules Get Hosted! Chat Pastebin FAQ and Rules Members List Calendar



Reply
 
Thread Tools Search this Thread
Old 04-01-2010, 08:42 PM   #1
SFilip
reenignE
 
SFilip's Avatar
 
Join Date: Mar 2006
Posts: 321

SFilip has a spectacular aura about (111)SFilip has a spectacular aura about (111)SFilip has a spectacular aura about (111)SFilip has a spectacular aura about (111)

Send a message via MSN to SFilip
Default RtC 1.0 - FINALLY RELEASED

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:
  • NoCheat - disables cheats
  • NoPause - prevents the game from pausing when a menu or dialog is open in single player
  • NoInstanceLimit - allows you to run more than one instance of WC3

We also included some nice natives for you to use:
Collapse JASS:
//============================================================================
// 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:
  • Extract RtC.zip somewhere
  • Import the common.j from source\plugins to your map and use the natives
  • Play the map by running RtC's launcher.exe instead of war3.exe

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:
  • SFilip and MindWorX - most of the coding & ideas
  • InfinityNexus - for making the sexy splash screen, launcher icon and a lot of other stuff we never really used
  • PipeDream for making grimoire which we used as reference and help on multiple occasions
  • xttocs - for making jAPI without which this probably wouldn't be possible
  • Jack Daniel for making a drink that inspired me on some occasions
Attached Files
File Type: zip RtC.zip (392.9 KB, 1668 views)
__________________
Want to create your own natives for Jass? Try RtC project's nAPI

Last edited by SFilip : 04-04-2010 at 04:43 PM.
SFilip is offline   Reply With Quote
Sponsored Links - Login to hide this ad!
Old 04-01-2010, 09:03 PM   #2
Ammorth
I blink, therefore I am.
 
Ammorth's Avatar
 
Join Date: Sep 2006
Posts: 1,812

Submissions (10)

Ammorth is a glorious beacon of light (461)Ammorth is a glorious beacon of light (461)Ammorth is a glorious beacon of light (461)Ammorth is a glorious beacon of light (461)

Default

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!
__________________
Ammorth is offline   Reply With Quote
Old 04-01-2010, 10:29 PM   #3
TriggerHappy
 
Join Date: Feb 2008
Posts: 404

Submissions (2)

TriggerHappy will become famous soon enough (43)TriggerHappy will become famous soon enough (43)

Default

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 04:21 PM.
TriggerHappy is offline   Reply With Quote
Old 04-02-2010, 03:19 PM   #4
Ammorth
I blink, therefore I am.
 
Ammorth's Avatar
 
Join Date: Sep 2006
Posts: 1,812

Submissions (10)

Ammorth is a glorious beacon of light (461)Ammorth is a glorious beacon of light (461)Ammorth is a glorious beacon of light (461)Ammorth is a glorious beacon of light (461)

Default

Quote:
Originally Posted by Ammorth
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!

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 04:09 PM.
Ammorth is offline   Reply With Quote
Old 04-03-2010, 04:30 AM   #5
PurgeandFire111
User
 
PurgeandFire111's Avatar
 
Join Date: Dec 2006
Posts: 253

PurgeandFire111 will become famous soon enough (58)PurgeandFire111 will become famous soon enough (58)

Default

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 04:46 AM.
PurgeandFire111 is offline   Reply With Quote
Old 04-03-2010, 07:39 AM   #6
Ammorth
I blink, therefore I am.
 
Ammorth's Avatar
 
Join Date: Sep 2006
Posts: 1,812

Submissions (10)

Ammorth is a glorious beacon of light (461)Ammorth is a glorious beacon of light (461)Ammorth is a glorious beacon of light (461)Ammorth is a glorious beacon of light (461)

Default

Quote:
Originally Posted by PurgeandFire111
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)

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 07:41 AM.
Ammorth is offline   Reply With Quote
Old 04-03-2010, 10:14 AM   #7
SFilip
reenignE
 
SFilip's Avatar
 
Join Date: Mar 2006
Posts: 321

SFilip has a spectacular aura about (111)SFilip has a spectacular aura about (111)SFilip has a spectacular aura about (111)SFilip has a spectacular aura about (111)

Send a message via MSN to SFilip
Default

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.
__________________
Want to create your own natives for Jass? Try RtC project's nAPI

Last edited by SFilip : 04-03-2010 at 12:33 PM.
SFilip is offline   Reply With Quote
Old 04-03-2010, 10:20 PM   #8
0zyx0
Perfectionist noob
 
0zyx0's Avatar
 
Join Date: Mar 2009
Posts: 255

0zyx0 will become famous soon enough (38)0zyx0 will become famous soon enough (38)

Default

Quote:
Originally Posted by Ammorth

"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..."
I also have that problem on Vista 32-bit (Home Premium). My antivirus is Norton Internet Security 2010, I've never had this kind of problem with anything WC3 related before. However, the splash screen does show up.
__________________
My new signature - Now easier to understand than ever!
0zyx0 is offline   Reply With Quote
Old 04-04-2010, 05:54 AM   #9
SFilip
reenignE
 
SFilip's Avatar
 
Join Date: Mar 2006
Posts: 321

SFilip has a spectacular aura about (111)SFilip has a spectacular aura about (111)SFilip has a spectacular aura about (111)SFilip has a spectacular aura about (111)

Send a message via MSN to SFilip
Default

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?
Attached Files
File Type: zip rtc-debug.zip (148.6 KB, 63 views)
__________________
Want to create your own natives for Jass? Try RtC project's nAPI
SFilip is offline   Reply With Quote
Old 04-04-2010, 12:03 PM   #10
0zyx0
Perfectionist noob
 
0zyx0's Avatar
 
Join Date: Mar 2009
Posts: 255

0zyx0 will become famous soon enough (38)0zyx0 will become famous soon enough (38)

Default

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.
__________________
My new signature - Now easier to understand than ever!
0zyx0 is offline   Reply With Quote
Old 04-04-2010, 12:03 PM
0zyx0
This message has been deleted by 0zyx0. Reason: Double post due to some kind of strange lag.
Old 04-04-2010, 01:19 PM   #11
Coffein
User
 
Join Date: Aug 2003
Posts: 203

Coffein has little to show at this moment (0)

Default

Just wanted to tell you how much I appreciate your hard work! Thanks for that (and it works fine on XP 32 Bit)
Coffein is offline   Reply With Quote
Old 04-04-2010, 02:35 PM   #12
MindWorX
Level 1 Neothelid


Tools Moderator
 
Join Date: Mar 2004
Posts: 254

Submissions (2)

MindWorX has a spectacular aura about (147)

Default

Here's what RtC gives you when you're bored
http://www.wc3c.net/pastebint.php?t=...35067b421165f5
Uses only the UserInputAPI
MindWorX is offline   Reply With Quote
Old 04-04-2010, 03:51 PM   #13
SFilip
reenignE
 
SFilip's Avatar
 
Join Date: Mar 2006
Posts: 321

SFilip has a spectacular aura about (111)SFilip has a spectacular aura about (111)SFilip has a spectacular aura about (111)SFilip has a spectacular aura about (111)

Send a message via MSN to SFilip
Default

Quote:
Originally Posted by 0zyx0
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.
Try out this one, hopefully I fixed it. If it fails again, post the debuglog again, should give me some more info this time.
Attached Files
File Type: zip rtc-debug2.zip (150.8 KB, 71 views)
__________________
Want to create your own natives for Jass? Try RtC project's nAPI
SFilip is offline   Reply With Quote
Old 04-04-2010, 04:26 PM   #14
Element of Water
User
 
Element of Water's Avatar
 
Join Date: Mar 2009
Posts: 147

Submissions (2)

Element of Water is on a distinguished road (18)

Default

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 04:54 PM.
Element of Water is offline   Reply With Quote
Old 04-04-2010, 04:58 PM   #15
SFilip
reenignE
 
SFilip's Avatar
 
Join Date: Mar 2006
Posts: 321

SFilip has a spectacular aura about (111)SFilip has a spectacular aura about (111)SFilip has a spectacular aura about (111)SFilip has a spectacular aura about (111)

Send a message via MSN to SFilip
Default

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:
Collapse JASS:
constant integer EVENT_KEYUP = 0
constant integer EVENT_KEYDOWN = 1
constant integer EVENT_KEYTYPE = 2
And for TriggerRegisterMouseEvent:
Collapse JASS:
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.
Attached Files
File Type: zip common.zip (23.4 KB, 37 views)
__________________
Want to create your own natives for Jass? Try RtC project's nAPI
SFilip is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off


All times are GMT. The time now is 04:01 PM.


Affiliates
The Hubb The JASS Vault Clan WEnW Campaign Creations Clan CBS GamesModding Flixreel Videos

Powered by vBulletin (Copyright ©2000 - 2017, Jelsoft Enterprises Ltd).
Hosted by www.OICcam.com
IT Support and Services provided by Executive IT Services