Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, 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
➜ Python Scripted 'morph changer/tracker' using else:
Python Scripted 'morph changer/tracker' using else:
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Ravien
(4 posts) Bio
|
Date
| Mon 09 Mar 2009 09:30 PM (UTC) Amended on Mon 09 Mar 2009 11:52 PM (UTC) by Nick Gammon
|
Message
| Hi all,
I'm looking for some friendly help before I start throwing monitors out of windows. I've tried to look for what I need within the forums with no luck. I've tried fellow achaeans and also google... I am not by any means a coder.
OK, I play achaea and I have certain 'morphs' I can use. Each morph has handy little things I can use in, for example, a combat sitiation. Morphing in achaea uses a hell of a lot of enurance so while I can set aliases to go from one to other other depending on the attack I want to do, I can't get it to not morph if I am already in said morph.
Really crappy example but should get the jist of what I am trying to do ( I just don't know how else to work it). I already have variables set for each morph I have based off of a trigger.
(Alias is called 'forage')
if world.GetVariable("squirrel") == "yes":
world.Send("forage")
else:
world.Send("morph squirrel")
world.Send("forage")
My main hunting skill is also maul, to which I have an alias of 'm'. However with the above kind of script, I end up morphing jaguar and mauling my target whenever 'm' is
used in a word.
(Alias is called 'm')
if world.GetVariable("jaguar") == "yes":
world.Send("maul @target")
else:
world.Send("morph jaguar")
world.Send("maul @target")
Is there a way so that a) It doesn't maul whenever I use the letter 'm' in anything and b)solve the same problem as the first alias example. i am god awful at this but giving it a go. I just need directing.
Thanks if anyone can help! | Top |
|
Posted by
| Nick Gammon
Australia (23,120 posts) Bio
Forum Administrator |
Date
| Reply #1 on Mon 09 Mar 2009 09:42 PM (UTC) |
Message
|
Quote:
Is there a way so that a) It doesn't maul whenever I use the letter 'm' in anything
To answer this first, don't check "regular expression" in the alias. A regular expression of just "m" will match anything with "m" in it. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Ravien
(4 posts) Bio
|
Date
| Reply #2 on Mon 09 Mar 2009 09:45 PM (UTC) |
Message
| Ah ok, followed advice from a friend there who I wont listen to anymore! | Top |
|
Posted by
| Nick Gammon
Australia (23,120 posts) Bio
Forum Administrator |
Date
| Reply #3 on Mon 09 Mar 2009 11:54 PM (UTC) |
Message
|
Quote:
I can't get it to not morph if I am already in said morph.
Well you need to set the variable you subsequently test, don't you?
if world.GetVariable("squirrel") == "yes":
world.Send("forage")
else:
world.Send("morph squirrel")
world.Send("forage")
world.SetVariable ("squirrel", "yes")
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Ravien
(4 posts) Bio
|
Date
| Reply #4 on Tue 10 Mar 2009 08:13 PM (UTC) |
Message
| Well I have a trigger for the line so the variable changes. So as soon as I 'morph squirrel' it sets the variable to yes.
I tried adding what you added and it doesn't recognise anything at all. (thank you for the help by the way) | Top |
|
Posted by
| Nick Gammon
Australia (23,120 posts) Bio
Forum Administrator |
Date
| Reply #5 on Wed 11 Mar 2009 07:03 AM (UTC) |
Message
| What do you mean exactly by "it doesn't recognise anything at all"? Does the trigger not fire, or are you talking about something else? |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Ravien
(4 posts) Bio
|
Date
| Reply #6 on Wed 11 Mar 2009 05:01 PM (UTC) |
Message
| I added the line to set the variable. When I tried to forage after that as a test, it didn't fire. | Top |
|
Posted by
| Nick Gammon
Australia (23,120 posts) Bio
Forum Administrator |
Date
| Reply #7 on Wed 11 Mar 2009 08:29 PM (UTC) |
Message
| In that case can you show the whole thing? (the alias and the trigger). See:
http://mushclient.com/copying
Also check after you think the variable should be set (ie. "squirrel" is "yes") that the variable is in fact set, by looking in the "variables" tab of the world configuration. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Rakon
USA (123 posts) Bio
|
Date
| Reply #8 on Thu 25 Jun 2009 04:30 PM (UTC) Amended on Thu 25 Jun 2009 04:36 PM (UTC) by Rakon
|
Message
| Ravien,
Make a variable called morph. Leave it blank for now.
Add triggers for each morph that change the value of that variable to the morph name; eg
MATCH:You are surrounded by the spirit of the jaguar.
SEND: world.SetVariable('morph','jaguar')
SEND TO : Script
GROUP; Morphs
Click the 'convert to reqular experession button.
Do the above for each morph you have, and one for returning to default race.
In an alias, for example m for maul;
MATCH:^m$
SEND:
if world.GetVariable('morph') == 'jaguar':
world.Send('maul %s' % world.GetVariable('target'))
else:
al_alert('Not in morph!!')
world.Execute('morph jaguar')
Check the box, Regular expression and expand variables.
Do that same format for aliases you want to check the morph.
Hope that helps, if you need more, email. |
Yes, I am a criminal.
My crime is that of curiosity.
My crime is that of judging people by what they say and think, not what they look like.
My crime is that of outsmarting you, something that you will never forgive me for. | 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.
26,995 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top