Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to "verify" your details, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.
 Entire forum ➜ MUSHclient ➜ Python ➜ Issues with script

Issues with script

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


Posted by Sanichi   (11 posts)  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)
Top

Posted by Nick Gammon   Australia  (23,070 posts)  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
Top

Posted by Sanichi   (11 posts)  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.
Top

Posted by Nick Gammon   Australia  (23,070 posts)  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
Top

Posted by Nick Gammon   Australia  (23,070 posts)  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
Top

Posted by Sanichi   (11 posts)  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!
Top

Posted by Nick Gammon   Australia  (23,070 posts)  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
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.


23,455 views.

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

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.