PDA

View Full Version : Why does it keep looping?



StrayRogue
07-09-2005, 12:29 PM
Ok, I've got a script that is meant to pick up gems/treasure. However when it does so it constantly keeps trying to take the specific gem and basically does nothing but:

take gem
stow gem
take gem
stow gem....
etc etc

Heres the script, how can I rectify the problem:

treasure1:
put look
match starstone starstone
match dreamstone dreamstone
match sunstone sunstone
match feystone feystone
match aetherstone aetherstone
Insert other gems here
.
.
.
match treasure2 obvious paths:
matchwait

treasure2:
put look
match quartz quartz
match tourmaline tourmaline
match mithril mithril-bloom
match nugget nugget
match stone stone
.
.
.
match checkroom Obvious exits
matchwait

starstone:
put take star
waitfor You
put stow l
waitfor You
goto treasure1

etc

Artha
07-09-2005, 12:33 PM
Possibly because it sees the 'You put your <gem> in your <container>' line and that restarts the loop.

StrayRogue
07-09-2005, 12:35 PM
How can I change it then?

Artha
07-09-2005, 12:37 PM
Don't know. You could maybe try adding commas/periods after the match text, but that'd be a pain in the ass.

edit: You could also squelch the <gem> in <container> text, but that might be opening a new can of worms.

edit2: You could also maybe add a 'You can't find that' or whatever match to go to checkroom/treasure2. If I still played, I'd check it out, but that's not really an option right now.

[Edited on 7-9-2005 by Artha]

[Edited on 7-9-2005 by Artha]

StrayRogue
07-09-2005, 12:42 PM
Hmmm. Thanks for the suggestion but before I do any large scale editing I think I'll wait for others like Latrin, Bob and Nakiro to chime in.

Kitsun
07-09-2005, 12:45 PM
When I made my grab gem script, it kept looping because of the damn room I was in. Check to make sure there isn't a gem in the room description somewhere? Goddamn starstone imbedded tables.

ElanthianSiren
07-09-2005, 12:47 PM
Working on it. Have to replace with RR treasure though. If i figure it out, I will post.

-M

StrayRogue
07-09-2005, 12:51 PM
Originally posted by Kitsun
When I made my grab gem script, it kept looping because of the damn room I was in. Check to make sure there isn't a gem in the room description somewhere? Goddamn starstone imbedded tables.

Yeah its not that. It basically takes the gem, stows it, then gets the gem out of the container, stows it etc constantly.

HarmNone
07-09-2005, 01:06 PM
I'm certainly not a scripter, but is the script taking the same gem out of the container you've placed it in? If so, why not just close the container after each stow, then reopen it before stowing the next gem? Would that work?

HarmNone...the scripting Stupid :spaz:

hectomaner
07-09-2005, 01:09 PM
few ways to fix.

starstone:
put take star
waitfor You
put stow l
waitfor You
pause 1
goto treasure1

or (might be a better way)

treasure1:
pause 1
put look

StrayRogue
07-09-2005, 01:09 PM
You know...that might actually work.

But it will be alot of work. Considering I have two containers to fill, it will be annoying to tell each thing to open/close my cloak and surcoat.

[Edited on 9-7-05 by StrayRogue]

StrayRogue
07-09-2005, 01:35 PM
Thanks Hecto, that seems to have worked.

Bobmuhthol
07-09-2005, 01:36 PM
Get a scripting engine (preferably the one I gave you). Matchbool. The end.

StrayRogue
07-09-2005, 01:38 PM
Why learn a new engine when this one works fine for me?

[Edited on 9-7-05 by StrayRogue]

Bobmuhthol
07-09-2005, 01:39 PM
Obviously, it doesn't.

StrayRogue
07-09-2005, 01:39 PM
It does now.

Bobmuhthol
07-09-2005, 01:40 PM
I hope you never have any other scripting problems that can easily be fixed (and condense hundreds of lines into five) again, then.

hectomaner
07-09-2005, 01:41 PM
so bob, wanna make a tutorial for JSE?

StrayRogue
07-09-2005, 01:42 PM
Yes because I'm sure your engine never has any problems and can do anything.

HarmNone
07-09-2005, 01:42 PM
Originally posted by StrayRogue
You know...that might actually work.

But it will be alot of work. Considering I have two containers to fill, it will be annoying to tell each thing to open/close my cloak and surcoat.

[Edited on 9-7-05 by StrayRogue]

It worked fine in macros I used all those years ago. I'm not into scripting, but it seems to me that closing and reopening the container will stop the loop, while taking little time to execute.

Latrinsorm
07-09-2005, 01:44 PM
First thing: It shouldn't be possible to loop as described from the snippet you've shown. There should at least be a look in between.

Second: What Kitsun said is true. Also watch out for jewelry items.

What I'd change:

put get starstone
match stow You pick
match stow You remove
matchwait

stow:
put stow l
waitfor You
goto Treasure1

As an aside, I'd recommend the method of saving the gem/treasure item as %s and only having one get/stow entry as opposed to one g/s for each gem/treasure in the future. It's less work and easier to add other stuff later.

Bobmuhthol
07-09-2005, 01:45 PM
<<so bob, wanna make a tutorial for JSE?>>

Nope.

<<Yes because I'm sure your engine never has any problems and can do anything.>>

It never has the problem of matching 36 gems and making a label for each one of them. Match $item$, stow %item% works just fine.

StrayRogue
07-09-2005, 01:46 PM
Well at present the counter is being saved for the movement section of my script. The pause 1 is working fine though. I will probably add the extra stow portion though as I forsee problems where I pick up a gem or box and it won't fit in my container. Thanks for the suggestions.

ElanthianSiren
07-09-2005, 02:37 PM
Weird, the script worked just fine for me.

I the only thing I had to do was change it to stow left instead of stow l.


-M

actually, I just remembered I changed a few other things. Posting the script here.


#stows RR treasure

treasure1:
put look
match stone stone
match shell shell
match sapphire sapphire
match topaz topaz
match spinel spinel
match lap lapis
match tour tourmaline
match amulet amulet
match ring ring

match treasure2 obvious paths:
matchwait

treasure2:
put look
match quartz quartz
match tourmaline tourmaline
match mithril mithril-bloom
match nugget nugget
match stone stone

match checkroom Obvious exits
matchwait

stone:
put take stone
waitfor You pick up
put stow left
waitfor You put
goto treasure1

shell:
put take shell
waitfor You pick up
put stow left
waitfor You put
goto treasure1

sapphire:
put take sapphire
waitfor You pick up
put stow left
waitfor You put
goto treasure1

topaz:
put take topaz
waitfor You pick up
put stow left
waitfor You put
goto treasure1

spinel:
put take spinel
waitfor You pick up
put stow left
waitfor You put
goto treasure1

lap:
put take lapis
waitfor You pick up
put stow left
waitfor You put
goto treasure1

tour:
put take tourmal
waitfor You pick up
put stow left
waitfor You put
goto treasure1

amulet:
put take amulet
waitfor You pick up
put stow left
waitfor You put
goto treasure1

ring:
put take ring
waitfor You pick up
put stow left
waitfor You put
goto treasure1

[Edited on Sat, July th, 2005 by ElanthianSiren]