Summoning Script

Post Reply
Theiwar
Posts: 24
Joined: Sun Dec 12, 2010 3:49 pm

Summoning Script

Post by Theiwar »

On to my next project, trying to create a script to automate my summoning. Essentially I've got a simple table with the names of all my ents:
Code: [show] | [select all] lua
summonlist = {"skyrax", "rixil", "eerion", "arctar", "scrag", "pyradius", "dameron", 
"palpatar", "nin'kharsag", "istria", "marduk", "nemesis", "buul", "cadmus", "piridon", "danaeus", "lycantha", "hecate"}
Now what function do I use to go through that list and summon the current entity (i.e. send("summon" ..nextsummon..)) and then wait for balance and then summon the next one. Thanks!

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

Re: Summoning Script

Post by Vadi »

Um, there are no functions to wait for your MUDs balances.

Theiwar
Posts: 24
Joined: Sun Dec 12, 2010 3:49 pm

Re: Summoning Script

Post by Theiwar »

Actually I've worked out most of it, I just need to know how to do it using that table? So to keep things simple how would I summon the first name in the list i.e. send("summon" ..FIRSTnameINtable)

Yetzederixx
Posts: 186
Joined: Sun Nov 14, 2010 5:57 am

Re: Summoning Script

Post by Yetzederixx »

Need a variable storing the current index, when you hit the end of the list you'll probably want to reset it to 1. Then everytime you regain balance:
Code: [show] | [select all] lua
send("summon " .. summonlist[index])
index = index + 1

Theiwar
Posts: 24
Joined: Sun Dec 12, 2010 3:49 pm

Re: Summoning Script

Post by Theiwar »

Ok so this is what I came up with, let me know your thoughts/improvements:
Alias:
Code: [show] | [select all] lua
echo( "-----------BEGIN SUMMONING-----------" )
send("summon skyrax")
sumindex = 1
summongo = 1
Triggers:
Code: [show] | [select all] lua
^You have recovered equilibrium.$
if summongo == 1 
	then
	summonall()
end
Code: [show] | [select all] lua
^The Entity refuses to send another minion to aid you.$
You cannot summon
if summongo == 1 
	then
	sumindex = sumindex + 1
	summonall()
end
Script Function:
Code: [show] | [select all] lua
function summonall()
	if sumindex <= 17 then 
		send("summon " .. summonlist[sumindex])
		sumindex = sumindex + 1
	else
summongo = 0
	end
end

User avatar
tsuujin
Posts: 695
Joined: Fri Feb 26, 2010 12:59 am
Location: California
Contact:

Re: Summoning Script

Post by tsuujin »

if you're using a standard table, you don't have to hard code the length of it in. You can just prefix the table name with a hash (#) to get the number of elements in the table.
Code: [show] | [select all] lua
if sumindex <= #summonlist then

Post Reply