Talk:How to Script

From Elanthipedia
Jump to navigation Jump to search

Match section

Matchre is actually very easy to explain, and I think it could be added into the section with the current example shown with MATCHRE so people can understand. They are incredibly useful for keeping the amount of lines your code is down to a minimum.

Simple explanation is that it functions exactly the same as a MATCH. The pipe | separates each of the regular expressions, and that it must start and end with forward slashes / in StormFront.

1	putAway:
2	MATCH putAway ...wait
3	MATCHRE cycle /Stow what?|You are already wearing that.|But that is already in your inventory.|You/
4	PUT stow my pickle
5	MATCHWAIT

-- Tea 20:53, 21 April 2009 (UTC)

Because it also plays into thinks like WAITFORRE, I'm going to add it to a separate section (when I get around to it :P ) -Moderator Caraamon Strugr-Makdasi(talk) 18:02, 22 April 2009 (UTC)

--Deke 22:18, 1 August 2009 (UTC)

I would advise you add "i" to the end of all matchre's to make them case insensative. Additionally the "?" would not actually match a question mark in your string, to do that it must be preceeded by an "\". The same applies to your periods. Here's how the expression could be changed...

/Stow what\?|You are already wearing that\.|But that is already in your inventory\.|You/i

Save

It would nice to see SAVE explained, even if it's deprecated. I'm still trying to figure out what it does exactly so I understand other people's scripts. --Ateles 16:45, 1 August 2010 (UTC)