Page 1 of 1

Please help me b4 i poke this blunt stick in my other eye

Posted: Thu Apr 29, 2004 5:11 pm
by Fuergrissa
trying to convert my fletch mac, i am either close or i have made a right pigs ear of it.

this is what i have so far, feel free to chastise me where needed.

Code: Select all

|===========================================|
| V1.0                                      |
|___________________________________________|
|fletch.mac MQ2Data Compliant by Fuergrissa |
|___________________________________________|

#Event SkillUp "You have become better at"
#Event nocomp "You are missing"
#Event SkillTrivial "You can no longer advance your skill from making this item"
#Event FullInventory "There was no place to put that" 
#Event SkillFailure "You lacked the skills" 
#Event SkillSuccess "You have fashioned the items together to create something new" 

Sub Main

      /declare SkillFailCounter int global
      /declare SkillSuccessCounter int global
      /declare SuccessRate int global 
      /declare TotalAttempts int global 
      /declare ParseSkillLevel int global
      /declare ParseSkill int global
      /declare PositionStart int global
      /declare PositionEnd int global
      
      /varset SkillFailCounter 0 
      /varset SkillSuccessCounter 0
      /varset SuccessRate 0 
      /varset TotalAttempts 0 

   :mainloop
      /doevents
      /call Combine
      /goto :mainloop
      /end

Sub Combine
      /notify COMBW_CombineArea CombineButton leftmouseup
      /delay 2
      /if (${Cursor.ID}) /autoinv
      /return

Sub DisplayStats 


      /echo Combine Statistics - Successes: ${SkillSuccessCounter}, Failures: ${SkillFailCounter}
      /varcalc ${TotalAttempts} ${SkillFailCounter} + ${SkillSuccessCounter} 
      /varcalc ${SuccessRate} ${SkillSuccessCounter} / ${TotalAttempts} * 100 
      /echo Success Rate: ${SuccessRate} % out of ${TotalAttempts} attempts
      /return 

Sub Event_SkillUp(SkillUpText)

      /varset PositionStart ${Math.Calc[${String[@SkillUpText].Find[! (]}+3]}
      /varset PositionEnd ${String[@SkillUpText].Find[")"]}
      /varset ParseSkillLevel ${String[@SkillUpText].Mid[@PositionStart,${Math.Calc[@PositionEnd-@PositionStart]}]}
      /varset PositionStart ${Math.Calc[${String[@SkillUpText].Find[at]}+3]}
      /varset PositionEnd ${String[@SkillUpText].Find[!]}
      /varset ParseSkill ${String[@SkillUpText].Mid[@PositionStart,${Math.Calc[@PositionEnd-@PositionStart]}]}
      /popup "@ParseSkill increased - @ParseSkillLevel ..."
      /echo "@ParseSkill increased - @ParseSkillLevel ..."
      /return 

Sub Event_nocomp
      /echo "You have run out of Componants. ((Ending Macro)) "
      /popup You have run out of Componants. ((Ending Macro))   
      /if (${Cursor.ID}) /autoinv
      /call DisplayStats
      /end

Sub Event_SkillTrivial
      /echo "You can no longer advance your skill from making this item. ((Ending Macro))"
      /popup You can no longer advance your skill from making this item. ((Ending Macro))   
      /if (${Cursor.ID}) /autoinv
      /call DisplayStats
      /end

Sub Event_FullInventory 
      /echo "Your inventory is full, ((( Ending Macro ))) "
      /popup Your inventory is full, ((( Ending Macro )))
      /call DisplayStats 
      /end 

Sub Event_SkillFailure
      /varcalc SkillFailCounter ${SkillFailCounter}+1
      /return 

Sub Event_SkillSuccess  
      /varcalc SkillSuccessCounter ${SkillSuccessCounter}+1
      /return
i know im not perfect on success rate but skill up is doing my head in and i have not even started it yet.

Code: Select all

Sub Event_SkillUp(SkillUpText)

      /varset PositionStart ${Math.Calc[${String[@SkillUpText].Find[! (]}+3]}
      /varset PositionEnd ${String[@SkillUpText].Find[")"]}
      /varset ParseSkillLevel ${String[@SkillUpText].Mid[@PositionStart,${Math.Calc[@PositionEnd-@PositionStart]}]}
      /varset PositionStart ${Math.Calc[${String[@SkillUpText].Find[at]}+3]}
      /varset PositionEnd ${String[@SkillUpText].Find[!]}
      /varset ParseSkill ${String[@SkillUpText].Mid[@PositionStart,${Math.Calc[@PositionEnd-@PositionStart]}]}
      /popup "@ParseSkill increased - @ParseSkillLevel ..."
      /echo "@ParseSkill increased - @ParseSkillLevel ..."
      /return 

Posted: Thu Apr 29, 2004 5:37 pm
by s16z
Don't /declare those as globals, us 'outer' instead.

In your /varcalc statements, don't enclose the receiving variable in the ${}. Plus MQ2 hates whitespace, not sure if it will cause a problem though.

In Event_SkillUp, SkillUpText *is* a string, no need to convert it to a string just to use string functions.

Change the use of @variable to ${variable} in Event_SkillUp.

Just from visual inspection.

Posted: Thu Apr 29, 2004 5:37 pm
by MrSmallie
Lose the @s. Use ${blah} instead. Other then that. Cursory glance looks fine.

Posted: Thu Apr 29, 2004 7:07 pm
by Preocts
Good job. Quick glance doesn't show any glaring errors. Like mentioned don't use the global scoop if you can help it, no need. Outer should be the highest you go unless your macros are sharing information with other macros or a custom UI.

Brackets ARGGGGGGG

Posted: Fri Apr 30, 2004 5:02 am
by Fuergrissa
the wife wants to know who is this woman "Brackets", that i keep screaming her name in my sleep.
Any help is allways as usuall appreciated.

here is what i have so far, please be gentle. Lax has chastised me more than enough in this one macro.

Code: Select all

/declare ParseSkillLevel int local
      /declare ParseSkill int local
      /declare PositionStart int local
      /declare PositionEnd int local

      /varset PositionStart ${Math.Calc[${SkillUpText}].Find[! (]}+3]}
      /varset PositionEnd [${SkillUpText}].Find[")"]}
      /varset ParseSkillLevel [${SkillUpText}].Mid[${PositionStart}],${Math.Calc[${PositionEnd}]-[${PositionStart}]}
      /varset PositionStart ${Math.Calc[${SkillUpText}].Find[at]}+3]}
      /varset PositionEnd [${SkillUpText}].Find[!]}
      /varset ParseSkill [${SkillUpText}].Mid[${PositionStart}],${Math.Calc[${PositionEnd}]-[${PositionStart}]}]}
      /popup "ParseSkill increased - ${ParseSkillLevel} ..."
      /echo "ParseSkill increased - ${ParseSkillLevel} ..."
      /return 

Posted: Fri Apr 30, 2004 5:15 am
by ml2517
This should be correct, or close (I don't have time to log in and try to get a skill up :lol: ):

Code: Select all

      Sub Event_SkillUp(SkillUpText) 
      /declare ParseSkillLevel int local 
      /declare ParseSkill int local 
      /declare PositionStart int local 
      /declare PositionEnd int local 
      /varset PositionStart ${Math.Calc[${String["${SkillUpText}"].Find["! ("]}+3]} 
      /varset PositionEnd ${String["${SkillUpText}"].Find[")"]} 
      /varset ParseSkillLevel ${String[${SkillUpText}].Mid[${Math.Calc[${PositionStart}+1]},${Math.Calc[${PositionEnd}-${PositionStart}]}]} 

      /varset PositionStart ${Math.Calc[${String["${SkillUpText}"].Find["at"]}+3]} 
      /varset PositionEnd ${String["${SkillUpText}"].Find["!"]} 
      /varset ParseSkill ${String["${SkillUpText}"].Mid[${Math.Calc[${PositionStart}+1]},${Math.Calc[${PositionEnd}-${PositionStart}]}]} 
      /popup ${ParseSkill} increased - ${ParseSkillLevel} ...
      /echo ${ParseSkill} increased - ${ParseSkillLevel} ... 
      /return 

Posted: Fri Apr 30, 2004 5:21 am
by Fuergrissa
Thank you ml2517 i will try it later when i get home.

Posted: Fri Apr 30, 2004 5:47 pm
by Fuergrissa
ok no errors but i get this echo when i get an increase.

0 increased - (number-100) ...

ie

0 increased - 57 ...

Posted: Fri Apr 30, 2004 6:08 pm
by ml2517
Ah I see, you had the declare set to int and not string. Try this:

Code: Select all

      Sub Event_SkillUp(SkillUpText) 
      /declare ParseSkillLevel int local 
      /declare ParseSkill string local 
      /declare PositionStart int local 
      /declare PositionEnd int local 
      /varset PositionStart ${Math.Calc[${String["${SkillUpText}"].Find["! ("]}+3]} 
      /varset PositionEnd ${String["${SkillUpText}"].Find[")"]} 
      /varset ParseSkillLevel ${String[${SkillUpText}].Mid[${Math.Calc[${PositionStart}+1]},${Math.Calc[${PositionEnd}-${PositionStart}]}]} 

      /varset PositionStart ${Math.Calc[${String["${SkillUpText}"].Find["at"]}+3]} 
      /varset PositionEnd ${String["${SkillUpText}"].Find["!"]} 
      /varset ParseSkill ${String["${SkillUpText}"].Mid[${Math.Calc[${PositionStart}+1]},${Math.Calc[${PositionEnd}-${PositionStart}]}]} 
      /popup ${ParseSkill} increased - ${ParseSkillLevel} ... 
      /echo ${ParseSkill} increased - ${ParseSkillLevel} ... 
      /return 

Re: Please help me b4 i poke this blunt stick in my other ey

Posted: Fri Apr 30, 2004 7:28 pm
by Virtuoso65
Fuergrissa wrote: bla bla...
Sub Main

/declare SkillFailCounter int global
/declare SkillSuccessCounter int global
/declare SuccessRate int global
/declare TotalAttempts int global
/declare ParseSkillLevel int global
/declare ParseSkill int global
/declare PositionStart int global
/declare PositionEnd int global

/varset SkillFailCounter 0
/varset SkillSuccessCounter 0
/varset SuccessRate 0
/varset TotalAttempts 0

:mainloop
/doevents
/call Combine
/goto :mainloop
/return

bla bla bla ...
That should help a bit.