-
Notifications
You must be signed in to change notification settings - Fork 0
/
recur_move.py
57 lines (46 loc) · 1.32 KB
/
recur_move.py
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
from lyntin import exported
from lyntin.modules import modutils
current = (0,0)
coords = [current]
no_go = False
commands_dict = {}
def mud_filter(args):
global no_go
text = args['data']
if 'alas' in text:
no_go = True
else:
no_go = False
return args['data']
def recur(direc):
global current,coords,no_go
exported.write_message('going to move:'+direc)
exported.lyntin_command(direc)
if no_go:
no_go = False
with open('path_text.txt','a') as phile:
phile.write(coords)
coords.pop()
return
else:
if direc == 'n':
current = (coords[-1][0],coords[-1][1]+1)
if direc == 'e':
current = (coords[-1][0]+1,coords[-1][1])
if direc == 'w':
current = (coords[-1][0]-1,coords[-1][1])
if direc == 's':
current = (coords[-1][0],coords[-1][1]-1)
for move in 'nesw':
recur(move)
def command_recur(ses,args,input):
val = args['value']
if val == 'go':
recur('n')
commands_dict['start_recur']=(command_recur,'value=')
def load():
modutils.load_commands(commands_dict)
exported.hook_register('mud_filter_hook',mud_filter)
def unload():
modutils.unload_commands(commands_dict)
exported.unhook_register('mud_filter_hook',mud_filter)