Skip to content

Commit

Permalink
Readme update.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ev3nt committed Jul 11, 2022
1 parent 7a9d5e2 commit 502be34
Show file tree
Hide file tree
Showing 5 changed files with 94 additions and 18 deletions.
Binary file added Pictures/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Pictures/2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Pictures/3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Pictures/4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
112 changes: 94 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,105 @@
# War3 Lua - 1.1.8 (<span style="color:orange">Outland</span>)

[![build](https://github.com/Ev3nt/war3_lua/actions/workflows/build.yml/badge.svg)](https://github.com/Ev3nt/war3_lua/actions/workflows/build.yml)
![lua](https://img.shields.io/badge/lua-v5.4.4-blue)
![warcraft](https://img.shields.io/badge/warcraft-1.26a-darkgreen)
![license](https://img.shields.io/github/license/Ev3nt/war3_lua?color=green)
![forks](https://img.shields.io/github/forks/Ev3nt/war3_lua?style=social)

War3 Lua is a modification that allows you to run lua scripts at the JASS level. Lua does not replace the original scripting system in the game, but only expands its capabilities.
**War3 Lua** - modification that allows you to run lua scripts at the JASS level. Lua does not replace the original scripting system in the game, but only expands its capabilities.

Some natives doesn't work (thx jass for beautiful VM).

Lua version: **5.4.4**
![](./war3_lua.png)

![](https://github.com/Ev3nt/war3_lua/blob/master/war3_lua.png)

---
### Installation requirements
* Warcraft III - TFT 1.26
* [Visual C++ Redistributable for Visual Studio 2015](https://www.microsoft.com/en-US/download/details.aspx?id=48145)
## Pictures

---
### Instruction
* Move the folder Scripts, Maps and war3_lua.mix to the game folder
* Run the game
* Open the map with war3map.lua file inside
![](./Pictures/1.png)

---
### Recommended build parameters
* Configuration **Release**
* Windows platform **x86**
* Platform **10.0.19041.0**
* Build tools **Visual Studio 2015 (v140)**
![](./Pictures/2.png)

![](./Pictures/3.png)

![](./Pictures/4.png)

## Usage
Just create **war3map.lua** and move into your map. You can use fast code testing by including external script. Don't forget to use **developer mode** to unlock some features.

*war3map.lua*
```lua
require "script"
```

*script.lua*
```lua
local unit = CreateUnit(Player(0), FourCC("Hpal"), 0, 0, 0) --> Creating unit
SetUnitColor(unit, Player(1)) --> Changing color
```

If you wanna display some text, use "**print**" to type it in the chat, and "**printc**" to display text in console. Don't forget to use **console mode**.

## Example

There's a little code to showing jass leaks and memory that's being used by the **lua machine**.

```lua
local ITERATION_COUNT = 100;
TimerStart(CreateTimer(), 0, false, function()
statisticLeaderboard = CreateLeaderboard();
LeaderboardSetLabel(statisticLeaderboard, "Debug stats");
PlayerSetLeaderboard(GetLocalPlayer(), statisticLeaderboard);
LeaderboardDisplay(statisticLeaderboard, true);

LeaderboardAddItem(statisticLeaderboard,"Handles", 0, Player(0))
LeaderboardAddItem(statisticLeaderboard,"Used memory", 0, Player(1))

LeaderboardSetSizeByItemCount(statisticLeaderboard, 2);

TimerStart(GetExpiredTimer(), 0.1, true, function()
local result = 0
local min = -1
local locs = {}

for i = 1, ITERATION_COUNT do
local loc = Location(0, 0)
locs[i] = loc

local id = GetHandleId(loc)
id = id - 0x100000

if min == -1 then
min = id
end

if id > result then
result = id
elseif id < min then
min = id
end
end

if result - min > ITERATION_COUNT then
result = min
else
result = result - ITERATION_COUNT
end

for i = 1, #locs do
RemoveLocation(locs[i])
end

LeaderboardSetItemValue(statisticLeaderboard, 0, R2I(result));
LeaderboardSetItemValue(statisticLeaderboard, 1, R2I(collectgarbage("count")));
end)
end)
```

## Installation
* Move the folder Scripts, Maps and **war3_lua.mix** to the game folder
* Run the game (type "*-dev*" to activate **developer mode** and "*-console*" to use console)
* Open the map with **war3map.lua** file inside

## License

This modification is available as open source under the terms of the [MIT License](https://github.com/Ev3nt/war3_lua/blob/master/LICENSE.md).

0 comments on commit 502be34

Please sign in to comment.