Hi I am new to scripting ( wanted to see if anyone out there could help me)

Posted by Serve on Tue 03 Apr 2007 02:42 PM — 8 posts, 29,982 views.

#0
Well i will try to describe what i would like the script todo.

I would like it to cast a this spell " cast id rare"
after that this is what it will show me

Your eyes glow bright yellow for a moment.
Object 'ring rare Eagle Circle armor' is type armor, extra flags none.
Weight is 2, value is 0, level is 30.
Armor class is 115.
Affects strength by 35.
Affects intelligence by 5.
Affects wisdom by 5.
Affects dexterity by 5.
Affects constitution by 5.
Affects agility by 5.

at this point if the equipment is perfect (meaning it has 35 in one and five in all of the rest or 25 in one stat fifteen in another stat and five in all of the rest) I would like it to automatically put the rare in a bag.

The commands are the following:

Cast id rare
(If it is perfect)
put rare bag
(if it is not perfect)
drop rare

I hope this is enough information if you need more information or if you can help me in anyway please post a reply or catch me on msn kjourneejr@msn.com or aim kjournee. Thanks
another example of perfect equipment would be

Your eyes glow bright yellow for a moment.
Object 'ring rare Eagle Circle armor' is type armor, extra flags none.
Weight is 2, value is 0, level is 30.
Armor class is 115.
Affects strength by 25.
Affects intelligence by 5.
Affects wisdom by 5.
Affects dexterity by 5.
Affects constitution by 15.
Affects agility by 5.

USA #1
Not terribly hard to do, it will just be a very strange script. I had a similar one for the hallowed lights on the mud I play on.


<trigger
   enabled="n"
   group="rarestat"
   match="Armor class is 115."
   name="rareringstart"
   send_to="12"
   sequence="10"
   other_text_colour="black"
   other_back_colour="black"
  >
  <send>EnableTrigger("rareringstat", true)
EnableTrigger("rareringstop", true)
EnableTrigger("rareringstart", false)
stats = 0
highstat = 0
</send>
  </trigger>

  <trigger
   enabled="n"
   group="rarestat"
   match="^Affects (strength|intelligence|wisdom|dexterity|constitution|luck) by (\d)\.$"
   name="rareringstats"
   regexp="y"
   send_to="12"
   sequence="9"
   other_text_colour="black"
   other_back_colour="black"
  >
  <send>stats = stats + %2
if highstat < %2 then
  highstat = %2
end
</send>
  </trigger>

  <trigger
   enabled="n"
   keep_evaluating="y"
   match="^.*$"
   name="rareringstop"
   regexp="y"
   script="rarestat"
   send_to="12"
   sequence="11"
   other_text_colour="black"
   other_back_colour="black"
  >
  <send>EnableTrigger("rareringstat", false)
EnableTrigger("rareringstop", false)
if (stats==60) and ((highstat==35) or (highstat==25)) then
  Send( "put rare bag" )
else
  Send( "drop rare" )
end
</send>
  </trigger>

and for the alias:

  <alias
   match="rareid"
   enabled="y"
   send_to="12"
  >
  <send>EnableTrigger("rareringstart", true)
Send("cast id rare")
  </send>
  </alias>
Amended on Wed 04 Apr 2007 02:45 AM by Shaun Biggs
USA #2
And now for the explanation. Sorry, but that post was getting to be too long for my tastes. The alias just enables the first trigger and then identifies the item. The first trigger enables the other two triggers once it's just about to get to the point where the stats will be listed. The second trigger adds the bonus of whatever attribute to the stat total, and then checks to see if it's the highest. The last trigger turns off the remaining triggers and compares the high stats and the total stats to see if it's one of those perfect items.

Yeah, it's messy, but it should work. I just changed around the names and a few of the numbers from my hallowed light script which did roughly the same thing, but with lower numbers.
#3
Thank you very much I will try it out and let you know how it works. Thanks again
#4
Ok sorry but I am a complete newbie to this stuff and sometimes trying to figure it out can be overwhelming.

I am trying to figure out where in the triggers i need to place the str,int,con,agi values and where I need to input the word/words that will set of the first trigger if I am understanding this correct.

#5
Also another thing is i copy paste the file into mirco word and i am trying to figure out how to save it so when i chose browse to find the script i am able to locate it.
USA #6
Well, the easiest way to do it is to open up the saved world file with a text editor and just copy the triggers in with the trigger section, and the alias in with the alias section. Aside from that, I could repost it as a plugin, I suppose. That way you can just copy it into notepad or whatever.

Oh, and woot! 100 posts by me.
Australia Forum Administrator #7
Copy the triggers above to the clipboard, go to the File menu -> Import, and click Clipboard.

See this post:

http://www.gammon.com.au/forum/?id=4777

Shaun has posted them without the <triggers> tags around them. You need those or that won't work.

For example, instead of:


<alias
   match="rareid"
   enabled="y"
   send_to="12"
  >
  <send>EnableTrigger("rareringstart", true)
Send("cast id rare")
  </send>
  </alias>


Use:


<aliases>
<alias
   match="rareid"
   enabled="y"
   send_to="12"
  >
  <send>EnableTrigger("rareringstart", true)
Send("cast id rare")
  </send>
  </alias>
</aliases>


Then you can import them, or use the "Paste" button described in the post I mentioned.