PDA

View Full Version : Script Help



Latrinsorm
11-22-2003, 03:46 AM
So I made what I thought was a pretty good script for grabbing stuff:

#grab stuff

put wear my greatshield
waitfor You sling
Back:
if_1 goto Grab
goto End2

Grab:
put get %1
put put %1 in my pack
match Shift You put a
match End Get what?
matchwait

Shift:
shift
goto Back

End:

put rem my greats
exit

End2:
wait 1
put rem my greats
exit

Works great for one thing. If I try to do two or more, however, sometimes the message for the first object's "You put a" triggers the match twice. At least that's what it looks like on the external. The end result is sometimes with two objects I won't remove my greatshield because of type ahead. With three objects, sometimes I won't even pick up the third object.

How do I fix it?

Artha
11-22-2003, 07:57 AM
I'd suggest using waitfors instead of all those relatively useless matches.

Latrinsorm
11-22-2003, 05:55 PM
That did the trick, thanks!

Jonty
11-23-2003, 02:54 PM
Originally posted by Latrinsorm
Works great for one thing. If I try to do two or more, however, sometimes the message for the first object's "You put a" triggers the match twice. At least that's what it looks like on the external. The end result is sometimes with two objects I won't remove my greatshield because of type ahead. With three objects, sometimes I won't even pick up the third object.

How do I fix it?

Actually, matches are better than waitfors. You can add in more matches for error checking and multiple outcomes to make a better script. You just have to use them the right way.

Here is your script in a way that will not match the same string twice:

#grab stuff

put wear my greatshield
waitfor You
if_1 goto Grab
goto End

grabW:
wait

Grab:
put get %1
put put %1 in my pack
match Shift You put a
match shift Get what?
match grabW Sorry, you may only type ahead 1 command.
matchwait

Shift:
shift
if_1 goto GrabW

End:
put rem my greatshield

- Jonty

Latrinsorm
11-23-2003, 03:25 PM
I'm grateful for the effort and all, but doesn't your second match (the one that goes to shift) lead to nowhere? Or is it non-case-sensitive?

Artha
11-23-2003, 03:33 PM
I'd change "match Shift You put a" to You put...in case you decide to pick up something that starts with a vowel sound.

Latrinsorm
11-23-2003, 03:36 PM
Yeah, I changed that after I tried to pick up "some calamia fruit". Now it works for crazy herbs too!

Jonty
11-23-2003, 06:22 PM
Originally posted by Latrinsorm
I'm grateful for the effort and all, but doesn't your second match (the one that goes to shift) lead to nowhere? Or is it non-case-sensitive?

Everything in GemStone scripts is case insensitive. This is easily tested....

- Jonty

[Edited on 12-2-2003 by Jonty]