PDA

View Full Version : Help with Duplicating Script



Beguiler
06-29-2007, 03:06 PM
Hi. I'm having some trouble with what should be an easy script. Not surprising, i usually only make little no brainers. But somewhere this baby is NOT working. It hangs on the very first MATCH. Could someone take a look at this and tell me where I'm going wrong, so I can learn from this?

Many thanks,

Syri's Player

----------------------------------------

#Duplicate stuff
#Usage is: .dup <item>

Start:
If_1 goto CHECK
exit

CHECK:
put get %1% from my backpack
put prep 405
put cast my %1%
pause 3
Match DUPE charges.
Match NODUPE not well suited for duplicating.
Match ALLGONE Get what?
MatchWait
pause 2

DUPE:
Goto Duplicate

Duplicate:
put prep 918
put cast my %1%
PAUSE 3
put put my %1% in my knapsack
PAUSE 1
put put my %1% in my knapsack
goto CHECK

NODUPE:
Goto NoDuplicate

Noduplicate:
PAUSE 2
put put my %1% in my knapsack
goto CHECK

ALLGONE:
Goto Gone

Gone:
put close my backpack
put close my knapsack
exit

Celephais
06-29-2007, 03:13 PM
CHECK:
Match DUPE charges.
Match NODUPE not well suited for duplicating.
Match ALLGONE Get what?
put get %1% from my backpack
put prep 405
put cast my %1%
MatchWait

...

Always put your matches before your puts

JRF52084
06-29-2007, 03:31 PM
CHECK:
Match DUPE charges.
Match NODUPE not well suited for duplicating.
Match ALLGONE Get what?
put get %1% from my backpack
put prep 405
put cast my %1%
MatchWait

...

Always put your matches before your puts


I am curious to know as to why the matches need to go before the puts in a script? All the basic scripts I have made the matches go after the put and never had a problem.

Celephais
06-29-2007, 03:34 PM
I am curious to know as to why the matches need to go before the puts in a script? All the basic scripts I have made the matches go after the put and never had a problem.

It has to do with latency, creating a race condition... essentially all your commands in the script happen fast enough that they create their hook before the SIMU server gets to respond to the put.

His case was an extreme because he had a pause... the puts happened, the pause took place, Simu responded, then he put in the hooks to wait for the response... since it already responded the hooks never got called.

If SIMUs servers responded instantaneously then you would get a response before the match gets processed. So the safest practice is to place in your matches, basically creating the "wait fors" and then send your commands to simu, since you're already waiting for the reply you don't have to worry about them replying before you're ready.

Slark
06-29-2007, 04:37 PM
Even celephais' code will not work, because if you don't have a wand to get, you will try to cast at something not in your hand and the script won't realize it. You either need to add a second match/matchwait when you try to get the item out of your container, or you need to add an extra MATCH to the one he fixed, something like "match nowand cast at what" or whatever, I can't remember the syntax.

Here's a better version of the script you're trying to write:

#Duplicate stuff
#Usage is: .dup <item>

Start:
If_1 goto CHECK
exit

CHECK:
put get %1% from my backpack
put prep 405
Match DUPE charges.
Match NODUPE not well suited for duplicating.
Match ALLGONE Cast at what? (you may need to change this hook)
put cast my %1%
MatchWait

DUPE:
Pause 3
put prep 918
put cast my %1%
PAUSE 3
put put my %1% in my knapsack
PAUSE 1
NODUPE:
put put my %1% in my knapsack
goto CHECK

ALLGONE:
put close my backpack
put close my knapsack

Celephais
06-29-2007, 04:47 PM
Actually the code will realize it the way I changed it, it just will prep and cast and then fire on the "get what?" which you removed ...
I imagine you'd be better off not even prepping 405...

CHECK:
Match ALLGONE get what?
Match CONT you get
put get %1% from my backpack
MatchWait
CONT:
put prep 405
Match DUPE charges.
Match NODUPE not well suited for duplicating.
put cast my %1%
MatchWait

GS4-D
06-29-2007, 05:11 PM
I'd recommend a mana check in there as well if you plan on duping a backpack full of wands/crystals.

Slark
06-29-2007, 05:14 PM
Actually the code will realize it the way I changed it, it just will prep and cast and then fire on the "get what?" which you removed ...

Unlikely. Your code:

CHECK:
Match DUPE charges.
Match NODUPE not well suited for duplicating.
Match ALLGONE Get what?
put get %1% from my backpack ----> the would-be-bug would be in response to this line
put prep 405
put cast my %1%
MatchWait -----> by the time the script gets to this point, the bugged line would have MOST LIKELY passed already. Granted, you could do it this way, but it's unreliable.

Your solution is what I proposed - two matches. Mine might be a bit buggy, let me fix it...

I do agree with the mana check, by the way. Couldn't hurt.

EDIT - nope, mine is fine...worst case scenario is you try to prep 405 when you already have it prepped, or, if it's your last wand, you end with a cast of 405 prepped and might waste the mana. You could always put a "put release" right before the script ends, but odds are, 90% of the time this would be useless. No harm having it there, though.

Celephais
06-29-2007, 05:31 PM
Slark, the matchwait does not need to get hit in order for a match to be followed, the "would-be-bug" WILL respond to that line, and then prep, cast in uselessness... yours would still get nothing, and then prep and then cast at the item in your knapsack if it were the last one.

Either way the next proposal I made (waiting for get what or you get) would be the way to go.

Mana check is obviously good.

Slark
06-29-2007, 06:08 PM
Slark, the matchwait does not need to get hit in order for a match to be followed


Are you 100% positive about that? If so, I never used it this way, and it sort of defeats the whole purpose of matchwait. This isn't lich...

Celephais
06-29-2007, 07:04 PM
Are you 100% positive about that? If so, I never used it this way, and it sort of defeats the whole purpose of matchwait. This isn't lich...

The purpose of matchwait is that it's like saying "pause until you hit a match" you could do something like this:

Match thankThem and you pocket the silvers. (whatever the coins given thing is
pause 5
put 'that selfish bastard

so in that way you can try to match something and give it a "timeout", whereas matchwait has no timeout.

Beguiler
06-30-2007, 02:41 PM
Eeek. The first couple of replies I was almost following, but I got lost, and now I'm really not sure what to do. Um, mana check, if I had a clue, would be nice, usually I just hit 'abort' when I get low <duck>.

I'll try to see if something works, if not I would appreciate someone PMing me with a couple practical suggestions on how and where to put in mana checks, etc. Appreciate your fine minds taking time to help!

Syri..