python中name没有定义_Python NameError:全局名称’NAME’未定义! (但它被定义)
这是我的
Python代码:
import es, popuplib, cmdlib
info = es.AddonInfo()
info['name'] = "bilbodog Vaaben Menu"
info['version'] = "1.1"
info['author'] = "bilbodog"
info['url'] = ""
info['description'] = "En vaaben menu der kan give vaaben til spillere"
def load():
es.regclientcmd('bm_version', 'bm/bm_version')
cmdlib.registerSayCommand('!wpa', sendBmMenu, 'Send BM Menu')
es.msg('#multi', '#green[bilbodog Vaaben Menu] #defaultblev loaded!')
global bilbodog, bilbodogSelf, bilbodogOther, bilbodogSelf2, bilbodogSelf3, bilbodogSelf4, bilbodogSelf5, bilbodogSelf6, bilbodogSelf7, bilbodogSelf8, bilbodogSelf9, bilbodogOther2, bilbodogOther3, bilbodogOther4, bilbodogOther5, bilbodogOther6, bilbodogOther7, bilbodogOther8, bilbodogOther9, bilbodogadmins
bilbodogadmins = ('STEAM_0:1:25150824', 'STEAM_ID_LAN', 'STEAM_ID_PENDING')
bilbodog = popuplib.create('bilbodog')
bilbodog.addline('---------------bilbodog Vaaben Menu---------------')
bilbodog.addline('Weapon Menu - Hvem vil De give et vaaben?')
bilbodog.addline('->1. Mig selv')
bilbodog.addline('->2. Andre spillere')
bilbodog.addline('------------------------------')
bilbodog.addline('0 Luk')
bilbodog.menuselect = bilbodogscript
bilbodogSelf = popuplib.create('bilbodogSelf')
bilbodogSelf.addline('---------------bilbodog Vaaben Menu---------------')
bilbodogSelf.addline('Weapon Menu - Mig selv')
bilbodogSelf.addline('->1. Haandpistoler')
bilbodogSelf.addline('->2. Stormgevaerer')
bilbodogSelf.addline('->3. Haglgevaerer')
bilbodogSelf.addline('->4. Maskinepistoler')
bilbodogSelf.addline('->5. Sniper Vaaben')
bilbodogSelf.addline('->6. Maskingevaer')
bilbodogSelf.addline('->7. Udstyr')
bilbodogSelf.addline('->8. Vaaben Saet')
bilbodogSelf.addline('------------------------------')
bilbodogSelf.addline('0 Luk')
bilbodogSelf.menuselect = bilbodogSelfscript
bilbodogSelf2 = popuplib.create('bilbodogSelf2')
bilbodogSelf2.addline('---------------bilbodog Vaaben Menu---------------')
bilbodogSelf2.addline('Weapon Menu - Mig selv - Haandpistoler')
bilbodogSelf2.addline('->1.G18')
bilbodogSelf2.addline('->2.USP45')
bilbodogSelf2.addline('->3.P228')
bilbodogSelf2.addline('->4.Desert Eagle')
bilbodogSelf2.addline('->5.Five-Seven')
bilbodogSelf2.addline('->6.Dual Elite')
bilbodogSelf2.addline('------------------------------')
bilbodogSelf2.addline('->8.Tilbage')
bilbodogSelf2.addline('0.Luk')
bilbodogSelf2.menuselect = bilbodogSelf2script
# ...SNIP...
bilbodogSelf9 = popuplib.create('bilbodogSelf9')
bilbodogSelf9.addline('---------------bilbodog Vaaben Menu---------------')
bilbodogSelf9.addline('Weapon Menu - Mig selv - Udstyr')
bilbodogSelf9.addline('->1.M4A1, Deagle, Nades, Armor')
bilbodogSelf9.addline('->2.M4A1, Elite, Nades, Armor')
bilbodogSelf9.addline('->3.AK47, Deagle, Nades, Armor')
bilbodogSelf9.addline('->4.AK47, Elite, Nades, Armor')
bilbodogSelf9.addline('->5.AWP, Deagle, Nades, Armor')
bilbodogSelf9.addline('->6.AWP, Elite, Nades, Armor')
bilbodogSelf9.addline('------------------------------')
bilbodogSelf9.addline('->8.Tilbage')
bilbodogSelf9.addline('0.Luk')
bilbodogSelf9.menuselect = bilbodogSelf9script
bilbodogOther = popuplib.create('bilbodogOther')
bilbodogOther.addline('---------------bilbodog Vaaben Menu---------------')
bilbodogOther.addline('Weapon Menu - Andre spillere')
bilbodogOther.addline('->1. Haandpistoler')
bilbodogOther.addline('->2. Stormgevaerer')
bilbodogOther.addline('->3. Haglgevaerer')
bilbodogOther.addline('->4. Maskinepistoler')
bilbodogOther.addline('->5. Sniper Vaaben')
bilbodogOther.addline('->6. Maskingevaer')
bilbodogOther.addline('->7. Udstyr')
bilbodogOther.addline('->8. Vaaben Saet')
bilbodogOther.addline('------------------------------')
bilbodogOther.addline('0 Luk')
bilbodogOther.menuselect = bilbodogOtherscript
bilbodogOther2 = popuplib.create('bilbodogOther2')
bilbodogOther2.addline('---------------bilbodog Vaaben Menu---------------')
bilbodogOther2.addline('Weapon Menu - Andre spillere - Haandpistoler')
bilbodogOther2.addline('->1.G18')
bilbodogOther2.addline('->2.USP45')
bilbodogOther2.addline('->3.P228')
bilbodogOther2.addline('->4.Desert Eagle')
bilbodogOther2.addline('->5.Five-Seven')
bilbodogOther2.addline('->6.Dual Elite')
bilbodogOther2.addline('------------------------------')
bilbodogOther2.addline('->8.Tilbage')
bilbodogOther2.addline('0.Luk')
bilbodogOther2.menuselect = bilbodogOther2script
# ...SNIP...
bilbodogOther9 = popuplib.create('bilbodogOther9')
bilbodogOther9.addline('---------------bilbodog Vaaben Menu---------------')
bilbodogOther9.addline('Weapon Menu - Andre spillere - Udstyr')
bilbodogOther9.addline('->1.M4A1, Deagle, Nades, Armor')
bilbodogOther9.addline('->2.M4A1, Elite, Nades, Armor')
bilbodogOther9.addline('->3.AK47, Deagle, Nades, Armor')
bilbodogOther9.addline('->4.AK47, Elite, Nades, Armor')
bilbodogOther9.addline('->5.AWP, Deagle, Nades, Armor')
bilbodogOther9.addline('->6.AWP, Elite, Nades, Armor')
bilbodogOther9.addline('------------------------------')
bilbodogOther9.addline('->8.Tilbage')
bilbodogOther9.addline('0.Luk')
bilbodogOther9.menuselect = bilbodogOther9script
def sendBmMenu(userid, args):
steam = es.getplayersteamid(userid)
if steam in bilbodogadmins:
bilbodog.send(userid)
else:
es.tell(event_var['userid'], '#multi', '#greenDe har ikke adgang til denne kommando!')
def bilbodogscript(userid, choice, popupid):
if choice == 1:
bilbodogSelf.send(userid)
elif choice == 2:
bilbodogOther.send(userid)
def bilbodogSelfscript(userid, choice, popupid):
if choice == 1:
bilbodogSelf2.send(userid)
elif choice == 2:
bilbodogSelf3.send(userid)
elif choice == 3:
bilbodogSelf4.send(userid)
elif choice == 4:
bilbodogSelf5.send(userid)
elif choice == 5:
bilbodogSelf6.send(userid)
elif choice == 6:
bilbodogSelf7.send(userid)
elif choice == 7:
bilbodogSelf8.send(userid)
elif choice == 8:
bilbodogSelf9.send(userid)
def bilbodogOtherscript(userid, choice, popupid):
if choice == 1:
bilbodogOther2.send(userid)
elif choice == 2:
bilbodogOther3.send(userid)
elif choice == 3:
bilbodogOther4.send(userid)
elif choice == 4:
bilbodogOther5.send(userid)
elif choice == 5:
bilbodogOther6.send(userid)
elif choice == 6:
bilbodogOther7.send(userid)
elif choice == 7:
bilbodogOther8.send(userid)
elif choice == 8:
bilbodogOther9.send(userid)
def bm_version():
es.msg('#multi', '#green[bilbodog Vaaben Menu] #defaultVersion 1.0')
es.msg('#multi', '#green[bilbodog Vaaben Menu] #defaultLavet af bilbodog')
def unload():
cmdlib.unregisterSayCommand('!wpa')
我收到一个错误:
NameError: global name 'bilbodogOther' is not not defined
错误在这里正在发生:
def bilbodogscript(userid, choice, popupid):
if choice == 1:
bilbodogSelf.send(userid)
elif choice == 2:
bilbodogOther.send(userid)
但我不明白,这是什么意思?
python中name没有定义_Python NameError:全局名称’NAME’未定义! (但它被定义)相关推荐
- python的for语句中i未被定义_python – PyLint:使用可能未定义的循环变量警告
阅读this question后,我可以理解为什么可能输出这个警告,但是当循环变量不能被定义时我有一个特定的情况-- for i in range(0, 2): print i print i PyL ...
- python vars name报错_Python vars()全局名称错误
我在理解以下功能出了什么问题时遇到了一些麻烦: def ness(): pie='yum' vars()[pie]=4 print vars()[pie] print yum 所以,当我运行时,我得到 ...
- 使用gcc编译报错:/tmp/ccoLTk4o.o:在函数‘main’中: main1.c:(.text+0x9c):对‘pirnt1’未定义的引用 collect2: 错误:ld 返回 1
报错 使用gcc编译报错:/tmp/ccoLTk4o.o:在函数'main'中: main1.c:(.text+0x9c):对'pirnt1'未定义的引用 collect2: 错误:ld 返回 1 解 ...
- python中global的使用_PYTHON中使用GLOBAL引发的一系列问题
In [96]: def x(): b = 12 def y(): global a,b a = 1 b = 2 y() print "b =",b ....: In [97]: ...
- python中冒号报错_python中一些常见的错误_后端开发
PHP8 新特性之 Attributes_后端开发 PHP8的Alpha版本,过几天就要发布了,其中包含了不少的新特性,今天呢,我想谈谈Attributes,为啥呢, 是昨天我看到很多群在转发一个文章 ...
- python中doc=parased.getroot()_python实例手册.py
python实例手册 #encoding:utf8 # 设定编码-支持中文 0 说明 手册制作: 雪松 littlepy www.51reboot.com 更新日期: 2016-01-21 欢迎系统运 ...
- python中的下划线_Python中的下划线详解
这篇文章讨论Python中下划线_的使用.跟Python中很多用法类似,下划线_的不同用法绝大部分(不全是)都是一种惯例约定. 一. 单个下划线直接做变量名(_) 主要有三种情况: 1. 解释器中 _ ...
- python中函数的作用域_Python中的函数作用域
在python中,一个函数就是一个作用域 name = 'xiaoyafei' def change_name(): name = '肖亚飞' print('在change_name里的name:', ...
- python中的抽象含义_Python中下划线的5种含义你都知道吗?
英文原文:https://dbader.org/blog/meaning-of-underscores-in-python 本文介绍了Python中单下划线和双下划线("dunder&quo ...
- python中垃圾回收机制_Python中的变量和垃圾回收机制
1.python中的变量 python 和 java 中的变量本质不一样. java 中声明变量时要指定变量的数据类型,int.str或某一类,之后虚拟机就会在内存中申请一块空间,空间的大小跟类型相关 ...
最新文章
- 数据可视化(matplotlib绘图)
- 设置允许远程连接MySQL (Ubuntu为例)
- [html] 实现两列等宽布局的方式有哪些?
- 2021鞍山市高考成绩怎么查询,鞍山师范学院
- Android Studio升级中的“未找到默认活动”
- 中文核心期刊目录(2008年最新版)
- 整合并接班MSN!Win8版Skype完全体验
- Ubuntu 20.04.2 LTS安装微信(wine)
- 什么是USBHOST、USB Slave和USB OTG?它们之间有什么区别 USB、MiniUSB、MicroUSB
- 全年日历平铺展示以及日期批量选择
- php think命令,ThinkPHP 使用命令行 (cli) think 调用
- 开源网络模拟器资源统计列表
- fpga/嵌入式硬件初级工程师必备链接(不定时更新)
- 华为 android 菜单键,没有返回和菜单键!华为P10的Home键简单说明
- Unity中用递归删除空文件夹和文件夹下面的子文件,meta文件保留和IO的一些操作总结
- CMMI2.0之我见-技术解决方案TS产品集成PI
- 韬韬抢苹果 #普及组#
- PLC学习之路001
- Sigmoid函数的理解
- [重点] 字典处理(工具)