我正在尝试为游戏制作一个传送模块,但首先我必须从 ListBoxEx 获取坐标
self.Gui[3].AppendItem(Item(str(chr.GetNameByVID(i)) + " " + str(nonplayer.GetLevelByVID(i)) + " " + "%d, %d" % (mobX/100, mobY/100)))
http://i.stack.imgur.com/MX8aV.jpg
我试过这个
mob_x, mob_y = re.findall(r"\(([0-9]+), ([0-9]+)\)", item_index.GetText())[0]
结果:索引错误
def Teleport(self):
item_index = self.Gui[3].GetSelectedItem()
if not item_index:
chat.AppendChat(chat.CHAT_TYPE_INFO, "Kein Item ausgewählt!")
return
mob_x, mob_y = re.findall(r"\(([0-9]+), ([0-9]+)\)", item_index.GetText())[0]
chr.SetPixelPosition(mob_x, mob_y)