- Joined
- Jun 23, 2007
- Messages
- 4,066
Note: The easiest way to start developing with SharpCraft is to download my JNGP Package
This is a plugin which you can import into your map that will allow some custom features. It works in B.NET and it's completely optional.
All you need to do is import the attached file into your map with the following path:
"plugins\SharpCraftExtensions.dll"
Then you will have access to B.NET ready features as long someone is running SharpCraft. You can access the commands through
Currently there is only one custom command implemented.
To make things easier, you can copy these vJass libraries over to your map.
Here is an example usage of the HTTP library.
This is a plugin which you can import into your map that will allow some custom features. It works in B.NET and it's completely optional.
All you need to do is import the attached file into your map with the following path:
"plugins\SharpCraftExtensions.dll"
Then you will have access to B.NET ready features as long someone is running SharpCraft. You can access the commands through
gamecache
and the Cheat
function. This way we don't have to add any custom natives and the map will still work with the vanilla game, and online.Currently there is only one custom command implemented.
- HTTP
JASS:
call StoreString(SharpCraftCache, "ARG", "0", "HTTP")
call StoreString(SharpCraftCache, "ARG", "1", "URL = www.google.com") // download websie
call StoreString(SharpCraftCache, "ARG", "2", "END")
call Cheat("RunSharpCraftCommand")
call TriggerSleepAction(2)
call Cheat("StoreLastResults HTTP")
call BJDebugMsg(GetStoredString(SharpCraftCache, "HTTP", "0")) // display result of website
- SharpCraft Extensions - These will allow you to detect which players in the map have SharpCraft running.
- HttpRequest - This will make dealing with HTTP requests very simple.
Here is an example usage of the HTTP library.
JASS:
scope HttpExample initializer Init
private function OnDownloadString takes nothing returns boolean
local HttpRequest req = GetEventHttpRequest() // or HttpRequest.last()
call BJDebugMsg(GetPlayerName(req.player) + " downloaded \"" + req.response + "\"")
call req.destroy()
return false
endfunction
private function OnMapStart takes nothing returns boolean
local HttpRequest http = HttpRequest.create(FindPlayerWithSharpCraft(), "www.hiveworkshop.com/attachments/hello-txt.248392/")
if (http.player == null) then
call BJDebugMsg(SCOPE_PREFIX + "No players have SharpCraft installed.")
return false
endif
set http.callback = Filter(function OnDownloadString)
call BJDebugMsg("Downloading " + http.url)
call http.start()
return false
endfunction
//===========================================================================
private function Init takes nothing returns nothing
call OnSharpCraftInit(function OnMapStart)
endfunction
endscope
Attachments
Last edited: