Bucket List

Post Reply
ceff
Posts: 21
Joined: Thu Apr 08, 2010 11:45 pm

Bucket List

Post by ceff »

Okay, so i am trying to organize my Buckets, and with an alias, refill all of them.

1.the lines looks like this:
2.
3.You are wielding:
4. pole187753 : a simple fishing pole in your hands.
5.
6.You are holding:
7. bucket63231 a bucket
8. bucket88305 a bucket
9. bucket62606 a bucket
10. bucket125820 a bucket
11. bucket95083 a bucket
12.
13.
14.You are wearing:
15.
16.so my trigger looks like this: ^You are holding:$ (With filter on) (fire length 1)
17. Line:
18. Trigger: ^ (\w+) a bucket$
19. Line: bucket1 = matches[2]
20. Trigger: ^ (\w+) a bucket$
21. Line :bucket2 = matches[2]
22. Trigger: ^ (\w+) a bucket$
23. Line: bucket3 = matches[2]
24. Trigger: ^ (\w+) a bucket$
25. Line: bucket4 = matches[2]
26. Trigger: ^ (\w+) a bucket$
27. Line :bucket5 = matches[2]
28.

ceff
Posts: 21
Joined: Thu Apr 08, 2010 11:45 pm

Re: Bucket List

Post by ceff »

with all of them children scripts

ceff
Posts: 21
Joined: Thu Apr 08, 2010 11:45 pm

Re: Bucket List

Post by ceff »

okay, how 'bout this?

if matches[2] ~= bucket1 then
if matches[2] ~= bucket2 then
if matches[2] ~= bucket3 then
if matches[2] ~= bucket4 then
if matches[2] ~= bucket5 then
matches[2] == bucket1 else
matches[2] == bucket5 else
matches[2] == bucket4 else
matches[2] == bucket3 else
matches[2] == bucket2 else
matches[2] == bucket1
end

kakku
Posts: 42
Joined: Tue Feb 22, 2011 12:03 pm

Re: Bucket List

Post by kakku »

not sure what you wanna do here.. but maybe you can try the following:

make a new trigger, set it's fire length to 7 or so.
give it a name: triggerOne or something..
make it trigger on perl regex:
^You are holding:$
then make a 2nd trigger. drag it on top of the first one. the first one should now look like a funnel.
make it trigger on perl regex:
^(\w+) a bucket$
and give it some script:
Code: [show] | [select all] lua
if string.find(matches[2], "bucket") then
	send("do something with "..matches[2]) -- send a command to your mud
elseif string.find(matches[2], "You are wearing") then
	setTriggerStayOpen("triggerOne",0)  --makes the first trigger stop firing
end
	
or you could put all the buckets in a table for later use, but that all depends on what you wanna do.

ceff
Posts: 21
Joined: Thu Apr 08, 2010 11:45 pm

Re: Bucket List

Post by ceff »

hrm, I'm trying to gather a variable for each bucket, and then make an alias so that i refill each bucket with water.

kakku
Posts: 42
Joined: Tue Feb 22, 2011 12:03 pm

Re: Bucket List

Post by kakku »

ok. i made a little mistake first time ooops :S
try the following:

make a new trigger, set it's fire length to 7 or so.
give it a name: triggerOne or something..
make it trigger on perl regex:
^You are holding:$
then make a 2nd trigger. drag it on top of the first one. the first one should now look like a funnel.
make it trigger on perl regex:
^(\w+) a bucket$
^You are wearing:$
and give it some script:
Code: [show] | [select all] lua
if string.find(matches[1], "bucket") then
	--send("do something with "..matches[2]) -- send a command to your mud
	if bucketTable == nil then bucketTable = {} end --check if the table exits already if not make a new one.
	table.insert( bucketTable, matches[2] ) --adds the bucketname to the table.
elseif string.find(matches[1], "You are wearing") then
	setTriggerStayOpen("triggerOne",0)  --makes the first trigger stop firing
end
	
now make an alias.
set pattern to ^fillAllBuckets$ (or something you think is clear.)
then add following script:
Code: [show] | [select all] lua
if bucketTable == nil then echo("there aint no bucketTable!")
else for c, buckVar in pairs(bucketTable) do --this runs through the table and does the following to each bucket in there
		send("fill "..buckVar.." with water") -- or however you do it ;)
	end
	bucketTable = {} --empty the table. dunno if you need that..
end
if this doesnt do it, then you really should explain more clearly what you wanna do.

User avatar
Vadi
Posts: 5042
Joined: Sat Mar 14, 2009 3:13 pm

Re: Bucket List

Post by Vadi »

-- or however you do it <img src="./images/smilies/icon_e_wink.gif" alt=";)" title="Wink" />

Geeky!

kakku
Posts: 42
Joined: Tue Feb 22, 2011 12:03 pm

Re: Bucket List

Post by kakku »

lol

JulesK
Posts: 1
Joined: Fri Nov 27, 2015 3:50 am

Re: Bucket List

Post by JulesK »

FYI if you're searching for something to fill buckets, this is one of the first threads you'll probably find, but this seems to be more of of a "here's a rough idea of several different ways you could go about this". The suggestion (yes, even the final version) doesn't actually work as written, and you're going to need to tweak it beyond what's suggested in the commented code. I'm looking to do just the same thing, and it looks like I am going to need to keep looking.

I do think the things here are probably fairly close to being workable (and if I can't find something clearer I may have to come back to this thread), but dealing with strings can be tricky for those of us who still struggle with every bit of code, and I think the poster here sort of assumed a familiarity with strings that probably wasn't there for the OP, and also isn't there for me. As well, "buckVar" is probably going to have to be declared somewhere. Bottom line, if you're looking for sample code you can make sense of (and possibly use to build off of), and which actually works already, this isn't it. Save yourself some confusion and keep looking.

Post Reply