-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbandage_timer.py
More file actions
78 lines (67 loc) · 2.89 KB
/
bandage_timer.py
File metadata and controls
78 lines (67 loc) · 2.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# Bandage Timer by Wardoc
# Contributions by Matsamilla
# I have this always running, start at login.
# version 2.0 - If running RazorEnhanced 7.7.23 or greater use this now, or change line 13 to match
# True for overhead Bandage Available message, false for in system messages
overheadMessage = True
msgcolor = 88
Misc.SetSharedValue('bandageDone', True)
def BandagesApplying():
# Fetch the Journal entries (oldest to newest)
regularText = Journal.GetTextByType( 'System' )
# Reverse the Journal entries so that we read from newest to oldest
regularText.Reverse()
# Read back until the bandages were started to see if they have finished applying
for line in regularText[ 0 : len( regularText ) ]:
if (line == 'You begin applying the bandages.' or
line == 'Your hands are still busy applying other bandages.'):
break
if ( line == 'You finish applying the bandages.' or
line == 'You heal what little damage your patient had.' or
line == 'You apply the bandages, but they barely help.' or
line == 'That being is not damaged!' or
line == 'You have cured the target of all poisons!' or
line == 'You are unable to resurrect your patient.' or
line == 'You are able to resurrect your patient' or
line == 'You are able to resurrect the creature.' or
line == 'You fail to resurrect the creature.' or
line == 'You did not stay close enough to heal your patient!'):
return False
return True
def WaitForBandagesToApply():
Misc.SetSharedValue('bandageDone', False)
#bandageDone = False
secondsCounter = 0
while BandagesApplying():
worldSave()
Misc.Pause( 1000 )
secondsCounter += 1
if overheadMessage:
Player.HeadMessage( msgcolor, 'Bandage: %is' % ( secondsCounter ) )
else:
Misc.SendMessage('Bandage: %is' % ( secondsCounter ), msgcolor )
if secondsCounter > 18:
break
if overheadMessage:
Player.HeadMessage(msgcolor, 'Bandage Available')
else:
Misc.SendMessage( 'Bandage Available', msgcolor )
Misc.SetSharedValue('bandageDone', True)
return
def worldSave():
if Journal.SearchByType('The world is saving, please wait.', 'System' ):
Misc.SendMessage('Pausing for world save', 33)
while not Journal.SearchByType('World save complete.', 'System'):
Misc.Pause(1000)
Misc.SendMessage('Continuing', 33)
Journal.Clear()
Journal.Clear()
while True:
if Player.IsGhost:
# Player died, wait until Player is resurrected
while Player.IsGhost:
Misc.Pause( 100 )
if Journal.Search('You begin applying the bandages.'):
WaitForBandagesToApply()
Journal.Clear()
Misc.Pause( 50 )