There was no new posts for some time (thank you captain obvious!), but I'm slowly making progress, yay!
I've almost finished hunting userform and hope to finish VBA code soon.
Well, nothing to see here. It's just a boring window. More interesting things happen in the code!
Here's the Initialize Procedure (with public variables added):
Public maxTime As Integer
Public sTime As Integer
Public hTime As Integer
Public player As String
Private Sub UserForm_Initialize()
Application.ScreenUpdating = False
Dim ws As Worksheet
Dim ws_char1, ws_char2, ws_char3 As Worksheet
Dim Status1, Status2, Status3 As String
Dim sleep1Time, sleep2Time, sleep3Time As Integer
Dim hunt1Time, hunt2Time, hunt3Time As Integer
Set ws = Sheets("Corr")
Set ws_char1 = Sheets("char1")
Set ws_char2 = Sheets("char2")
Set ws_char3 = Sheets("char3")
timebox.Locked = True
timebox.Value = 0
player = Range("B2")
ws_char1.Select
Status1 = Range("D7")
sleep1Time = Range("G4")
hunt1Time = Range("G5")
If sleep1Time = "" Then sleep1Time = 0
If hunt1Time = "" Then hunt1Time = 0
ws_char2.Select
Status2 = Range("D7")
sleep2Time = Range("G4")
hunt2Time = Range("G5")
If sleep2Time = "" Then sleep2Time = 0
If hunt2Time = "" Then hunt2Time = 0
ws_char3.Select
Status3 = Range("D7")
sleep3Time = Range("G4")
hunt3Time = Range("G5")
If sleep3Time = "" Then sleep3Time = 0
If hunt3Time = "" Then hunt3Time = 0
maxTime = WorksheetFunction.max(sleep1Time + hunt1Time, sleep2Time + hunt2Time, sleep3Time + hunt3Time)
If maxTime = 0 Then maxTime = 24
Select Case player
Case "P1"
ws_char1.Select
Case "P2"
ws_char2.Select
Case "P3"
ws_char3.Select
End Select
Select Case Status
Case "Sleep"
MsgBox "The character is sleeping.", vbOKOnly
Case Else
Range("D7") = "Hunting"
End Select
ws.Select
Application.ScreenUpdating = True
End Sub
Hunt & arrows buttons and checkbox:
Private Sub hButton_Click()
Dim ws As Worksheet
Dim ws_char As Worksheet
Set ws = Sheets("Corr")
Select Case player
Case "P1"
Set ws_char = Sheets("char1")
If ws.Range("E2") = 1 Then ws.Range("E2") = 0
Case "P2"
Set ws_char = Sheets("char2")
If ws.Range("E9") = 1 Then ws.Range("E9") = 0
Case "P3"
Set ws_char = Sheets("char3")
If ws.Range("E17") = 1 Then ws.Range("E17") = 0
End Select
ws_char.Select
Slowpoke!
ReplyDeleteCzekam na więcej ;)
ReplyDelete