Script and a problem sending a lot of things to the mud

Posted by Gore on Sun 04 Apr 2004 11:14 AM — 5 posts, 21,703 views.

#0
Hey what's up, I've got this script to scroll through a list of things I have in my inventory (corpses), record the numbers of them, then do spam offer (corpse) searching through an array. Here's my code:

Quote:
<aliases>
  <alias
   script="corpse_start"
   match="^offer\:all$"
   enabled="y"
   group="script-offer"
   regexp="y"
   ignore_case="y"
   keep_evaluating="y"
   sequence="100"
  >
  </alias>
</aliases>

<triggers>
  <trigger
   custom_colour="17"
   group="script-offer"
   keep_evaluating="y"
   match="^\&quot;(.*?)\&quot;(\s+)the corpse of"
   name="corpse_trigger"
   regexp="y"
   script="corpse_add"
   sequence="100"
   other_text_colour="gray"
   other_back_colour="white"
  >
  </trigger>
  <trigger
   group="script-offer"
   keep_evaluating="y"
   match="^You are wearing\:$"
   name="offer_prompt"
   regexp="y"
   script="corpse_offer"
   sequence="100"
  >
  </trigger>
</triggers>

Dim Corpses()
Redim Corpses(0)

Sub Corpse_start (a,b,wildcard)
  World.Send "config pagelength 250"
  World.Send "ii corpse"
  World.EnableTrigger "corpse_trigger", TRUE
  World.EnableTrigger "offer_prompt", TRUE
End Sub

Sub Corpse_add (a,b,wildcard)
  ub = ubound(Corpses)
  If ub = 0 and isempty(Corpses) then
    Corpses(0) = wildcard(1)
  Else
    redim Preserve Corpses(ub+1)
    Corpses(ub+1) = wildcard(1)
  End If
End Sub  

Sub Corpse_offer (a,b,wildcard)
  World.ColourNote "black", "white", "-Offering corpses-"
  ub = ubound(corpses)
  For i = 1 to ub step 1
    World.Send "offer " & Corpses(i)
  Next
  World.EnableTrigger "corpse_trigger", FALSE
  World.EnableTrigger "offer_prompt", FALSE
  World.Send "config pagelength 20"
  redim Preserve Corpses(0)
End Sub



Which works fine and dandy, except if I have a lot of corpses, like 20 or so corpses, in which it'll offer up 15 or so corpses, then stop. And I'll have to send something through. Here's the output on the next post:
#1
Quote:
828h, 2532m cexdb-Your current pagelength: 250
3828h, 2532m cexdb-You aren't wielding anything in either hand.
You are holding:
"hare237746"        the corpse of a rheodine hare
"swarm126730"       the corpse of a swarm of mosquitoes
"swarm121051"       the corpse of a swarm of mosquitoes
"hare237759"        the corpse of a rheodine hare
"lynx133641"        the corpse of a forest lynx
"swarm118439"       the corpse of a swarm of mosquitoes
"hare231010"        the corpse of a rheodine hare
"swarm144098"       the corpse of a swarm of mosquitoes
"lynx174125"        the corpse of a forest lynx
"swarm54085"        the corpse of a swarm of mosquitoes
"cormorant13214"    the corpse of a double-crested cormorant
"hare237803"        the corpse of a rheodine hare
"hare217573"        the corpse of a rheodine hare
"hare210583"        the corpse of a rheodine hare
"lynx171258"        the corpse of a forest lynx
"hare237788"        the corpse of a rheodine hare
"cormorant128254"   the corpse of a double-crested cormorant
"cormorant56941"    the corpse of a double-crested cormorant
"cormorant226050"   the corpse of a double-crested cormorant
"sandpiper237725"   the corpse of a little sandpiper
"hare219816"        the corpse of a rheodine hare
"cormorant222063"   the corpse of a double-crested cormorant
"cormorant139721"   the corpse of a double-crested cormorant
"cormorant17137"    the corpse of a double-crested cormorant
You are wearing:
-Offering corpses-
3828h, 2532m cexdb-You offer up the corpse of a rheodine hare to Lupus, Wild God of the Beasts.
3828h, 2532m cexdb-You offer up the corpse of a swarm of mosquitoes to Lupus, Wild God of the 
Beasts.
3828h, 2532m cexdb-
You offer up the corpse of a swarm of mosquitoes to Lupus, Wild God of the 
Beasts.
3828h, 2532m cexdb-
You offer up the corpse of a rheodine hare to Lupus, Wild God of the Beasts.
3828h, 2532m cexdb-
You offer up the corpse of a forest lynx to Lupus, Wild God of the Beasts.
3828h, 2532m cexdb-
You offer up the corpse of a swarm of mosquitoes to Lupus, Wild God of the 
Beasts.
3828h, 2532m cexdb-
You offer up the corpse of a rheodine hare to Lupus, Wild God of the Beasts.
3828h, 2532m cexdb-
You offer up the corpse of a swarm of mosquitoes to Lupus, Wild God of the 
Beasts.
3828h, 2532m cexdb-
You offer up the corpse of a forest lynx to Lupus, Wild God of the Beasts.
3828h, 2532m cexdb-
You offer up the corpse of a swarm of mosquitoes to Lupus, Wild God of the 
Beasts.
3828h, 2532m cexdb-
You offer up the corpse of a double-crested cormorant to Lupus, Wild God of the
Beasts.
3828h, 2532m cexdb-
You offer up the corpse of a rheodine hare to Lupus, Wild God of the Beasts.
3828h, 2532m cexdb-
You offer up the corpse of a rheodine hare to Lupus, Wild God of the Beasts.
3828h, 2532m cexdb-
You offer up the corpse of a rheodine hare to Lupus, Wild God of the Beasts.
3828h, 2532m cexdb-
You offer up the corpse of a forest lynx to Lupus, Wild God of the Beasts.
3828h, 2532m cexdb-
You offer up the corpse of a rheodine hare to Lupus, Wild God of the Beasts.
3828h, 2532m cexdb-
You offer up the corpse of a double-crested cormorant to Lupus, Wild God of the
Beasts.
3828h, 2532m cexdb-
You offer up the corpse of a double-crested cormorant to Lupus, Wild God of the
Beasts.
3828h, 2532m cexdb-
You offer up the corpse of a double-crested cormorant to Lupus, Wild God of the
Beasts.
3828h, 2532m cexdb-
You offer up the corpse of a little sandpiper to Lupus, Wild God of the Beasts.
3828h, 2532m cexdb-
You offer up the corpse of a rheodine hare to Lupus, Wild God of the Beasts.
3828h, 2532m cexdb-What is it you wish to offer?


So it just stopped (I wish I was echoing my commands for this..) then I had to start the script again, here's the output:

Quote:
You aren't wielding anything in either hand.
You are holding:
"cormorant222063"   the corpse of a double-crested cormorant
"cormorant139721"   the corpse of a double-crested cormorant
"cormorant17137"    the corpse of a double-crested cormorant
You are wearing:
3828h, 2532m cexdb-Your current pagelength: 250
3828h, 2532m cexdb-You aren't wielding anything in either hand.
You are holding:
"cormorant222063"   the corpse of a double-crested cormorant
"cormorant139721"   the corpse of a double-crested cormorant
"cormorant17137"    the corpse of a double-crested cormorant
You are wearing:
-Offering corpses-
3828h, 2532m cexdb-You offer up the corpse of a double-crested cormorant to Lupus, Wild God of the
Beasts.
3828h, 2532m cexdb-You offer up the corpse of a double-crested cormorant to Lupus, Wild God of the
Beasts.
3828h, 2532m cexdb-
You offer up the corpse of a double-crested cormorant to Lupus, Wild God of the
Beasts.
3828h, 2532m cexdb-
Your current pagelength: 20
[/qoute]

Any ideas?
Russia #2
The script looks fine, my guess that it has to do with the mud. Sometimes if you spam commands very fast it will concatenate them, e.g.:


world.send "outr thing"
world.send "outr thing"
...
world.send "outr thing"


comes out as:


"outr thingoutrthingoutrthi"
"ng"
"outr thing"


at some point in the sequence. This is what could be happening. You can try sending commands through a speedwalk with a small delay - about 100ms should be enough to keep the commands separate.
#3
oo thanks, how do I do that tho? World.DoAfterSpecial would still spam through the for next though
Russia #4
check the following callbacks in Mushclient's help:

world.SpeedwalkDelay
world.Queue
world.DiscardQueue