From 845464f03cea4c21c8f47f60e70c56cea678a0d0 Mon Sep 17 00:00:00 2001 From: JappaWakka Date: Wed, 27 Dec 2023 17:10:54 +0100 Subject: [PATCH] Added @Item.Use(ItemID) command @Item.Use(ItemID) Uses the specified item if the player has it. --- P3D/World/ActionScript/V2/ScriptCommands/DoItem.vb | 5 +++++ P3D/World/ActionScript/V2/ScriptLibrary.vb | 1 + 2 files changed, 6 insertions(+) diff --git a/P3D/World/ActionScript/V2/ScriptCommands/DoItem.vb b/P3D/World/ActionScript/V2/ScriptCommands/DoItem.vb index 068974bb1..84e9cfaeb 100644 --- a/P3D/World/ActionScript/V2/ScriptCommands/DoItem.vb +++ b/P3D/World/ActionScript/V2/ScriptCommands/DoItem.vb @@ -135,6 +135,11 @@ steps = 250 End Select Core.Player.RepelSteps += steps + Case "use" + Dim itemID As String = argument + If Core.Player.Inventory.GetItemAmount(itemID) > 0 Then + Item.GetItemByID(itemID).Use() + End If Case "select" Dim allowedPages As Integer() Dim allowedItems As New List(Of String) diff --git a/P3D/World/ActionScript/V2/ScriptLibrary.vb b/P3D/World/ActionScript/V2/ScriptLibrary.vb index e8cfc4dfa..69859bf55 100644 --- a/P3D/World/ActionScript/V2/ScriptLibrary.vb +++ b/P3D/World/ActionScript/V2/ScriptLibrary.vb @@ -290,6 +290,7 @@ Namespace ScriptVersion2 r(New ScriptCommand("item", "messagegive", {New ScriptArgument("ItemID", ScriptArgument.ArgumentTypes.Int), New ScriptArgument("Amount", ScriptArgument.ArgumentTypes.Int, True, "1")}.ToList(), "Displays a message for getting the specified amount of items.")) r(New ScriptCommand("item", "repel", {New ScriptArgument("RepelItemID", ScriptArgument.ArgumentTypes.Int, {"20", "42", "43"})}.ToList(), "Adds the steps of the Repel to the Repel steps of the player.")) + r(New ScriptCommand("item", "use", {New ScriptArgument("ItemID", ScriptArgument.ArgumentTypes.Str)}.ToList(), "Uses the specified item if the player has it.")) r(New ScriptCommand("item", "select", {New ScriptArgument("AllowedPages", ScriptArgument.ArgumentTypes.Str, True, "-1"), New ScriptArgument("AllowedItems", ScriptArgument.ArgumentTypes.Str, True, "-1")}.ToList(), "Opens an item select screen with only the specified item type pages (separated with "";"", e.g. ""0;1;2"" or ""standard;medicine;plants"") and possible item IDs (single items separated with "";"", or with a ""-"" if you want a range, e.g. ""2000-2066"")."))