Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- editor.beginUndoAction()
- pos = editor.getCurrentPos()
- chars = {}
- chars['>'] = "14 1".split()
- chars['<'] = "14 ¤t_sprite".split()
- result = ""
- waittime = 0
- colours = "1234567890!@#$%"
- text = editor.getText().splitlines()
- for line in text:
- try:
- front, back = line.split(None,1)
- except:
- result += line + "\n"
- continue
- indentation = line[0:len(line) - len(line.lstrip())]
- if len(front) == 3 and front[0:2] == "//":
- if front[2] == '&':
- waittime = int(back)
- else:
- chars[front[2]] = back.split()
- chars[front[2]].append("¤t_sprite")
- chars[front[2]] = chars[front[2]][0:2]
- elif len(front) == 1 and front[0] in chars:
- colourcode, sprite = chars[front[0]]
- colstr = "`" + colours[int(colourcode) - 1]
- if colourcode == "14":
- colstr = ""
- result += indentation
- result += "say_stop(\"" + colstr + back + "\"," + sprite + ");\n"
- if waittime != 0:
- result += indentation
- result += "wait(" + str(waittime) + ");\n"
- continue
- result += line + "\n"
- editor.setText(result)
- editor.gotoPos(pos)
- editor.endUndoAction()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement