[Home] [Downloads] [Search] [Help/forum]

Gammon Forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Python
. . -> [Subject]  Issues with script
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

Issues with script

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page


Posted by Sanichi   (7 posts)  [Biography] bio
Date Sat 25 Oct 2014 08:39 PM (UTC)
Message
I'm having issues starting up a script in Windows 8.1, I'm not sure if it's an issue with the script or how I've gotten python working on this computer. This script worked for me when my computer was originally a Windows 8, but I recently had to clear my system due to issues. Is there any advice for my problem?

The error reads as follows:

Quote:
Script error
Plugin: DMSkillController (called from world: DM)
Execution of line 154 column 4
Immediate execution
unexpected indent
Line in error:
def SkillImprove(TriggerName, trig_line, wildcards):
Error context in script:
150 :
151 :
152 :
153 :
154*: def SkillImprove(TriggerName, trig_line, wildcards):
155 :
156 : #Concatonate all the variables passed by the MUSHclient
157 : vName = ''.join([wildcards[x] for x in range(len(wildcards)-1)])
158 :
[WARNING] C:\Program Files (x86)\MUSHclient\worlds\plugins\Counter.xml
Line 63: Error parsing script (Cannot load)
[Go to top] top

Posted by Nick Gammon   Australia  (21,322 posts)  [Biography] bio   Forum Administrator
Date Reply #1 on Sat 25 Oct 2014 09:03 PM (UTC)

Amended on Sat 25 Oct 2014 09:04 PM (UTC) by Nick Gammon

Message
I'm no Python expert, but isn't it usually indented? eg.


def SkillImprove(TriggerName, trig_line, wildcards):

  #Concatonate all the variables passed by the MUSHclient
  vName = ''.join([wildcards[x] for x in range(len(wildcards)-1)])


After all, the error message was:


 unexpected indent

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Sanichi   (7 posts)  [Biography] bio
Date Reply #2 on Sat 25 Oct 2014 09:21 PM (UTC)
Message
I'm not quite sure if that might be the issue in this case.
Many similar indentions are found through the code:

Quote:
https://gist.github.com/castercerberus/f4a4bb543ce005d9b2cf


And.. I suspect it might be compatibility issues since other people have been able to utilize the script. Though, I'm more clueless about this subject than most about here.
[Go to top] top

Posted by Nick Gammon   Australia  (21,322 posts)  [Biography] bio   Forum Administrator
Date Reply #3 on Sat 25 Oct 2014 11:03 PM (UTC)

Amended on Sat 25 Oct 2014 11:05 PM (UTC) by Nick Gammon

Message
The link showed the code indented:


    <script>
    <![CDATA[
    def SkillImprove(TriggerName, trig_line, wildcards):

       #Concatonate all the variables passed by the MUSHclient
       vName = ''.join([wildcards[x] for x in range(len(wildcards)-1)])

       #Replace invalid characters with other characters to store as variables
       vName = vName.replace(' ', '_').replace('\'', '').replace('-', '_').replace('#', '_')

       #If the variable doesn't currently have a value give it
       #the value of 1, else increment it by 1
       if not world.GetVariable(vName):
          vValue = 1
       else:
          vValue = int(world.GetVariable(vName)) + 1

       #Display in the command window the improvement message
       #with the corresponding number of improvements added in
       world.SetVariable(vName, str(vValue))
       world.ColourTell('#00FFFF', '', '* You think your ' + str(vName))
       world.ColourTell('#FFFFFF', '', ' [')
       world.ColourTell('#FF0000', '', str(vValue))
       world.ColourTell('#FFFFFF', '', '] ')
       world.ColourNote('#00FFFF', '', 'skill has improved. *' )



The error message you posted did not.

I think there might be an issue in the way you are saving the plugin.

Click on the "raw" button ( gist:f4a4bb543ce005d9b2cf ) and save that to disk as your plugin.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Nick Gammon   Australia  (21,322 posts)  [Biography] bio   Forum Administrator
Date Reply #4 on Sat 25 Oct 2014 11:06 PM (UTC)
Message
I found that if I copied and pasted from your link (but not the "raw" link) it seemed to discard all indentation, for some reason. That's why I suggested using the raw code.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Sanichi   (7 posts)  [Biography] bio
Date Reply #5 on Sun 26 Oct 2014 02:58 AM (UTC)
Message
Seems it working now!
That's.. fairly odd it tends to save like that though.

Thank you!
[Go to top] top

Posted by Nick Gammon   Australia  (21,322 posts)  [Biography] bio   Forum Administrator
Date Reply #6 on Sun 26 Oct 2014 05:37 AM (UTC)
Message
Yes, it is odd.

This, by the way, is why I don't like languages where the amount of whitespace (the indentation) has syntactic meaning.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] 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.


3,870 views.

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] 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.

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at FutureQuest]