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 ➜ General ➜ Trigger to Automatically wear eq

Trigger to Automatically wear eq

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


Pages: 1  2 

Posted by LupusFatalis   (154 posts)  Bio
Date Reply #15 on Wed 13 May 2009 11:32 PM (UTC)

Amended on Wed 13 May 2009 11:35 PM (UTC) by LupusFatalis

Message
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<!-- Saved on Wednesday, May 13, 2009, 7:30 PM -->
<!-- MuClient version 4.40 -->

<!-- Plugin "AutoLevelingEquipment" generated by Plugin Wizard -->

<muclient>
<plugin
   name="AutoLevelingEquipment"
   id="3cf0a86995a79034ec87bf1b"
   language="Python"
   save_state="y"
   date_written="2009-05-13 19:29:09"
   requires="4.40"
   version="1.0"
   >

</plugin>


<!--  Get our standard constants -->

<include name="constants.pys"/>

<!--  Triggers  -->

<triggers>
  <trigger
   enabled="y"
   keep_evaluating="y"
   match="^You are now level (\d+)\! Congratulations\!$"
   regexp="y"
   script="Leveled"
   sequence="100"
  >
  </trigger>
  <trigger
   enabled="y"
   keep_evaluating="y"
   match="^\&lt;(\d+)\% (\d+)\% (\d+)\% (\d+)\((\d+)\) (\d+)\%\% ([A-Z]+)\&gt;$"
   regexp="y"
   script="ExperienceCheck"
   sequence="100"
  >
  </trigger>
</triggers>

<!--  Variables  -->

<variables>
  <variable name="LevelingEq">0</variable>
</variables>

<!--  Script  -->


<script>
<![CDATA[
LevelingEquipment = ['lItem1', 'lItem2', 'lItem3', 'lItem4', 'lItem5']
NormalEquipment = ['nItem1', 'nItem2', 'nItem3', 'nItem4', 'nItem5']

def ExperienceCheck(TriggerName, Trig_line, wildcards):

	xExp = int(wildcards[5])
	
	xEqState = int(world.GetVariable('LevelingEq'))

	if xEqState == 0:
		if xExp >= 98:
			world.SetVariable('LevelingEq', '1')

			for i in range(0, len(NormalEquipment)):
				world.Send('remove ' + str(NormalEquipment[i]))
		
			for i in range(0, len(LevelingEquipment)):
				world.Send('wear ' + str(LevelingEquipment[i]))

def Leveled(TriggerName, Trig_line, wildcards):
	
	world.SetVariable('LevelingEq', '0')

	for i in range(0, len(LevelingEquipment)):
		world.Send('remove ' + str(LevelingEquipment[i]))

	for i in range(0, len(NormalEquipment)):
		world.Send('wear ' + str(NormalEquipment[i]))
]]>
</script>


</muclient>
Top

Posted by LupusFatalis   (154 posts)  Bio
Date Reply #16 on Wed 13 May 2009 11:34 PM (UTC)
Message
This should work. You might need to tweak it some depending on where you get the items from and where you put them, etc...

Replace my lists with your respective items.
Top

Posted by Keith   (21 posts)  Bio
Date Reply #17 on Thu 14 May 2009 04:33 AM (UTC)
Message
Is this gonna put the eq on before i level though?
Top

Posted by LupusFatalis   (154 posts)  Bio
Date Reply #18 on Thu 14 May 2009 02:01 PM (UTC)
Message
When you hit 98% or anything greater it will check to see if it has already put on the leveling eq for this level. If it has not it will send the mud.

remove nItem1
...
remove nItemN
wear lItem1
...
wear lItemK

replace the text contained in the lists with your items. If this is not suitable, look at the world.Send function when modifying this code, and you can have it send whatever text you want to the game.

When you level it will do the reverse, removing the leveling stuff, and wearing the normal stuff. (Being defined by the lists.)

Copy your level and prompt lines exactly, and use the game>test trigger function to identify to convince yourself it works. If your prompt appears to be identical but has a space after it, this will need some tweaking, etc... (that is common)

If it were me, I'd make sure it works for one level. Or tweak it, and test it on the next level. But, I'm a bit anal, if I didn't get an extra hp for one level, I might just delete my character and recreate.
Top

Posted by Keith   (21 posts)  Bio
Date Reply #19 on Thu 14 May 2009 03:56 PM (UTC)
Message
it doesnt seem to be working, could it be because I dont have the < > on the outside of the trigger for my prompt?
Top

Posted by LupusFatalis   (154 posts)  Bio
Date Reply #20 on Thu 14 May 2009 05:48 PM (UTC)

Amended on Thu 14 May 2009 05:49 PM (UTC) by LupusFatalis

Message
\0AYou are now level 80! Congratulations!
<100% 100% 100% 3(0) 98%% ESWU>
You are now level 80! Congratulations!
<100% 100% 100% 3(0) 89%% ESWU>\0A

Paste that into the testing of triggers. For the first two lines, it should send the world remove ... and wear ...

for the second it should do nothing visible

Your prompt doesn't have <> or do you mean the trigger is just using the lt and gt codes for it?

You can try replacing them with <>, but it works fine for me. The plugin wizard automatically converted it to those it seems. I would test and make sure your prompt is actually sending a new line at the end. Or if it isn't that it doesn't look more like this:
"<100% 100% 100% 3(0) 98%% ESWU> "
which, as I said is pretty common.

But yeah, if the triggers aren't catching, you'll need to do some tweaking... And most likely with the newline/end of line or some whitespace character.

Someone else can probably help you a bit better there. I still don't know what I'm doing where the packet debugger is concerned.
Top

Posted by Keith   (21 posts)  Bio
Date Reply #21 on Thu 14 May 2009 09:39 PM (UTC)
Message
Ok i figured it out i was setting it wrong, what if i have to get the items from a container what else would i have to add?
Top

Posted by LupusFatalis   (154 posts)  Bio
Date Reply #22 on Thu 14 May 2009 10:16 PM (UTC)

Amended on Thu 14 May 2009 10:17 PM (UTC) by LupusFatalis

Message
You would be altering these lines to do what you want.
	for i in range(0, len(LevelingEquipment)):
		world.Send('remove ' + str(LevelingEquipment[i]))

	for i in range(0, len(NormalEquipment)):
		world.Send('wear ' + str(NormalEquipment[i]))


i.e maybe you want to put the old set in a pack and take the new set out to accomplish the exchange.
	for i in range(0, len(LevelingEquipment)):
		world.Send('remove ' + str(LevelingEquipment[i]))
		world.Send('put ' + str(LevelingEquipment[i]) + ' in pack')

	for i in range(0, len(NormalEquipment)):
		world.Send('get ' + str(NormalEquipment[i]) + ' from pack')
		world.Send('wear ' + str(NormalEquipment[i]))
Top

Posted by Keith   (21 posts)  Bio
Date Reply #23 on Fri 15 May 2009 12:53 AM (UTC)
Message
Ok thank you. For some reason the trigger doesnt seem to go off after i reach 98% exp or more for some reason. but it works when i use it in the test
Top

Posted by LupusFatalis   (154 posts)  Bio
Date Reply #24 on Fri 15 May 2009 02:24 AM (UTC)
Message
The script uses a variable so it won't fire more than once per level. This way it doesn't remove and wear equipment every time you change by 1%. But if you should skip from 97% to 99% lets say, it should work just fine. That being said, if you earn enough xp to level from 97% to 100% before you get a prompt somewhere in between, the script obviously won't change your eq. Should you stop playing, change eq, and log off at 98+ % the script won't change your eq when you log back on. Etc... If you want, the addition isn't hard to have it do so, and it would probably be a good learning experience to try and figure out.
Top

Posted by Keith   (21 posts)  Bio
Date Reply #25 on Fri 15 May 2009 06:32 AM (UTC)
Message
it doesnt seem to fire when i reach 98% exp, i cant seem to figure it out, it fires after i level but not before.
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.


70,626 views.

This is page 2, subject is 2 pages long:  [Previous page]  1  2 

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.