Moderator: MacroQuest Developers

to#Event GainExp "You gain"
#Event GainExp "You regain some experience from resurrection"
#Event LoseExp "You have been slain"
Code: Select all
#Event GainExp "#*#You gain#*#"
#Event GainExp "#*#You regain some experience from resurrection#*#"
#Event LoseExp "#*#You have been slain#*#"





Code: Select all
|**
ExpReport.inc written by Preocts. Updated last: 05/01/2004
Modified for post on 07/18/04 from info posted by hiipii to make it compatible
with the recent changes in coding for Events.
This file tracks exp information. It is dependant on ini information. That
information is stored in ${IniFileName} under keys [ExpTrack] and [Settings]
*Should handle Exp, AA, Leadership, and RaidLeadership equally as well.
[ExpTrack] is self creating.
[Settings] is not required. Optional ValueNames include:
Noise=0[default] no /echos to screen. 1 /echos to screen each kill
REQUIRED OUTER VAR: IniFileName
Should easy to understand what to set this to.
**|
#Event GainExp "#*#You gain#*#"
#Event GainExp "#*#You regain some experience from resurrection#*#"
#Event LoseExp "#*#You have been slain#*#"
Sub StartExpTrack
|/declare IniFileName string outer whatever.ini
|Update the ini with current Exp and AAexp
/ini "${IniFileName}" "ExpTrack" "PastExp" "${Me.PctExp}"
/ini "${IniFileName}" "ExpTrack" "PastAA" "${Me.PctAAExp}"
/ini "${IniFileName}" "ExpTrack" "PastLeader" "${Me.PctGroupLeaderExp}"
/ini "${IniFileName}" "ExpTrack" "PastRaid" "${Me.PctRaidLeaderExp}"
/return
Sub Event_GainExp
| If nothing has changed: miscall, leave.
/if (${Ini[${IniFileName},ExpTrack,PastExp,0]}==${CurrentExp} && ${Ini[${IniFileName},ExpTrack,PastAA,0]}==${CurrentAA}) /return
| This sub is just all math logic for calc'ing EXP gains. Gains, not loses.
| Thanks to Lax's new ${} phrasing this is done with ONE loop! Rock on your bad self Lax!
/declare Past int local
/declare Current int local ${Me.PctExp}
/declare Count int local
/declare Total int local
/declare Change int local 0
/declare ExpType string local Exp
:FourLoop
/varset Past ${Ini[${IniFileName},ExpTrack,Past${ExpType},0]}
/varset Count ${Ini[${IniFileName},ExpTrack,${ExpType}Count,0]}
/varset Total ${Ini[${IniFileName},ExpTrack,${ExpType}Total,0]}
/if (${Past}!=${Current}) {
/if (${Past}<${Current}) {
/varcalc Change ${Current}-${Past}
} else {
/if (${Current}) {
/varcalc Change (${Current}+100)-${Past}
} else {
/varcalc Change 100-${Past}
}
}
/varcalc Count ${Count}+1
/varcalc Total ${Total}+${Change}
/if (${Ini[${IniFileName},Settings,Echo,0]}) {
/echo You have gained ${Change}% ${ExpType} experience on that kill.
/echo Total ${ExpType} changes: ${Count}, Total ${ExpType} Gained: ${Total}, Average per change: ${Math.Calc[${Total}/${Count}]}% ${ExpType} Exp
}
}
/ini "${IniFileName}" "ExpTrack" "Past${ExpType}" ${Current}
/ini "${IniFileName}" "ExpTrack" "${ExpType}Count" ${Count}
/ini "${IniFileName}" "ExpTrack" "${ExpType}Total" ${Total}
/if (${ExpType.Equal[Exp]}) {
/varset ExpType AA
/varset Current ${Me.PctAAExp}
/varset Change 0
/goto :FourLoop
}
/if (${ExpType.Equal[AA]}) {
/varset ExpType Leader
/varset Current ${Me.PctGroupLeaderExp}
/varset Change 0
/goto :FourLoop
}
/if (${ExpType.Equal[Leader]}) {
/varset ExpType Raid
/varset Current ${Me.PctRaidLeaderExp}
/varset Change 0
/goto :FourLoop
}
/return
Sub Event_LoseExp
| More math, this time with EXP lose due to death.
/declare PastExp int local ${Ini[${IniFileName},ExpTrack,PastExp,0]}
/declare CurrentExp int local ${Me.PctExp}
/declare ExpCount int local ${Ini[${IniFileName},ExpTrack,ExpCount,0]}
/declare ExpTotal int local ${Ini[${IniFileName},ExpTrack,ExpTotal,0]}
/declare ExpChange int local 0
| If nothing has changed: miscall, leave.
/if (${PastExp}==${CurrentExp}) /return
/if (${PastExp}>${CurrentExp}) {
/varcalc ExpChange ${PastExp}-${CurrentExp}
} else {
/varcalc ExpChange (${PastExp}+100)-${CurrentExp}
}
/varcalc ExpTotal ${ExpTotal}-${ExpChange}
/varcalc ExpCount ${ExpCount} + 1
/if (${Ini[${IniFileName},Settings,Echo,0]}) {
/echo Ouch, You have lost ${ExpChange}% experience because of death.
/echo Total Exp Changes: ${ExpCount}, Total Exp Gained: ${ExpTotal}, Average per change: ${Math.Calc[${ExpTotal}/${ExpCount}]}% Exp
}
/ini "${IniFileName}" "ExpTrack" "PastExp" ${CurrentExp}
/ini "${IniFileName}" "ExpTrack" "ExpCount" ${ExpCount}
/ini "${IniFileName}" "ExpTrack" "ExpTotal" ${ExpTotal}
/return
Where's it already in there?aChallenged1 wrote:Thanks Drumstix, that looks close to what I found in my UI that showed percent with decimal to 2 places.
Edit: that is already in there. Must be something within the math that needs to be changed. I'm starting to see how things work a little at a time, but honestly the math sections always drive me out of my skull.

| This sub is just all math logic for calc'ing EXP gains. Gains, not loses.
| Thanks to Lax's new ${} phrasing this is done with ONE loop! Rock on your bad self Lax!
/declare Past int local
/declare Current int local ${Me.PctExp} // <==This line here!
/declare Count int local
/declare Total int local
/declare Change int local 0
/declare ExpType string local Exp

Code: Select all
character (inherits spawn)
Members
int ID Spawn ID
string Name First name
int Level Level
int Exp Experience (of 330)
float PctExp Experience as a %
Code: Select all
/declare Current float local ${Me.PctExp}
