Please tell me why this doesnt work. =)

Help section from before the user variable changes that broke all macros

Moderator: MacroQuest Developers

Ariain
a ghoul
a ghoul
Posts: 88
Joined: Fri Oct 11, 2002 10:35 am

Please tell me why this doesnt work. =)

Post by Ariain » Sat Oct 12, 2002 11:28 pm

Code: Select all

##define SONG1 t0
#define SONG2 t1
#define SONG3 t2
#define SONG4 t3

Sub Main
:Mainloop
/doevents
/goto :Mainloop
/return

Sub Sing1
/cast 5
/varset SONG1 18s
/return

Sub Sing2
/cast 4
/varset SONG2 18s
/return

Sub Sing3
/cast 2
/varset SONG3 18s
/return

Sub Sing4
/cast 1
/varset SONG4 18s
/return

Sub Event_Timer

/if n 0==SONG1 /call Sing1
/return

Sub Event_Timer

/if n 0==SONG2 /call Sing2
/return

Sub Event_Timer

/if n 0==SONG3 /call Sing3
/return

Sub Event_Timer

/if n 0==SONG4 /call Sing4
/return 
It tells me that it cant parse Selo when I /call selo
And besides that doesnt do a damn thing.What i want it to do is cast spell 5 every 5 seconds.

Draekz
a hill giant
a hill giant
Posts: 263
Joined: Thu Aug 01, 2002 6:07 pm
Location: Winnipeg, Manitoba, Canada

Post by Draekz » Sun Oct 13, 2002 12:56 am

Hmm first of all, /call function works only with the Sub<eventname> function.

You can only call (in your macro)

/call Main
/call Sing1
/call Sing2

etc etc.

To get it to cast the first song again you have to /call Sing1 or make a seperate /goto function

Under Sub Sing1 type :selos and then wherever you want to goto from type /goto :selos

Im gonna edit your script a little and i wont guarantee it'll work (the way i do it) but i'll do it the way i would've done it :)

Nice to see ya tried at least tho :) You are pretty new here (so i've noticed via posts)

Code: Select all


##define SONG1 t0   |This is wrong..only one #sign
 
-^------------------------^

#define SONG2 t1 
#define SONG3 t2 
#define SONG4 t3 

Sub Main 
:Mainloop 
/doevents 
/goto :Mainloop 
/return             | Not sure whats going on anywhere in here..perhaps 
                       |just more complexly coded then i normally do 
--^-----------------^

Sub Sing1 
/cast 5 
/varset SONG1 18s 
/return                    |Instead of /returning../call next sub to go to the 
                              |next song you are trying to cast
--------------------------^
Sub Sing2 
/cast 4 
/varset SONG2 18s 
/return 

Sub Sing3 
/cast 2 
/varset SONG3 18s 
/return 

Sub Sing4 
/cast 1 
/varset SONG4 18s 
/return 

__________________
I personally wouldnt include this sub..perhaps its needed, no idea
__________________
Sub Event_Timer 

/if n 0==SONG1 /call Sing1 
/return 

Sub Event_Timer 

/if n 0==SONG2 /call Sing2 
/return 

Sub Event_Timer 

/if n 0==SONG3 /call Sing3 
/return 

Sub Event_Timer 

/if n 0==SONG4 /call Sing4 
/return 
_______________________

Ok now that i've pointed out the area's i'd change..here's what i'd do in placee :)

Code: Select all

|**Bardtwist.mac
|Author Arain
 **|

#define SONG1 t0 
#define SONG2 t1 
#define SONG3 t2 
#define SONG4 t3 

Sub Main 
:Mainloop 
/call Sing1

/return 

Sub Sing1 
/cast 5 /varset SONG1 18s 
/if n $SONG1==0 { /cast 5
}else /if $SONG1 >0 { /call Sing2
}
/delay 5s
/call Sing2
/return 

Sub Sing2 
/cast 4 /varset SONG2 18s 
/if $SONG2==0 { /cast 4
}else /if $SONG2>0 /delay 5s /call Sing3
}
/delay 5s
/call Sing3
/return 

Sub Sing3 
/cast 2  /varset SONG3 18s 
/if $SONG3==0 { /cast 2
}else /if $SONG3>0 { /delay 5s
/cast 1
/call Sing4
}
/delay 5s
/call Sing4
/return 

Sub Sing4 
/cast 1 /varset SONG4 18s 
/if $SONG4==0 { /cast 1
/cast 1
/delay 5s
}else /if $SONG4>0 { /delay 5s /goto :MainLoop
}
/delay 5s
/goto :MainLoop
/return 

Thats probably coded fairly dirty..im super tired right now and just threw it together ;) I have a bard also so wouldnt mind figuring this out.

Thats probably fairly buggy so you'd have to work out the kinks..but its an idea ;)

Take care and if i feel up to it later i'll work on it some more :)

Draekz

Ariain
a ghoul
a ghoul
Posts: 88
Joined: Fri Oct 11, 2002 10:35 am

After many hours.

Post by Ariain » Sun Oct 13, 2002 3:11 pm

Heres what I ended up with last night. Not perfect but Iam getting there I want to add the varible song numbers like another guy did in his twisting macro so when a you miss a note you go back t othe same song. But Havent got that yet. Also Changing instruments tends to get screwed up after a few rounds aka they wont go to the right place things will be on my cursor. Havent figured out why yet so I |'ed them.

Code: Select all

#define SONG1 t1
#define SONG2 t2
#define SONG3 t3
#define SONG4 t4

#event MissedNote "You miss a note, bringing your song to a close!" 
#event Stunned "You are unstunned."

Sub Main
/call sing1
 :Mainloop
/doevents
/goto :Mainloop


Sub Sing1
/stop song
/delay 2
/cast 5
/varset SONG1 50s
/varset SONG2 31
/goto :Mainloop


Sub Sing2
/stop song
/delay 2
/cast 4
|/click left hotkey 6
|/click left hotkey 8
|/click left hotkey 9
|/click left hotkey 7
/varset SONG2 50s
/varset SONG3 31
/goto :Mainloop


Sub Sing3
/stop song
/delay 2
/cast 2
|/click left hotkey 7
|/click left hotkey 9
|/click left hotkey 8
|/click left hotkey 6
/varset SONG3 50s
/varset SONG4 31
/goto :Mainloop


Sub Sing4
/stop song
/delay 2
/cast 1
/varset SONG4 50s
/varset SONG1 31
/goto :Mainloop


Sub Event_Timer

/if n $SONG1==0 /call Sing1
/if n $SONG2==0 /call Sing2
/if n $SONG3==0 /call Sing3
/if n $SONG4==0 /call Sing4
/doevents
/goto :Mainloop

Sub Event_Missednote
/varset SONG1 50s
/varset SONG2 50s
/varset SONG3 50s
/varset SONG4 50s
/call sing1


Sub Event_Stunned
/varset SONG1 50s
/varset SONG2 50s
/varset SONG3 50s
/varset SONG4 50s
/call sing1

Ariain
a ghoul
a ghoul
Posts: 88
Joined: Fri Oct 11, 2002 10:35 am

Delays.

Post by Ariain » Sun Oct 13, 2002 3:12 pm

The whole point was to do it without any delays so it would run inside other macros like hunting macros. the /delay 2 dont really effect but I cant have /delay 5s just doesnt work.

DaRoot
orc pawn
orc pawn
Posts: 15
Joined: Sat Oct 05, 2002 10:39 pm

Post by DaRoot » Tue Oct 15, 2002 6:14 pm

Ok I'm no expert at bard songs... but it looks like your getting caught up in the mainloop

where you have

Code: Select all

Sub Main
/call sing1
:mainloop
/doevents
/goto :mainloop
this is telling MQ to call the sub sing1, do whats in there, then in the sing1 sub your telling to go back to :mainloop, do the event then go back to :mainloop, do the event, go back ....etc etc etc..

if you approach it like draekz did where each sub calls the next sub, sounds like it would work a lil easier. where sing1 does what it needs to do then calls sing2 and so on and so forth, this way it loops through all the sing subs before returning to :mainloop.

also I seems like it would be a good idea to include the /call sing1 inside the :mainloop label like

Code: Select all


Sub Main
:mainloop
/call sing1
/doevents
/goto :mainloop
or another appoach would be to call each sub out in the main and have each sub return when its done

Code: Select all

Sub Main
:mainloop
/call sing1
/delay 1
/call sing2
/delay 1
/call sing3
/doevents
/goto :mainloop

Sub sing1
/(do your song coding here)
/return

Sub sing2
/(song code here)
/return

etc,etc...
this would tell it to call the sub, in the sub do what you want with the song then return to main, then it calls the next song...etc etc etc.

again I not familiar with bard songs so If I'm wrong, please correct me.
Just a few ideas to try.

Valerian
a grimling bloodguard
a grimling bloodguard
Posts: 709
Joined: Sun Jul 28, 2002 3:29 am

Post by Valerian » Wed Oct 16, 2002 6:16 am

BAH! I almost had a good working version of this with variable songs (including full text names, of course) and then the patch cut me off in the middle of debugging. will hopefully be able to work on it a bit more when I get my hands on some new offsets *sigh*

:?