Gammon Forum
Entire forum
MUSHclient
Python
nick help... about import
nick help... about import
|
It is now over 60 days since the last post. This thread is closed.
  Refresh page
Posted by
| Pkerr
(3 posts) bio
|
Date
| Fri 04 Oct 2013 01:05 AM (UTC) Amended on Fri 04 Oct 2013 01:07 AM (UTC) by Pkerr
|
Message
| my english is poor. please understand....
tt.py
def test():
world.Note('Hello Mushclient')
>> import tt
>> tt.test()
脚本错误
游戏: pkuxkx
执行 1 行 0 列
立即执行
Traceback (most recent call last):
File "<Script Block 4>", line 1, in <module>
tt.test()
File "D:\MUSHclient\tt.py", line 2, in test
world.Note('Hello Mushclient')
NameError: global name 'world' is not defined
出错行:
tt.test()
>> execfile('tt.py')
>> tt.test()
Hello Mushclient
please tell me about import wrong .....thank you
| top |
|
Posted by
| Nick Gammon
Australia (22,973 posts) bio
Forum Administrator |
Date
| Reply #1 on Fri 04 Oct 2013 02:30 AM (UTC) |
Message
| I am not a Python expert. Maybe someone else can help you? |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | top |
|
Posted by
| Pkerr
(3 posts) bio
|
Date
| Reply #2 on Fri 04 Oct 2013 02:53 AM (UTC) |
Message
|
Nick Gammon said:
I am not a Python expert. Maybe someone else can help you?
ok..
thank you | top |
|
Posted by
| Fiendish
USA (2,514 posts) bio
Global Moderator |
Date
| Reply #3 on Sat 05 Oct 2013 02:34 AM (UTC) |
Message
|
Quote: world.Note('Hello Mushclient')
The function name is case sensitive. It is supposed to be world.note, not world.Note. |
https://github.com/fiendish/aardwolfclientpackage | top |
|
Posted by
| Nick Gammon
Australia (22,973 posts) bio
Forum Administrator |
Date
| Reply #4 on Sat 05 Oct 2013 03:00 AM (UTC) |
Message
| However "Note" is the correct capitalization. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | top |
|
Posted by
| Fiendish
USA (2,514 posts) bio
Global Moderator |
Date
| Reply #5 on Sat 05 Oct 2013 05:20 AM (UTC) |
Message
| That's not what the note doc says for python. *shrug* |
https://github.com/fiendish/aardwolfclientpackage | top |
|
Posted by
| Pkerr
(3 posts) bio
|
Date
| Reply #6 on Sat 05 Oct 2013 09:09 AM (UTC) |
Message
| I find a solution...
#filename test.py
Quote:
world = object
def test():
world.Note('Hello Mushclient.')
Input in the game:
>> import test
>> test.world = world #pass namespace 'world'
>> test.test()
Quote: Hello Mushclient.
My english is poor..... sorry
Thank every body
| top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
21,135 views.
It is now over 60 days since the last post. This thread is closed.
  Refresh page
top
Quick links:
MUSHclient.
MUSHclient help.
Forum shortcuts.
Posting templates.
Lua modules.
Lua documentation.
Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.