Housing Script Starter

Before installing any Housing Script into Aion you will need to Setup this Script Starter into your Butler

Credit : http://aionmusic.blogspot.com/

random=true
wsec=2

quality=0.015
function s(n)return ("r16"):rep(n) end
function st(n)return "t"..n.." " end
r={}w={}z=0
x=coroutine
y=x.resume
sl=_G.LBoxList
ms={}
mn=0
cs=nil
mc=0
cm=0
nm=0
ft=2
lm=-1
psz=0
sync=0
ch_t={}
PS=H.PlaySound
RM=H.RegisterMenu
SI=H.SetInstrument
SP=H.SetPercussion

function v()
repeat
if(random)then
nm=0
rcm=0
msz=mn if(psz>0)then msz=psz end
repeat rcm=math.random(0,msz) until(lm~=(rcm+nm))
cm=rcm
end
lm=cm+nm
set_music(cm+nm)
nm=1
_i=cs.s_info
PS(0, st(_i.temp).."r1[10]")
a_str=""
if(_i.author)then a_str=" script crée par ".._i.author end
H.AlertAll(10, _i.name..a_str.. ". Monter le son!!!")
x.yield()

dsync=5
ntry=64
sync=dsync
_ab=math.max(quality,0.03)
sync_s={}
ctry=0
slnce=st(_i.temp)..s(64)
for c=0,mc do sync_s[c]=st(180).."l64r[9]rrr" end
for c=0,mc do PS(c, slnce) end
repeat
ctry=ctry+1
for c=0,mc do PS(c, sync_s[c])end
if(ctry>ntry)then
_ab=_ab*1.5 ntry=math.max(16,ntry*0.5) ctry=0
H.SayAll(9, "Synchronizing...[".._ab.."]")
end
x.yield()
_a=999999999
_b=0
for c=0,mc do _a=math.min(_a,ch_t[c]) _b=math.max(_b,ch_t[c])end
if((_b-_a)<=_ab) then sync=sync-1 else sync=dsync end
until(sync<1)
for c=0,7 do PS(c,r[c])end
x.yield()
until(false)
end

function scan()
table.foreach(sl,f)
if((psz>0 and psz<3) or mn<3)then random=false end
RM("> Next",2)
if(not random)then RM("> Prev",3)RM("> Repeat",4)end
if(mn>0)then y(u)end
end

u=x.create(v)
function OnSoundPlay(a,b,c,d)
if(cs and cs.s_info.onsound)then cs.s_info.onsound(a,b,c,d)end
if(d)then
if(d>0 and d<6)then SI(a,d-1)
elseif(d>20)then SP(a,d-20)end
end
if(d==9)then ch_t[a]=os.clock() z=z+1 if(z>mc)then z=0 y(u)end
elseif(d==10)then y(u)
elseif(d==12)then scan()
elseif(d==0 and b and w[b])then H.GlowNow(w[b],ft/c,255,255,255)H.JumpNow(w[b],16.0/(c + 7))end
end

function add_script(c)
if(c and c.s_info and c.s_info.name and (c.r or c.s_info.run))then
_i=c.s_info
_r=c.r
csn=mn
lmn=mn
fts=0
if(_i.run)then _r=_i.run end
if(_i.part)then
for _c=0,mn-1 do if(_i.name == ms[_c].s_info.name)then csn=_c fts=1 end end
if(fts==0)then ms[csn]={r={}}mn=mn+1 end
ms[csn].r[_i.part]=_r
else
ms[csn]={r=_r} mn=mn+1
end
ms[csn]["s_info"]=_i
if(_i.temp==nil)then ms[csn].s_info.temp=120 end

if(lmn~=mn)then
PS(1,"r8[11]")
H.SayAll(11,mn..": ".._i.name)
end
end
end

function f(n)
c=sl[n]
if(c and c.s_info and c.s_info.type)then
if(c.s_info.type=="music")then
add_script(c)
end
if(c.s_info.type=="multi_music" and c.s_info.array)then
sz = table.getn(c.s_info.array)
for j=1,sz do
add_script({["s_info"]=c.s_info.array[j],["r"]=c.r})
end
end
end
end

function search_script(n)
cm=(n%psz)
music_name=play_list[cm+1]
for c=0,mn-1 do if(music_name == ms[c].s_info.name)then cs = ms[c] end end
end

function set_music(n)
if(psz>0)then search_script(n) else cm=n%mn cs=ms[cm]end
for c=0,7 do SI(c,0)end
r={}
z=0
if(type(cs.r)=="table")then
local sz=table.getn(cs.r)
for c=1,sz do _tr={cs.r[c]()}
for k,v in pairs(_tr) do if(r[k])then r[k]=r[k].."[1]v10"..v else r[k]=v end end
end
end
if(type(cs.r)=="function")then
r={cs.r()}
end
ft=(240.0/cs.s_info.temp)-0.1
mc=table.getn(r)-1
for c=1,mc+1 do r[c-1]=r[c].."[9]" end
for c=mc+1,7 do r[c]=st(cs.s_info.temp)..s(1024*8)end
end

function setup()
i=1("cdefgab"):gsub(".",function(c)w[c]=i i=i+1 end)
PS(1,"r8[11]")
rnd_str=""
if(random)then rnd_str="[Mode Aléatoire]" end
H.SayAll(11,"JukeBox Player "..rnd_str..":")
if(play_list)then psz=table.getn(play_list)end
if(wsec<=0)then scan()else PS(2,"t120"..s(wsec*8).."[12]")end
end

function OnInit()
H.SetOutletCount(7)
H.EnableSoundCallback(1)
setup()
end

function mf(_a)
if(sync<1)then nm=_a y(u)end
end
mfa={0,1,-1,0}
function OnMenu(a)
mf(mfa[a])
end
function OnUserSay(str)
str=str:lower()
if(str=="list")then end
if(str=="next")then mf(1) end
if(not random)then
if(str=="prev")then mf(-1)end
if(str=="try again")then mf(0)end
end
if(str:len() > 4)then for m=0,mn-1 do
if(ms[m].s_info.name:lower():find(str) ~= nil)then cm=m tr=random random=false mf(0) random=tr break end end end
end 

Once done you can import your Music script

You can watch the video on how to do it here : https://www.youtube.com/watch?v=WRqa_DZCOrM

Administrator
Administrator
  • 1 year ago