Expanded @Script.Delay with ItemCount DelayType
Also made each Script Delay be defined with an identifier so you can have multiple delays running at the same time! * arg0 = Identifier * arg1 = Script Path * arg2 = Delay Type (Steps, ItemCount) // Steps * arg3 = Amount of steps * arg4 = Whether to display the remaining steps in the start menu //ItemCount * arg3 = Item ID * arg4 = Compare Type (Equal, Below, EqualOrBelow, Above, EqualOrAbove) * arg5 = Item Amount With the ItemCount type you can run a script when you do or do not have a certain amount of items
This commit is contained in:
parent
d49217ff95
commit
9b942ab977
|
@ -663,7 +663,7 @@
|
||||||
_mainMenuItemList.Clear()
|
_mainMenuItemList.Clear()
|
||||||
Select Case BattleScreen.BattleMode
|
Select Case BattleScreen.BattleMode
|
||||||
Case BattleSystem.BattleScreen.BattleModes.Safari
|
Case BattleSystem.BattleScreen.BattleModes.Safari
|
||||||
Dim safariBallText As String = "Safari Ball x" & Core.Player.Inventory.GetItemAmount(181.ToString).ToString()
|
Dim safariBallText As String = Localization.GetString("item_name_181", "Safari Ball") & " x" & Core.Player.Inventory.GetItemAmount(181.ToString).ToString()
|
||||||
If Core.Player.Inventory.GetItemAmount(181.ToString) = 0 Then
|
If Core.Player.Inventory.GetItemAmount(181.ToString) = 0 Then
|
||||||
safariBallText = "No Safari Balls."
|
safariBallText = "No Safari Balls."
|
||||||
End If
|
End If
|
||||||
|
@ -832,6 +832,8 @@
|
||||||
BattleScreen.BattleQuery.Insert(0, New ToggleMenuQueryObject(True))
|
BattleScreen.BattleQuery.Insert(0, New ToggleMenuQueryObject(True))
|
||||||
Core.SetScreen(New BattleCatchScreen(BattleScreen, Item.GetItemByID(181.ToString)))
|
Core.SetScreen(New BattleCatchScreen(BattleScreen, Item.GetItemByID(181.ToString)))
|
||||||
|
|
||||||
|
Core.Player.UsedItemsToCheckScriptDelayFor.Add("181")
|
||||||
|
|
||||||
Dim safariBallText As String = "Safari Ball x" & Core.Player.Inventory.GetItemAmount(181.ToString).ToString()
|
Dim safariBallText As String = "Safari Ball x" & Core.Player.Inventory.GetItemAmount(181.ToString).ToString()
|
||||||
If Core.Player.Inventory.GetItemAmount(181.ToString) = 0 Then
|
If Core.Player.Inventory.GetItemAmount(181.ToString) = 0 Then
|
||||||
safariBallText = "No Safari Balls."
|
safariBallText = "No Safari Balls."
|
||||||
|
|
|
@ -180,6 +180,7 @@
|
||||||
ItemID = Me.Item.ID.ToString
|
ItemID = Me.Item.ID.ToString
|
||||||
End If
|
End If
|
||||||
Core.Player.Inventory.AddItem(ItemID, 1)
|
Core.Player.Inventory.AddItem(ItemID, 1)
|
||||||
|
Core.Player.CheckItemCountScriptDelay(ItemID)
|
||||||
PlayerStatistics.Track("Items found", 1)
|
PlayerStatistics.Track("Items found", 1)
|
||||||
|
|
||||||
Core.Player.AddPoints(1, "Found an item.")
|
Core.Player.AddPoints(1, "Found an item.")
|
||||||
|
|
|
@ -151,6 +151,14 @@
|
||||||
End Set
|
End Set
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
|
Public Property ScriptDelayItems() As String
|
||||||
|
Get
|
||||||
|
Return _ScriptDelayItems
|
||||||
|
End Get
|
||||||
|
Set(value As String)
|
||||||
|
_ScriptDelayItems = value
|
||||||
|
End Set
|
||||||
|
End Property
|
||||||
Public Property ScriptDelaySteps() As Integer
|
Public Property ScriptDelaySteps() As Integer
|
||||||
Get
|
Get
|
||||||
Return _ScriptDelaySteps
|
Return _ScriptDelaySteps
|
||||||
|
@ -159,6 +167,14 @@
|
||||||
_ScriptDelaySteps = value
|
_ScriptDelaySteps = value
|
||||||
End Set
|
End Set
|
||||||
End Property
|
End Property
|
||||||
|
Public Property ScriptDelayDisplaySteps() As Boolean
|
||||||
|
Get
|
||||||
|
Return _ScriptDelayDisplaySteps
|
||||||
|
End Get
|
||||||
|
Set(value As Boolean)
|
||||||
|
_ScriptDelayDisplaySteps = value
|
||||||
|
End Set
|
||||||
|
End Property
|
||||||
|
|
||||||
Public Property SaveCreated() As String
|
Public Property SaveCreated() As String
|
||||||
Get
|
Get
|
||||||
|
@ -391,6 +407,7 @@
|
||||||
Public TempRideSkin As String = ""
|
Public TempRideSkin As String = ""
|
||||||
Public Statistics As String = ""
|
Public Statistics As String = ""
|
||||||
Public CheckForTrainersLater As Boolean = False
|
Public CheckForTrainersLater As Boolean = False
|
||||||
|
Public UsedItemsToCheckScriptDelayFor As New List(Of String)
|
||||||
|
|
||||||
'Secure fields:
|
'Secure fields:
|
||||||
Private _name As String = "<player.name>"
|
Private _name As String = "<player.name>"
|
||||||
|
@ -410,6 +427,8 @@
|
||||||
Private _lastSavePlacePosition As String = "1,0.1,3"
|
Private _lastSavePlacePosition As String = "1,0.1,3"
|
||||||
Private _repelSteps As Integer = 0
|
Private _repelSteps As Integer = 0
|
||||||
Private _ScriptDelaySteps As Integer = 0
|
Private _ScriptDelaySteps As Integer = 0
|
||||||
|
Private _ScriptDelayItems As String = ""
|
||||||
|
Private _ScriptDelayDisplaySteps As Boolean = False
|
||||||
Private _saveCreated As String = "Pre 0.21"
|
Private _saveCreated As String = "Pre 0.21"
|
||||||
Private _daycareSteps As Integer = 0
|
Private _daycareSteps As Integer = 0
|
||||||
Private _poisonSteps As Integer = 0
|
Private _poisonSteps As Integer = 0
|
||||||
|
@ -746,8 +765,12 @@
|
||||||
End If
|
End If
|
||||||
Case "repelsteps"
|
Case "repelsteps"
|
||||||
RepelSteps = CInt(Value)
|
RepelSteps = CInt(Value)
|
||||||
|
Case "scriptdelayitems"
|
||||||
|
ScriptDelayItems = Value
|
||||||
Case "scriptdelaysteps"
|
Case "scriptdelaysteps"
|
||||||
ScriptDelaySteps = CInt(Value)
|
ScriptDelaySteps = CInt(Value)
|
||||||
|
Case "scriptdelaydisplaysteps"
|
||||||
|
ScriptDelayDisplaySteps = CBool(Value)
|
||||||
Case "lastsaveplace"
|
Case "lastsaveplace"
|
||||||
LastSavePlace = Value
|
LastSavePlace = Value
|
||||||
Case "lastsaveplaceposition"
|
Case "lastsaveplaceposition"
|
||||||
|
@ -1252,7 +1275,9 @@
|
||||||
"LastRestPlacePosition|" & LastRestPlacePosition & Environment.NewLine &
|
"LastRestPlacePosition|" & LastRestPlacePosition & Environment.NewLine &
|
||||||
"DiagonalMovement|" & DiagonalMovement.ToNumberString() & Environment.NewLine &
|
"DiagonalMovement|" & DiagonalMovement.ToNumberString() & Environment.NewLine &
|
||||||
"RepelSteps|" & RepelSteps.ToString() & Environment.NewLine &
|
"RepelSteps|" & RepelSteps.ToString() & Environment.NewLine &
|
||||||
|
"ScriptDelayItems|" & ScriptDelayItems.ToString() & Environment.NewLine &
|
||||||
"ScriptDelaySteps|" & ScriptDelaySteps.ToString() & Environment.NewLine &
|
"ScriptDelaySteps|" & ScriptDelaySteps.ToString() & Environment.NewLine &
|
||||||
|
"ScriptDelayDisplaySteps|" & ScriptDelayDisplaySteps.ToNumberString() & Environment.NewLine &
|
||||||
"LastSavePlace|" & LastSavePlace & Environment.NewLine &
|
"LastSavePlace|" & LastSavePlace & Environment.NewLine &
|
||||||
"LastSavePlacePosition|" & LastSavePlacePosition & Environment.NewLine &
|
"LastSavePlacePosition|" & LastSavePlacePosition & Environment.NewLine &
|
||||||
"Difficulty|" & DifficultyMode.ToString() & Environment.NewLine &
|
"Difficulty|" & DifficultyMode.ToString() & Environment.NewLine &
|
||||||
|
@ -1791,13 +1816,29 @@
|
||||||
If ScriptDelaySteps <= 0 Then
|
If ScriptDelaySteps <= 0 Then
|
||||||
If CurrentScreen.Identification = Screen.Identifications.OverworldScreen Then
|
If CurrentScreen.Identification = Screen.Identifications.OverworldScreen Then
|
||||||
If CanFireStepEvent() = True Then
|
If CanFireStepEvent() = True Then
|
||||||
If ActionScript.IsRegistered("SCRIPTDELAY") = True Then
|
Dim Data() As String = Core.Player.RegisterData.Split(CChar(","))
|
||||||
Dim registerContent() As Object = ActionScript.GetRegisterValue("SCRIPTDELAY")
|
Dim StepDelayRegisterName As String = ""
|
||||||
|
For Each line As String In Data
|
||||||
|
If line.StartsWith("[") = True And line.Contains("]") = True And line.EndsWith("]") = False Then
|
||||||
|
Dim lineName As String = line.Remove(0, line.IndexOf("]") + 1)
|
||||||
|
Dim delayID As String = ""
|
||||||
|
If lineName.StartsWith("SCRIPTDELAY_") Then
|
||||||
|
Dim registerContent() As Object = ActionScript.GetRegisterValue(lineName)
|
||||||
|
Dim delayType As String = CStr(registerContent(0)).GetSplit(0, ";")
|
||||||
|
If delayType.ToLower = "steps" Then
|
||||||
|
StepDelayRegisterName = lineName
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
If StepDelayRegisterName <> "" Then
|
||||||
|
ScriptDelayDisplaySteps = False
|
||||||
|
Dim registerContent() As Object = ActionScript.GetRegisterValue(StepDelayRegisterName)
|
||||||
|
|
||||||
If registerContent(0) Is Nothing Or registerContent(1) Is Nothing Then
|
If registerContent(0) Is Nothing Or registerContent(1) Is Nothing Then
|
||||||
Logger.Log(Logger.LogTypes.Warning, "ScriptComparer.vb: No valid script has been set to be executed.")
|
Logger.Log(Logger.LogTypes.Warning, "ScriptComparer.vb: No valid script has been set to be executed.")
|
||||||
ActionScript.UnregisterID("SCRIPTDELAY", "str")
|
ActionScript.UnregisterID(StepDelayRegisterName, "str")
|
||||||
ActionScript.UnregisterID("SCRIPTDELAY")
|
ActionScript.UnregisterID(StepDelayRegisterName)
|
||||||
Exit Sub
|
Exit Sub
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
@ -1806,8 +1847,8 @@
|
||||||
Dim DelayValue As String = CStr(registerContent(0)).GetSplit(1, ";")
|
Dim DelayValue As String = CStr(registerContent(0)).GetSplit(1, ";")
|
||||||
|
|
||||||
CType(CurrentScreen, OverworldScreen).ActionScript.StartScript(DelayValue, 0, False)
|
CType(CurrentScreen, OverworldScreen).ActionScript.StartScript(DelayValue, 0, False)
|
||||||
ActionScript.UnregisterID("SCRIPTDELAY", "str")
|
ActionScript.UnregisterID(StepDelayRegisterName, "str")
|
||||||
ActionScript.UnregisterID("SCRIPTDELAY")
|
ActionScript.UnregisterID(StepDelayRegisterName)
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
Else
|
Else
|
||||||
|
@ -1958,6 +1999,72 @@
|
||||||
|
|
||||||
#End Region
|
#End Region
|
||||||
|
|
||||||
|
Public Sub CheckItemCountScriptDelay(itemID As String)
|
||||||
|
Dim ItemDelayList As List(Of String) = Core.Player.ScriptDelayItems.Split(";").ToList
|
||||||
|
For Each entry As String In ItemDelayList
|
||||||
|
If entry.GetSplit(1, ",").ToLower = itemID.ToLower Then
|
||||||
|
Dim inventoryAmount As Integer = Core.Player.Inventory.GetItemAmount(itemID)
|
||||||
|
Dim Match As Boolean = False
|
||||||
|
Select Case entry.GetSplit(2, ",")
|
||||||
|
Case "=", "equal"
|
||||||
|
If inventoryAmount = CInt(entry.GetSplit(3, ",")) Then
|
||||||
|
Match = True
|
||||||
|
End If
|
||||||
|
Case "<", "below"
|
||||||
|
If inventoryAmount < CInt(entry.GetSplit(3, ",")) Then
|
||||||
|
Match = True
|
||||||
|
End If
|
||||||
|
Case "<=", "equalorbelow"
|
||||||
|
If inventoryAmount <= CInt(entry.GetSplit(3, ",")) Then
|
||||||
|
Match = True
|
||||||
|
End If
|
||||||
|
Case ">", "above"
|
||||||
|
If inventoryAmount > CInt(entry.GetSplit(3, ",")) Then
|
||||||
|
Match = True
|
||||||
|
End If
|
||||||
|
Case ">=", "equalorabove"
|
||||||
|
If inventoryAmount >= CInt(entry.GetSplit(3, ",")) Then
|
||||||
|
Match = True
|
||||||
|
End If
|
||||||
|
End Select
|
||||||
|
|
||||||
|
If Match = True Then
|
||||||
|
Dim DelayRegisterName As String = "SCRIPTDELAY_" & entry.GetSplit(0, ",")
|
||||||
|
|
||||||
|
Dim Data() As String = Core.Player.RegisterData.Split(CChar(","))
|
||||||
|
ScriptDelayDisplaySteps = False
|
||||||
|
Dim registerContent() As Object = ActionScript.GetRegisterValue(DelayRegisterName)
|
||||||
|
|
||||||
|
If registerContent(0) Is Nothing Or registerContent(1) Is Nothing Then
|
||||||
|
Logger.Log(Logger.LogTypes.Warning, "ScriptComparer.vb: No valid script has been set to be executed.")
|
||||||
|
ActionScript.UnregisterID(DelayRegisterName, "str")
|
||||||
|
ActionScript.UnregisterID(DelayRegisterName)
|
||||||
|
End If
|
||||||
|
|
||||||
|
Dim DelayType As String = CStr(registerContent(0)).GetSplit(0, ";")
|
||||||
|
If DelayType.ToLower = "itemcount" Then
|
||||||
|
Dim DelayValue As String = CStr(registerContent(0)).GetSplit(1, ";")
|
||||||
|
|
||||||
|
Dim s As Screen = CurrentScreen
|
||||||
|
While s.Identification <> Screen.Identifications.OverworldScreen And Not s.PreScreen Is Nothing
|
||||||
|
s = s.PreScreen
|
||||||
|
End While
|
||||||
|
If s.Identification = Screen.Identifications.OverworldScreen Then
|
||||||
|
CType(CurrentScreen, OverworldScreen).ActionScript.StartScript(DelayValue, 0, False)
|
||||||
|
|
||||||
|
ActionScript.UnregisterID(DelayRegisterName, "str")
|
||||||
|
ActionScript.UnregisterID(DelayRegisterName)
|
||||||
|
ItemDelayList.Remove(entry)
|
||||||
|
Exit For
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
Core.Player.ScriptDelayItems = String.Join(";", ItemDelayList)
|
||||||
|
|
||||||
|
End Sub
|
||||||
|
|
||||||
Public Sub AddVisitedMap(ByVal mapFile As String)
|
Public Sub AddVisitedMap(ByVal mapFile As String)
|
||||||
Dim maps As List(Of String) = VisitedMaps.Split(CChar(",")).ToList()
|
Dim maps As List(Of String) = VisitedMaps.Split(CChar(",")).ToList()
|
||||||
|
|
||||||
|
@ -2129,6 +2236,7 @@
|
||||||
DaycareData = ""
|
DaycareData = ""
|
||||||
HallOfFameData = ""
|
HallOfFameData = ""
|
||||||
RoamingPokemonData = ""
|
RoamingPokemonData = ""
|
||||||
|
UsedItemsToCheckScriptDelayFor.Clear()
|
||||||
|
|
||||||
filePrefix = "nilllzz"
|
filePrefix = "nilllzz"
|
||||||
newFilePrefix = ""
|
newFilePrefix = ""
|
||||||
|
|
|
@ -999,6 +999,12 @@ Public Class NewInventoryScreen
|
||||||
Case INFO_ITEM_OPTION_USE
|
Case INFO_ITEM_OPTION_USE
|
||||||
cItem.Use()
|
cItem.Use()
|
||||||
LoadItems()
|
LoadItems()
|
||||||
|
If Me.PreScreen.Identification = Screen.Identifications.BattleScreen Then
|
||||||
|
Core.Player.UsedItemsToCheckScriptDelayFor.Add(_items(ItemIndex + PageIndex * 10).ItemID)
|
||||||
|
Else
|
||||||
|
Core.Player.CheckItemCountScriptDelay(_items(ItemIndex + PageIndex * 10).ItemID)
|
||||||
|
End If
|
||||||
|
|
||||||
Case INFO_ITEM_OPTION_GIVE
|
Case INFO_ITEM_OPTION_GIVE
|
||||||
Dim selScreen = New PartyScreen(Core.CurrentScreen) With {.Mode = ISelectionScreen.ScreenMode.Selection, .CanExit = True}
|
Dim selScreen = New PartyScreen(Core.CurrentScreen) With {.Mode = ISelectionScreen.ScreenMode.Selection, .CanExit = True}
|
||||||
AddHandler selScreen.SelectedObject, AddressOf GiveItemHandler
|
AddHandler selScreen.SelectedObject, AddressOf GiveItemHandler
|
||||||
|
|
|
@ -108,6 +108,14 @@
|
||||||
|
|
||||||
Private Sub ChangeScreen()
|
Private Sub ChangeScreen()
|
||||||
Core.SetScreen(NewScreen)
|
Core.SetScreen(NewScreen)
|
||||||
|
If OldScreen.Identification = Identifications.BattleScreen And CurrentScreen.Identification = Identifications.OverworldScreen Then
|
||||||
|
If Core.Player.UsedItemsToCheckScriptDelayFor.Count > 0 Then
|
||||||
|
For Each itemEntry As String In Core.Player.UsedItemsToCheckScriptDelayFor
|
||||||
|
Core.Player.CheckItemCountScriptDelay(itemEntry)
|
||||||
|
Next
|
||||||
|
Core.Player.UsedItemsToCheckScriptDelayFor.Clear()
|
||||||
|
End If
|
||||||
|
End If
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Public Delegate Sub DoStuff()
|
Public Delegate Sub DoStuff()
|
||||||
|
|
|
@ -36,6 +36,7 @@
|
||||||
amount = int(item.MaxStack - Core.Player.Inventory.GetItemAmount(_itemID)).Clamp(0, 999)
|
amount = int(item.MaxStack - Core.Player.Inventory.GetItemAmount(_itemID)).Clamp(0, 999)
|
||||||
End If
|
End If
|
||||||
Core.Player.Inventory.AddItem(_itemID, amount)
|
Core.Player.Inventory.AddItem(_itemID, amount)
|
||||||
|
Core.Player.CheckItemCountScriptDelay(_itemID)
|
||||||
End If
|
End If
|
||||||
Case "remove"
|
Case "remove"
|
||||||
Dim amount As Integer = 1
|
Dim amount As Integer = 1
|
||||||
|
@ -75,6 +76,7 @@
|
||||||
|
|
||||||
CanContinue = False
|
CanContinue = False
|
||||||
End If
|
End If
|
||||||
|
Core.Player.CheckItemCountScriptDelay(_itemID)
|
||||||
Case "clearitem"
|
Case "clearitem"
|
||||||
If argument <> "" Then
|
If argument <> "" Then
|
||||||
Dim ItemID As String = argument
|
Dim ItemID As String = argument
|
||||||
|
@ -83,6 +85,7 @@
|
||||||
If amount > 0 Then
|
If amount > 0 Then
|
||||||
Core.Player.Inventory.RemoveItem(ItemID, amount)
|
Core.Player.Inventory.RemoveItem(ItemID, amount)
|
||||||
End If
|
End If
|
||||||
|
Core.Player.CheckItemCountScriptDelay(ItemID)
|
||||||
Else
|
Else
|
||||||
Core.Player.Inventory.Clear()
|
Core.Player.Inventory.Clear()
|
||||||
End If
|
End If
|
||||||
|
@ -149,6 +152,7 @@
|
||||||
Dim itemID As String = argument
|
Dim itemID As String = argument
|
||||||
If Core.Player.Inventory.GetItemAmount(itemID) > 0 Then
|
If Core.Player.Inventory.GetItemAmount(itemID) > 0 Then
|
||||||
Item.GetItemByID(itemID).Use()
|
Item.GetItemByID(itemID).Use()
|
||||||
|
Core.Player.CheckItemCountScriptDelay(itemID)
|
||||||
End If
|
End If
|
||||||
Case "select"
|
Case "select"
|
||||||
Dim allowedPages As Integer()
|
Dim allowedPages As Integer()
|
||||||
|
|
|
@ -20,23 +20,104 @@
|
||||||
CType(Core.CurrentScreen, OverworldScreen).ActionScript.StartScript(argument, 2, True, False, "ScriptCommand")
|
CType(Core.CurrentScreen, OverworldScreen).ActionScript.StartScript(argument, 2, True, False, "ScriptCommand")
|
||||||
Case "delay"
|
Case "delay"
|
||||||
If argument.Contains(",") = True Then
|
If argument.Contains(",") = True Then
|
||||||
ActionScript.UnregisterID("SCRIPTDELAY", "str")
|
'arg 0 = Identifier
|
||||||
ActionScript.UnregisterID("SCRIPTDELAY")
|
'arg 1 = Script Path
|
||||||
Core.Player.ScriptDelaySteps = 0
|
'arg 2 = Delay Type
|
||||||
|
' //Steps
|
||||||
|
'arg 3 = Amount of steps
|
||||||
|
'arg 4 = Whether to display the remaining steps in the start menu
|
||||||
|
' //ItemCount
|
||||||
|
'arg 3 = Item ID
|
||||||
|
'arg 4 = Compare Type
|
||||||
|
'arg 5 = Item Amount
|
||||||
|
|
||||||
Dim args() As String = argument.Split(CChar(","))
|
Dim args() As String = argument.Split(CChar(","))
|
||||||
Select Case args(1).ToLower
|
If ActionScript.IsRegistered("SCRIPTDELAY_" & args(0).ToLower) = True Then
|
||||||
|
ActionScript.UnregisterID("SCRIPTDELAY_" & args(0), "str")
|
||||||
|
ActionScript.UnregisterID("SCRIPTDELAY_" & args(0))
|
||||||
|
End If
|
||||||
|
|
||||||
|
If Core.Player.ScriptDelaySteps > 0 AndAlso args(2).ToLower = "steps" Then
|
||||||
|
Dim Data() As String = Core.Player.RegisterData.Split(CChar(","))
|
||||||
|
|
||||||
|
For Each line As String In Data
|
||||||
|
If line.StartsWith("[") = True And line.Contains("]") = True And line.EndsWith("]") = False Then
|
||||||
|
Dim lineName As String = line.Remove(0, line.IndexOf("]") + 1)
|
||||||
|
Dim delayID As String = ""
|
||||||
|
If lineName.StartsWith("SCRIPTDELAY_") Then
|
||||||
|
Dim registerContent() As Object = ActionScript.GetRegisterValue(lineName)
|
||||||
|
Dim delayType As String = CStr(registerContent(0)).GetSplit(0, ";")
|
||||||
|
If delayType.ToLower = "steps" Then
|
||||||
|
ActionScript.UnregisterID(lineName, "str")
|
||||||
|
ActionScript.UnregisterID(lineName)
|
||||||
|
Core.Player.ScriptDelaySteps = 0
|
||||||
|
Exit For
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
End If
|
||||||
|
|
||||||
|
Select Case args(2).ToLower
|
||||||
Case "steps"
|
Case "steps"
|
||||||
Core.Player.ScriptDelaySteps = CInt(args(2))
|
Core.Player.ScriptDelaySteps = CInt(args(3))
|
||||||
|
Dim DisplaySteps As Boolean = False
|
||||||
|
If args.Count > 4 Then
|
||||||
|
DisplaySteps = CBool(args(4))
|
||||||
|
End If
|
||||||
|
Core.Player.ScriptDelayDisplaySteps = DisplaySteps
|
||||||
|
Case "itemcount"
|
||||||
|
Dim CompareType As String = ""
|
||||||
|
Select Case args(4).ToLower
|
||||||
|
Case "equal"
|
||||||
|
CompareType = "equal"
|
||||||
|
Case "below"
|
||||||
|
CompareType = "below"
|
||||||
|
Case "equalorbelow"
|
||||||
|
CompareType = "equalorbelow"
|
||||||
|
Case "above"
|
||||||
|
CompareType = "above"
|
||||||
|
Case "equalorabove"
|
||||||
|
CompareType = "equalorabove"
|
||||||
|
End Select
|
||||||
|
If args(3) <> "" And CompareType <> "" And StringHelper.IsNumeric(args(5)) Then
|
||||||
|
If Core.Player.ScriptDelayItems.Contains(args(0) & "," & args(3) & "," & CompareType & "," & CInt(args(5))) = False Then
|
||||||
|
If Core.Player.ScriptDelayItems <> "" Then
|
||||||
|
Core.Player.ScriptDelayItems &= ";"
|
||||||
|
End If
|
||||||
|
'0=delayIdentifier,1=itemID,2=compareType,3=itemAmount
|
||||||
|
Core.Player.ScriptDelayItems &= args(0) & "," & args(3) & "," & CompareType & "," & CInt(args(5))
|
||||||
|
End If
|
||||||
|
End If
|
||||||
End Select
|
End Select
|
||||||
|
|
||||||
ActionScript.RegisterID("SCRIPTDELAY", "str", CStr(args(1) & ";" & args(0)))
|
ActionScript.RegisterID("SCRIPTDELAY_" & args(0), "str", CStr(args(2).ToLower & ";" & args(1)))
|
||||||
|
|
||||||
End If
|
End If
|
||||||
IsReady = True
|
IsReady = True
|
||||||
Case "cleardelay"
|
Case "cleardelay"
|
||||||
ActionScript.UnregisterID("SCRIPTDELAY", "str")
|
If argument <> "" Then
|
||||||
ActionScript.UnregisterID("SCRIPTDELAY")
|
Dim registerContent() As Object = ActionScript.GetRegisterValue("SCRIPTDELAY_" & argument)
|
||||||
Core.Player.ScriptDelaySteps = 0
|
Dim delayType As String = CStr(registerContent(0)).GetSplit(0, ";")
|
||||||
|
Select Case delayType.ToLower
|
||||||
|
Case "steps"
|
||||||
|
Core.Player.ScriptDelaySteps = 0
|
||||||
|
Core.Player.ScriptDelayDisplaySteps = False
|
||||||
|
Case "itemcount"
|
||||||
|
Dim ItemDelayList As List(Of String) = Core.Player.ScriptDelayItems.Split(",").ToList
|
||||||
|
For Each entry As String In ItemDelayList
|
||||||
|
If entry.GetSplit(0, ",") = argument Then
|
||||||
|
ItemDelayList.Remove(entry)
|
||||||
|
Exit For
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
Core.Player.ScriptDelayItems = String.Join(";", ItemDelayList)
|
||||||
|
End Select
|
||||||
|
|
||||||
|
ActionScript.UnregisterID("SCRIPTDELAY_" & argument, "str")
|
||||||
|
ActionScript.UnregisterID("SCRIPTDELAY_" & argument)
|
||||||
|
End If
|
||||||
|
|
||||||
IsReady = True
|
IsReady = True
|
||||||
End Select
|
End Select
|
||||||
End If
|
End If
|
||||||
|
|
|
@ -12,18 +12,20 @@
|
||||||
|
|
||||||
Select Case command.ToLower()
|
Select Case command.ToLower()
|
||||||
Case "delay"
|
Case "delay"
|
||||||
If ActionScript.IsRegistered("SCRIPTDELAY") = True Then
|
Dim args() As String = argument.Split(CChar(","))
|
||||||
|
|
||||||
Dim registerContent() As Object = ActionScript.GetRegisterValue("SCRIPTDELAY")
|
If ActionScript.IsRegistered("SCRIPTDELAY_" & args(0)) = True Then
|
||||||
|
|
||||||
|
Dim registerContent() As Object = ActionScript.GetRegisterValue("SCRIPTDELAY_" & args(0))
|
||||||
|
|
||||||
If registerContent(0) Is Nothing Or registerContent(1) Is Nothing Then
|
If registerContent(0) Is Nothing Or registerContent(1) Is Nothing Then
|
||||||
Logger.Log(Logger.LogTypes.Warning, "ScriptComparer.vb: No valid script has been set to be executed.")
|
Logger.Log(Logger.LogTypes.Warning, "ScriptComparer.vb: No valid script has been set to be executed.")
|
||||||
ActionScript.UnregisterID("SCRIPTDELAY", "str")
|
ActionScript.UnregisterID("SCRIPTDELAY_" & args(0), "str")
|
||||||
ActionScript.UnregisterID("SCRIPTDELAY")
|
ActionScript.UnregisterID("SCRIPTDELAY_" & args(0))
|
||||||
Return DefaultNull
|
Return DefaultNull
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Select Case argument.ToLower
|
Select Case args(1).ToLower
|
||||||
Case "type"
|
Case "type"
|
||||||
Return CStr(registerContent(0)).GetSplit(0, ";")
|
Return CStr(registerContent(0)).GetSplit(0, ";")
|
||||||
Case "script"
|
Case "script"
|
||||||
|
@ -33,6 +35,14 @@
|
||||||
Select Case DelayType
|
Select Case DelayType
|
||||||
Case "steps"
|
Case "steps"
|
||||||
Return Core.Player.ScriptDelaySteps
|
Return Core.Player.ScriptDelaySteps
|
||||||
|
Case "itemcount"
|
||||||
|
Dim ItemDelayList As List(Of String) = Core.Player.ScriptDelayItems.Split(";").ToList
|
||||||
|
For Each entry As String In ItemDelayList
|
||||||
|
If entry.GetSplit(0, ",") = args(0) Then
|
||||||
|
Return entry.GetSplit(3)
|
||||||
|
Exit For
|
||||||
|
End If
|
||||||
|
Next
|
||||||
End Select
|
End Select
|
||||||
End Select
|
End Select
|
||||||
|
|
||||||
|
|
|
@ -368,11 +368,11 @@ Namespace ScriptVersion2
|
||||||
r(New ScriptCommand("script", "start", {New ScriptArgument("scriptFile", ScriptArgument.ArgumentTypes.Str)}.ToList(), "Starts a script with the given filename (without file extension)."))
|
r(New ScriptCommand("script", "start", {New ScriptArgument("scriptFile", ScriptArgument.ArgumentTypes.Str)}.ToList(), "Starts a script with the given filename (without file extension)."))
|
||||||
r(New ScriptCommand("script", "text", {New ScriptArgument("text", ScriptArgument.ArgumentTypes.Str)}.ToList(), "Starts a script with a simple text to display."))
|
r(New ScriptCommand("script", "text", {New ScriptArgument("text", ScriptArgument.ArgumentTypes.Str)}.ToList(), "Starts a script with a simple text to display."))
|
||||||
r(New ScriptCommand("script", "run", {New ScriptArgument("scriptContent", ScriptArgument.ArgumentTypes.Str)}.ToList(), "Runs script content. New lines are represented with ""^""."))
|
r(New ScriptCommand("script", "run", {New ScriptArgument("scriptContent", ScriptArgument.ArgumentTypes.Str)}.ToList(), "Runs script content. New lines are represented with ""^""."))
|
||||||
r(New ScriptCommand("script", "delay", {New ScriptArgument("scriptPath", ScriptArgument.ArgumentTypes.Str), New ScriptArgument("delayType", ScriptArgument.ArgumentTypes.Str, {"steps"}), New ScriptArgument("delayValue", ScriptArgument.ArgumentTypes.Str)}.ToList(), "Executes a script file after something happened (like having moved a certain amount of steps)."))
|
r(New ScriptCommand("script", "delay", {New ScriptArgument("delayID", ScriptArgument.ArgumentTypes.Str), New ScriptArgument("scriptPath", ScriptArgument.ArgumentTypes.Str), New ScriptArgument("delayType", ScriptArgument.ArgumentTypes.Str, {"steps", "itemcount"}), New ScriptArgument("valueArguments", ScriptArgument.ArgumentTypes.StrArr)}.ToList(), "Executes a script file after something happened (like having moved a certain amount of steps)."))
|
||||||
r(New ScriptCommand("script", "delay", "Clears the register created with @script.delay, preventing the script from being executed."))
|
r(New ScriptCommand("script", "cleardelay", {New ScriptArgument("delayID", ScriptArgument.ArgumentTypes.Str)}.ToList(), "Removes the register with the specified identifier (delayID) created with @script.delay, preventing the script from being executed."))
|
||||||
|
|
||||||
' Constructs:
|
' Constructs:
|
||||||
r(New ScriptCommand("script", "delay", "str,int", {New ScriptArgument("type", ScriptArgument.ArgumentTypes.Str, {"type", "script", "value"})}.ToList(), "Returns the ""type"", ""scriptpath"" or ""value"" of what will trigger the script, like the number of steps.", ",", True))
|
r(New ScriptCommand("script", "delay", "str,int", {New ScriptArgument("delayID", ScriptArgument.ArgumentTypes.Str), New ScriptArgument("returnType", ScriptArgument.ArgumentTypes.Str, {"type", "script", "value"})}.ToList(), "Returns the ""type"", ""scriptpath"" or ""value"" of what will trigger the script, like the number of steps.", ",", True))
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Shared Sub DoRegister()
|
Private Shared Sub DoRegister()
|
||||||
|
|
Loading…
Reference in New Issue