Skip to content

Commit

Permalink
Version 1.69 for v0.42.0
Browse files Browse the repository at this point in the history
* Add 4 new Adventure AI functions
* Add {pos.relative} which works just like {click.relative}, but computes a vector that can be used anywhere.
  • Loading branch information
d0sboots committed Feb 20, 2024
1 parent c631df8 commit 58ff807
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 10 deletions.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

<div class="editor-info">
<div>
<span class="infotext">Editor: 1.68 ─ Game: v0.36.0</span>
<span class="infotext">Editor: 1.69 ─ Game: v0.42.0</span>
<br/>
<span id="warning" class="infotext warning">Cannot access Local Storage. Scripts will not save!</span>
<a id="compression" class="infotext warning" target="_blank" style="display:none" href="old_browser.html">
Expand Down
9 changes: 9 additions & 0 deletions scripts/lexer-functions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ local strings = {
difficulty = {"easy", "medium", "hard", "insane", "nightmare", "impossible"},

eraDivider = {"damage", "health"},

keyItem = {"map", "emeraldMap", "compass", "ultraKey", "lantern", "eodArmor", "thornsArmor", "bootsHaste", "bootsPhasing", "leechSword", "impaler", "manaReaver", "hammer", "holyBomb", "market", "bookSpells", "bag", "masterSword", "masterArmor"},
};

for _, tbl in pairs (strings) do
Expand Down Expand Up @@ -75,6 +77,8 @@ VALIDATOR = {
difficulty = function(value) return stringValid("difficulty", value, "Difficulties"); end,

eraDivider = function(value) return stringValid("eraDivider", value, "Era dividers"); end,

keyItem = function(value) return stringValid("keyItem", value, "Key Items/Relics"); end,
};

local primitives = {void=1, impulse=1, bool=1, int=1, double=1, string=1, vector=1, op_set=2, op_comp=2, op_mod=2};
Expand Down Expand Up @@ -294,7 +298,11 @@ int arcade.adventure.playerHealth() Arcade #adventure.playerHealth#
int arcade.adventure.playerArmor() Arcade #adventure.playerArmor#
int arcade.adventure.playerAttack() Arcade #adventure.playerAttack#
int arcade.adventure.bombs() Arcade #adventure.bombs#
int arcade.adventure.emerald() Arcade #adventure.emeralds#
int arcade.adventure.keys() Arcade #adventure.keys#
int arcade.adventure.mana() Arcade #adventure.mana#
bool arcade.adventure.hasPhoenixFeather() Arcade
bool arcade.adventure.hasItem(string:item[keyItem]) Arcade #adventure.hasItem#
bool arcade.adventure.isWall(vector:position) Arcade #adventure.isWall#
bool arcade.adventure.isBomb(vector:position) Arcade #adventure.isBomb#
bool arcade.adventure.isEnemy(vector:position) Arcade #adventure.isEnemy#
Expand Down Expand Up @@ -345,6 +353,7 @@ void tradingpost.trade(int:offer, double:pct[0-1]) Trading Post
void bogus() Macros {Macros any {lua(lua_code)}}
void bogus() Macros {Macros int {len(any_characters)}}
void bogus() Macros {Macros vector {pos.relative(double:x_pos[0-1], double:y_pos[0-1], double:x_anchor[0-1], double:y_anchor[0-1])}}
void bogus() Macros {Macros void {click.relative(double:x_pos[0-1], double:y_pos[0-1], double:x_anchor[0-1], double:y_anchor[0-1])}}
]]

Expand Down
20 changes: 11 additions & 9 deletions scripts/stdlib.lua
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
STDLIB = [==[
#click.relative(x_pos, y_pos, x_anchor, y_anchor) {lua(\
local x_pos = [[{x_pos}]]\
local y_pos = [[{y_pos}]]\
local x_anchor = [[{x_anchor}]]\
local y_anchor = [[{y_anchor}]]\
STDLIB = [===[
#pos.relative(x_pos, y_pos, x_anchor, y_anchor) {lua(\
local x_pos = [==[{x_pos}]==]\
local y_pos = [==[{y_pos}]==]\
local x_anchor = [==[{x_anchor}]==]\
local y_anchor = [==[{y_anchor}]==]\
\
function eq_part(term1, pos, anchor, mult)\
local pos_num, anchor_num = tonumber(pos), tonumber(anchor)\
Expand All @@ -27,8 +27,10 @@ STDLIB = [==[
return first_part .. last_part\
end\
\
return "click(vec(" ..\
return "vec(" ..\
eq_part("min(width.d(), (16./9.) * height.d()) * ui.size()", x_pos, x_anchor, "width.d()") .. ", " ..\
eq_part("min(height.d(), (9./16.) * width.d()) * ui.size()", y_pos, y_anchor, "height.d()") .. "))"\
eq_part("min(height.d(), (9./16.) * width.d()) * ui.size()", y_pos, y_anchor, "height.d()") .. ")"\
)}
]==]
#click.relative(x_pos, y_pos, x_anchor, y_anchor) click({pos.relative({x_pos},{y_pos},{x_anchor},{y_anchor})})
]===]

0 comments on commit 58ff807

Please sign in to comment.