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

Gammon Software Solutions forum

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

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  General
. . -> [Subject]  Trigger to Automatically wear eq

Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?
(New message)
Subject: Trigger to Automatically wear eq
Name:
Your forum user name.
Register forum user name
Password:
Your forum password.
Forgotten password?
Message:
Message to be posted (in English, please).
Forum codes:
Check this if your message uses 'forum codes' or templates (auto-detected for new posts).
Forum codes Templates

Save this message ...


Subject review (reverse sequence)

Pages: 1 2  

Posted by Keith   (21 posts)  [Biography] bio
Date Fri 15 May 2009 06:32 AM (UTC)  quote  ]
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.
[Go to top] top

Posted by LupusFatalis   (154 posts)  [Biography] bio
Date Fri 15 May 2009 02:24 AM (UTC)  quote  ]
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.
[Go to top] top

Posted by Keith   (21 posts)  [Biography] bio
Date Fri 15 May 2009 12:53 AM (UTC)  quote  ]
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
[Go to top] top

Posted by LupusFatalis   (154 posts)  [Biography] bio
Date Thu 14 May 2009 10:16 PM (UTC)  quote  ]

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

Posted by Keith   (21 posts)  [Biography] bio
Date Thu 14 May 2009 09:39 PM (UTC)  quote  ]
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?
[Go to top] top

Posted by LupusFatalis   (154 posts)  [Biography] bio
Date Thu 14 May 2009 05:48 PM (UTC)  quote  ]

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

Posted by Keith   (21 posts)  [Biography] bio
Date Thu 14 May 2009 03:56 PM (UTC)  quote  ]
Message
it doesnt seem to be working, could it be because I dont have the < > on the outside of the trigger for my prompt?
[Go to top] top

Posted by LupusFatalis   (154 posts)  [Biography] bio
Date Thu 14 May 2009 02:01 PM (UTC)  quote  ]
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.
[Go to top] top

Posted by Keith   (21 posts)  [Biography] bio
Date Thu 14 May 2009 04:33 AM (UTC)  quote  ]
Message
Is this gonna put the eq on before i level though?
[Go to top] top

Posted by LupusFatalis   (154 posts)  [Biography] bio
Date Wed 13 May 2009 11:34 PM (UTC)  quote  ]
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.
[Go to top] top

Posted by LupusFatalis   (154 posts)  [Biography] bio
Date Wed 13 May 2009 11:32 PM (UTC)  quote  ]

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

Posted by Keith   (21 posts)  [Biography] bio
Date Wed 13 May 2009 06:30 AM (UTC)  quote  ]
Message
When i level it says this:

You gained some hit points.
All of a sudden, you hear trumpets and before you know it, there is a feast
honoring you for your accomplishments! You learn that you have risen a level!
You are now level 80! Congratulations!

Thats what it says after i reach a level
[Go to top] top

Posted by LupusFatalis   (154 posts)  [Biography] bio
Date Tue 12 May 2009 05:20 PM (UTC)  quote  ]
Message
download activestate python, get me the text that says you leveled, and when I get a few minutes free I'll see if I can't write you a quick plugin to do the trick.
[Go to top] top

Posted by Keith   (21 posts)  [Biography] bio
Date Tue 12 May 2009 01:16 AM (UTC)  quote  ]
Message
Im not really sure how to use scripts and variables though since im really new to all of it when i try to do it i just get confused
[Go to top] top

Posted by LupusFatalis   (154 posts)  [Biography] bio
Date Mon 11 May 2009 05:37 PM (UTC)  quote  ]
Message
if the exits are always displayed as letters you can do what you mentioned or use ([A-Z]*) or ([A-Z]+) if a room must have at least one exit.

Beyond that...

The trigger conditions will be recognized every time. Which is why I suggested using an if statement in some scripting language. Along with a variable to tell you if the trigger has already fired or not. That is, the trigger still catches the statement and fires, its just that the effects of it firing are different: only if it hasn't already changed your equipment will it send those commands to the mud.

Maybe there is another way, but that is how I would do it.
[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.


6,318 views.

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

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

[Home]

Written by Nick Gammon - 5K

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

[Best viewed with any browser - 2K]    [Internet Contents Rating Association (ICRA) - 2K]    [Web site powered by FutureQuest.Net]