|
Vitae Enchanter
Joined: 17 Jun 2005 Posts: 673 Location: New York
|
Posted: Tue Jun 06, 2006 7:17 pm
#CLASS & #PRIORITY in a script needs cleaning up |
Got a script from a friend of mine. The problem is that it uses #class and #priority and tends to screw up some triggers, and writes variables to the wrong folder.
I decided to just remove the #class and #priority and while at it, rename all the vars by adding gqcycle to the beginning of them. But that seems to break the script. and results in the error msg "- I have no idea what is with GQs at the moment."
I am unsure why changing every var name to something else is causing this (yes I am making sure that EVERY var is being changed.)
Here's some partial mud output from the command this reads from:
Code: |
Date/Time finished From To Completed by Minutes
Getting info from gq history.
------------------------- ---- ---- ------------ -------
Tue Jun 6 15:04:37 2006 194 201 Hrutwang 5
Tue Jun 6 14:47:37 2006 1 12 BovineMan 4
Tue Jun 6 14:30:52 2006 13 24 Shine 7
Tue Jun 6 14:11:39 2006 49 60 Habit 8
Tue Jun 6 13:50:54 2006 191 201 Paipals 4
Tue Jun 6 13:34:10 2006 117 130 Roell 6
etc etc etd
Mon Jun 5 08:59:41 2006 146 160 Dashiell 5
Mon Jun 5 08:42:16 2006 1 12 Audreyiv 5
Mon Jun 5 08:25:00 2006 17 28 Cougr 10
Mon Jun 5 08:01:43 2006 1 8 Kumog 1
631/631H 531/531M 614/614V 4158x 0Q SWUD> |
This is the current CODE output at this time:
Code: |
Working...
+- 22 GQs remaining this cycle -+
| 1/4 *5/16 25/36 |
| 29/40 33/44 37/48 |
| 53/64 69/80 97/108 |
| 105/116 113/125 121/135 |
| 126/140 131/145 136/150 |
| 141/155 146/160 166/180 |
| 171/185 176/190 181/195 |
| 186/201 |
+-------------------------------+ |
The * indicates that there is still a pending GQ for my lvl
Code: |
#CLASS {gq}
#ALIAS gqcleanup {
#CLASS gq
#PRIORITY {
#GAGON
#UNVAR c
#UNVAR check
#UNVAR checks
#UNVAR cycle
#UNVAR cyclestart
#UNVAR finish
#UNVAR gqhist
#UNVAR high
#UNVAR i
#UNVAR low
#UNVAR output
#UNVAR remaining
#UNVAR start
#UNVAR t
#GAGOFF
}
#T- gq_hist_start
#T- gq_hist_data
#T- gq_hist_end
#CLASS 0
}
#ALIAS gqcycle {
#CLASS gq
#T+ gq_hist_start
#SEND {gq hist}
#CLASS 0
}
#VARIABLE gqfulllist {1/4|1/8|1/12|5/16|9/20|13/24|17/28|21/32|25/36|29/40|33/44|37/48|41/52|45/56|49/60|53/64|57/68|61/72|65/76|69/80|73/84|77/88|
81/92|85/96|89/100|93/104|97/108|101/112|105/116|109/120|113/125|117/130|121/135|126/140|131/145|136/150|141/155|146/160|
151/165|156/170|161/175|166/180|171/185|176/190|181/195|186/201|191/201|194/201}
#REGEX "gq_hist_data" {^\w{3} \w{3} +\d{1,2} \d{2}:\d{2}:\d{2} \d{4} +(\d{1,3}) +(\d{1,3}) [\w ]+ +\d{1,2}$} {
#CLASS gq
#IF %ismember( "%1/%2", @gqfulllist) {#VARIABLE gqhist %additem( "%1/%2", @gqhist)}
#CLASS 0
} "" {notrig|disable}
#REGEX "gq_hist_start" {^Date/Time finished From To Completed by Minutes$} {
#CLASS gq
#T+ gq_hist_data
#T+ gq_hist_end
#VARIABLE gqhist {}
#ECHO %ansi( white, bright)Getting info from gq history.
#CLASS 0
} "" {notrig|disable}
#REGEX "gq_hist_end" {^$} {
#CLASS gq
#ECHO %ansi( white, bright)Working...
#VARIABLE cyclestart 0
#IF (%numitems( @gqhist) > 47) {
; if we have at least 1 cycle in history.. check!
#MATH checks {%numitems( @gqhist) - 47}
#VARIABLE cycle moo
#LOOP 1,47 {#VARIABLE cycle %additem( %item( @gqhist, %i), @cycle)}
#VARIABLE start 0
#WHILE ((@start < @checks) & (@cyclestart = 0)) {
; check 1-48, 2-49 .. 50ish-101 or something :P
#ADD start 1
#MATH finish {@start + 47}
#DELNITEM cycle 1 // remove first item from list
#VARIABLE cycle %additem( %item( @gqhist, @finish), @cycle) // add next item from @gqhist
#VARIABLE check @cycle
#FORALL @gqfulllist {#VARIABLE check %delitem( %i, @check)}
#IF (%numitems( @check) = 0) {#VARIABLE cyclestart @start}
}
#VARIABLE cycle {}
#IF (@cyclestart > 1) {
; if we found a start, put current cycle (everything before it) into @cycle
#MATH cyclestart {@cyclestart - 1}
#LOOP @cyclestart,1 {#ADDITEM cycle %item( @gqhist, %i)}
}
} {
; must have just been reboot, yay, only current cycle is in history
; add everything in history to current cycle
#VARIABLE cycle @gqhist
#VARIABLE cyclestart 1
}
#IF @cyclestart {
; we found a start or just had reboot, display remaining gqs in cycle
#VARIABLE remaining @gqfulllist
#FORALL @cycle {#DELITEM remaining %i}
#VARIABLE c %numitems( @remaining)
#ECHO %ansi( white, bright)+-%ansi( red, bright) @c GQs remaining this cycle %ansi( white, bright)%repeat( "-", 3-%len( @c))+
#VARIABLE output {}
#VARIABLE i 1
#2 {#VARIABLE remaining %additem( " ", @remaining)}
#FORALL @remaining {
#VARIABLE t {%i}
#NOOP %regex( @t, "(\d+)/(\d+)", low, high) // if this fails something is terribly wrong.
#VARIABLE t {%concat( %if( (@low <= @current_level) & (@current_level <= @high) & (%len( @t)>1), "*", " "), @t)}
#VARIABLE output %additem( %concat( %repeat( " ", 9-%len( @t)), @t), @output)
}
#WHILE (@i <= @c) {
#ECHO %ansi( white, bright)|%item( @output, @i) %item( @output, @i+1) %item( %@output, @i+2)%repeat( " ", 2)|
#ADD i 3
}
#ECHO %ansi( white, bright)+%repeat( "-", 31)+
} {
; didnt find anything, yeah, this shouldnt happen.
#ECHO - I have no idea what is with GQs at the moment.
}
gqcleanup
#CLASS 0
} "" {notrig|disable}
#CLASS 0
|
I know that in here there is a variable defined as i but no i am not changing the %i to %gqcyclei (before someone wonders )
Any ideas why this is screwing up? |
|
|
|
Larkin Wizard
Joined: 25 Mar 2003 Posts: 1113 Location: USA
|
Posted: Tue Jun 06, 2006 7:50 pm |
1. The use of #CLASS inside all your aliases and triggers is probably unnecessary. Don't think it hurts, but it's just extra commands.
2. You're using #PRIORITY for all your #UNVAR commands and not for your loops. I recommend using it around your loops, at the very least, because that's what causes synchronization problems in scripts most often, especially when you're executing so many loops on a single trigger or alias.
3. Why not just assign a null value to your variables and avoid using #GAGON/#GAGOFF for the #UNVAR commands? There is no need to destroy and create the variables each time you do all of this. |
|
|
|
Vitae Enchanter
Joined: 17 Jun 2005 Posts: 673 Location: New York
|
Posted: Tue Jun 06, 2006 7:53 pm |
1. Like I said, wanted to get rid of that cause it can cause variable writing from other scripts to it
2. Read 1.
3. Yeah, I know, but either way, still want to get rid of 1 & 2 :-) |
|
|
|
Larkin Wizard
Joined: 25 Mar 2003 Posts: 1113 Location: USA
|
Posted: Tue Jun 06, 2006 8:16 pm |
Well, you should get rid of the #CLASS and #UNVAR commands, but move the #PRIORITY command to your "gq_hist_end" trigger. Just enclose everything executed in the trigger inside the #PRIORITY {} block and it should definitely help with any synchronization issues you might see. I've had systems like this go all screwy on me for this reason and adding the #PRIORITY to all my loops has greatly helped me. It doesn't really hurt to put other commands inside of the #PRIORITY command, so you could be more aggressive and enclose everything in one.
|
|
|
|
Vitae Enchanter
Joined: 17 Jun 2005 Posts: 673 Location: New York
|
Posted: Tue Jun 06, 2006 8:31 pm |
k, i'll check that out.
But now to the question that I'd asked.
Any idea why changing all the var names would result in an error? |
|
|
|
Vitae Enchanter
Joined: 17 Jun 2005 Posts: 673 Location: New York
|
Posted: Wed Jun 07, 2006 12:54 am |
bah, it works now, I musta been missing a few vars when i was changing them.
I caught 2 errors when i printed it out. fixed those and seems to work okay now. |
|
|
|
Ulfy Newbie
Joined: 07 Oct 2003 Posts: 7
|
Posted: Wed Jun 07, 2006 1:14 am |
Hmm, I sure had a similar problem.
|
|
|
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|