Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- =begin
- Helps to sell gem jars, purchase items, etc. It lets you string together multiple commands
- to repeat the specified multiple times.
- Put the number of times first, a COMMA seperate each command after that for each iteration.
- No spaces, just a comma.
- author: Luxelle
- game: any
- tags: multifput, input, buy, repeating, multiple command entry, empty jars, etc
- Usage: ;multi 6,shake my jar,sell diamond
- ;multi 10,order 1,buy,stow potion
- It will also work with a script:
- ;multi 3,get something,;scripname,stow something
- Note: Thank you to to Mister Xanlin for the suggestion and code to make it work with scripts, too.
- Changelog:
- Version 1.1 - Prettied up help ;multi help
- Version 1.0 - initial release. Xanlan MADE me do it. 9 July 2018
- =end
- if script.vars[0] == "help"
- respond "Use a comma to separate number of times,command 1,command 2,etc"
- respond " "
- respond "For example:"
- respond ";multi 2,order 1,buy,stow amulet"
- respond "Will do the specified commands 2 times: order 1, buy, stow"
- respond " "
- respond "It will launch a script for you, too:"
- respond ";multi 2,get diamond in pouch,;loresing,put diamond in sack"
- respond " "
- end
- unless script.vars[0]
- respond "Use a comma to separate number of times,command 1,command 2,etc"
- respond " "
- respond "For example:"
- respond ";multi 2,order 1,buy,stow amulet"
- respond "Will do the specified commands 2 times: order 1, buy, stow"
- respond " "
- respond "It will launch a script for you, too:"
- respond ";multi 2,get diamond in pouch,;purify,put diamond in sack"
- respond " "
- else
- #Mister Xanlin's contribution to make it better:
- #in case the user uses a semicolon
- script.vars[0] = script.vars[0] =~ /,/ ? script.vars[0] : script.vars[0].gsub(';',',')
- indiv = script.vars[0].split(',')
- #in case the user puts the num of times at the end instead of the beginning
- num = indiv[0] =~/^\d+$/ ? indiv.shift.to_i : indiv.pop.to_i
- #num.times {multifput indiv}
- num.times {
- indiv.each{ |thing|
- if thing !~ /^;/
- fput thing
- else
- scriptything = thing[1..-1].split(' ')
- Script.run(scriptything[0], scriptything[1..-1].join(" "))
- end
- }
- }
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement