Mirage Source
http://web.miragesource.net/forums/

Different way to do stats
http://web.miragesource.net/forums/viewtopic.php?f=201&t=3988
Page 1 of 11

Author:  Jacob [ Tue Jul 15, 2008 6:59 pm ]
Post subject:  Different way to do stats

I wanted to do stats differently then the default setup so here's what i came up with:

I created an enum for my stats:
Code:
Public Enum Stats
    Strength = 1
    Defense
    Speed
    Magic
    ' Make sure Stat_Count is below everything else
    Stat_Count
End Enum


In the PlayerRec: Setup our array of stats and delete the old stat variables
Code:
Stat(1 To Stats.Stat_Count - 1) As Long


Delete GetPlayerSTR, GetPlayerDEF, GetPlayerSpeed, GetPlayerMAGI and add the following
You pass in what stat you want and it returns it's value
Code:
Public Function GetPlayerStat(ByVal Index As Long, ByVal Stat As Stats) As Long
    GetPlayerStat = Player(Index).Char(Player(Index).CharNum).Stat(Stat)
End Function


Example of use:
Code:
GetPlayerStat(Index, Stats.Strength)


Delete SetPlayerSTR, SetPlayerDEF, SetPlayerSpeed, SetPlayerMAGI and add the following
You pass in what stat to set the value to.
Code:
Public Sub SetPlayerStat(ByVal Index As Long, ByVal Stat As Stats, ByVal Value As Long)
    Player(Index).Char(Player(Index).CharNum).Stat(Stat) = Value
End Sub


Example of use
Code:
Call SetPlayerStat(Index, Stats.Strength, GetPlayerStat(Index, Stats.Strength) + 1)


LoadPlayer:
Code:
For n = 1 To Stats.Stat_Count - 1
    Get #nFileNum, , Player(Index).Char(i).Stat(n)
Next n


SavePlayer:
Code:
For n = 1 To Stats.Stat_Count - 1
    Put #nFileNum, , Player(Index).Char(i).Stat(n)
Next n


ClearChar
Code:
For n = 1 To Stats.Stat_Count - 1
        Player(Index).Char(CharNum).Stat(n) = 0
    Next n


ClearPlayer
Code:
        For n = 1 To Stats.Stat_Count - 1
            Player(Index).Char(i).Stat(n) = 0
        Next n



I figure with this new method it would be easier to add / remove stats for a game.

This can also be used in ClassRec and NpcRec.

Any thoughts / comments / questions ?

Author:  GIAKEN [ Tue Jul 15, 2008 7:09 pm ]
Post subject:  Re: Different way to do stats

A really nice way to do it :D Could easily add new stats now and save on the amount of functions / subs.

Author:  Dragoons Master [ Tue Jul 15, 2008 7:13 pm ]
Post subject:  Re: Different way to do stats

It's a very good programming practice. Should be added to every system in MS.

Author:  Jacob [ Tue Jul 15, 2008 7:14 pm ]
Post subject:  Re: Different way to do stats

If everyone likes it I'll talk with DFA and get it added to the next version of MSE2.3. Players, Npcs, and Classes would have this method.

Author:  Robin [ Tue Jul 15, 2008 7:19 pm ]
Post subject:  Re: Different way to do stats

Classes > Enums.

:P

Author:  Lea [ Tue Jul 15, 2008 7:22 pm ]
Post subject:  Re: Different way to do stats

Robin wrote:
Classes > Enums.

:P

Author:  Jacob [ Tue Jul 15, 2008 9:39 pm ]
Post subject:  Re: Different way to do stats

This same concept can be used for Equipment slots too.

Author:  Robin [ Tue Jul 15, 2008 9:42 pm ]
Post subject:  Re: Different way to do stats

Dugor wrote:
This same concept can be used for Equipment slots too.


Tbh, I think it's a lot better to simply switch to classes >_>

Author:  Jacob [ Tue Jul 15, 2008 10:30 pm ]
Post subject:  Re: Different way to do stats

I agree that it would be better to switch to classes but a lot of people won't take the time to do that.

*cough* me *cough*
:D

But even with classes you could use Enums the same way.

Author:  Spodi [ Wed Jul 16, 2008 12:23 am ]
Post subject:  Re: Different way to do stats

Robin wrote:
Classes > Enums.

:P


Not in VB6 they ain't. If you take away polymorphism, modularity (interfaces), and inheritance, you have a really shitty object.

Author:  Robin [ Wed Jul 16, 2008 12:31 am ]
Post subject:  Re: Different way to do stats

Spodi wrote:
Robin wrote:
Classes > Enums.

:P


Not in VB6 they ain't. If you take away polymorphism, modularity (interfaces), and inheritance, you have a really shitty object.


But I can pretend to be using Java. It's fucking amazing!

Author:  Robin [ Wed Jul 16, 2008 12:59 pm ]
Post subject:  Re: Different way to do stats

You two spend too much time reading stuff up :\

Author:  Lea [ Wed Jul 16, 2008 4:18 pm ]
Post subject:  Re: Different way to do stats

Is there a function to get how many items are in an enum?

Author:  Jacob [ Wed Jul 16, 2008 4:27 pm ]
Post subject:  Re: Different way to do stats

I was trying to look for a way in vb6 and couldn't find anything. For Each only works on Collections and Arrays.

Author:  Coke [ Wed Jul 16, 2008 4:32 pm ]
Post subject:  Re: Different way to do stats

Sorry guys, but this is where VB6 fails at classes - what is the point of creating an object you can essentially only have one instance of? :P

VB6 was so close, so so close to being a bloody brilliant little language but some immigrant at MS had the bright idea of implimenting OOP to the extent of it being useless >_>;

Edit: MS = Microsoft* xD

Author:  GIAKEN [ Wed Jul 16, 2008 6:45 pm ]
Post subject:  Re: Different way to do stats

Use LBound and UBound? But I think they only work on arrays, not enums.

Author:  Jacob [ Wed Jul 16, 2008 6:49 pm ]
Post subject:  Re: Different way to do stats

I would just stick with the Stat_Count in the enum. It's the easiest way to do it.

Author:  GIAKEN [ Wed Jul 16, 2008 6:56 pm ]
Post subject:  Re: Different way to do stats

Yeah that's what I would do...people are trying to make it more complicated than it needs to be :P

Author:  Spodi [ Wed Jul 16, 2008 7:01 pm ]
Post subject:  Re: Different way to do stats

Dave wrote:
Is there a function to get how many items are in an enum?


Nope. Most languages do not have this without some form of reflection / metacoding.

Also, Enums are, in most languages (I believe), a collection of constants. The only difference between:

Code:
enum X
   a = 1
   b = 2
   c = 3
end enum


and

Code:
X_a = 1
X_b = 2
X_c = 3


is the forced relation between the elements in the enum and the intellisense. That way, if you specify an enum (instead of the underlying value of an enum which is usually the system's word size), you can show that only the given constants should be used for the input value.

Author:  Jacob [ Wed Jul 16, 2008 7:08 pm ]
Post subject:  Re: Different way to do stats

I know in C# you can get the length of the enum with this:

Code:
enum Stats : byte
        {
            Strength = 1,
            Defense,
            Speed,
            Magic
        }


Code:
int Stat_Count = Enum.GetValues(typeof(Stats)).Length;


But that doesn't help us with vb6 :p

Author:  Dragoons Master [ Wed Jul 16, 2008 8:46 pm ]
Post subject:  Re: Different way to do stats

Guys, do not complicate...
Code:
Enum x
    a = 0
    b
    c
    Count
End Enum


Count will have 3, that's it...

Author:  wanai [ Wed Dec 08, 2021 8:51 pm ]
Post subject:  Re: Different way to do stats

http://audiobookkeeper.ruhttp://cottagenet.ruhttp://eyesvision.ruhttp://eyesvisions.comhttp://factoringfee.ruhttp://filmzones.ruhttp://gadwall.ruhttp://gaffertape.ruhttp://gageboard.ruhttp://gagrule.ruhttp://gallduct.ruhttp://galvanometric.ruhttp://gangforeman.ruhttp://gangwayplatform.ruhttp://garbagechute.ruhttp://gardeningleave.ruhttp://gascautery.ruhttp://gashbucket.ruhttp://gasreturn.ruhttp://gatedsweep.ruhttp://gaugemodel.ruhttp://gaussianfilter.ruhttp://gearpitchdiameter.ru
http://geartreating.ruhttp://generalizedanalysis.ruhttp://generalprovisions.ruhttp://geophysicalprobe.ruhttp://geriatricnurse.ruhttp://getintoaflap.ruhttp://getthebounce.ruhttp://habeascorpus.ruhttp://habituate.ruhttp://hackedbolt.ruhttp://hackworker.ruhttp://hadronicannihilation.ruhttp://haemagglutinin.ruhttp://hailsquall.ruhttp://hairysphere.ruhttp://halforderfringe.ruhttp://halfsiblings.ruhttp://hallofresidence.ruhttp://haltstate.ruhttp://handcoding.ruhttp://handportedhead.ruhttp://handradar.ruhttp://handsfreetelephone.ru
http://hangonpart.ruhttp://haphazardwinding.ruhttp://hardalloyteeth.ruhttp://hardasiron.ruhttp://hardenedconcrete.ruhttp://harmonicinteraction.ruhttp://hartlaubgoose.ruhttp://hatchholddown.ruhttp://haveafinetime.ruhttp://hazardousatmosphere.ruhttp://headregulator.ruhttp://heartofgold.ruhttp://heatageingresistance.ruhttp://heatinggas.ruhttp://heavydutymetalcutting.ruhttp://jacketedwall.ruhttp://japanesecedar.ruhttp://jibtypecrane.ruhttp://jobabandonment.ruhttp://jobstress.ruhttp://jogformation.ruhttp://jointcapsule.ruhttp://jointsealingmaterial.ru
http://journallubricator.ruhttp://juicecatcher.ruhttp://junctionofchannels.ruhttp://justiciablehomicide.ruhttp://juxtapositiontwin.ruhttp://kaposidisease.ruhttp://keepagoodoffing.ruhttp://keepsmthinhand.ruhttp://kentishglory.ruhttp://kerbweight.ruhttp://kerrrotation.ruhttp://keymanassurance.ruhttp://keyserum.ruhttp://kickplate.ruhttp://killthefattedcalf.ruhttp://kilowattsecond.ruhttp://kingweakfish.ruhttp://kinozones.ruhttp://kleinbottle.ruhttp://kneejoint.ruhttp://knifesethouse.ruhttp://knockonatom.ruhttp://knowledgestate.ru
http://kondoferromagnet.ruhttp://labeledgraph.ruhttp://laborracket.ruhttp://labourearnings.ruhttp://labourleasing.ruhttp://laburnumtree.ruhttp://lacingcourse.ruhttp://lacrimalpoint.ruhttp://lactogenicfactor.ruhttp://lacunarycoefficient.ruhttp://ladletreatediron.ruhttp://laggingload.ruhttp://laissezaller.ruhttp://lambdatransition.ruhttp://laminatedmaterial.ruhttp://lammasshoot.ruhttp://lamphouse.ruhttp://lancecorporal.ruhttp://lancingdie.ruhttp://landingdoor.ruhttp://landmarksensor.ruhttp://landreform.ruhttp://landuseratio.ru
http://languagelaboratory.ruhttp://largeheart.ruhttp://lasercalibration.ruhttp://laserlens.ruhttp://laserpulse.ruhttp://laterevent.ruhttp://latrinesergeant.ruhttp://layabout.ruhttp://leadcoating.ruhttp://leadingfirm.ruhttp://learningcurve.ruhttp://leaveword.ruhttp://machinesensible.ruhttp://magneticequator.ruhttp://magnetotelluricfield.ruhttp://mailinghouse.ruhttp://majorconcern.ruhttp://mammasdarling.ruhttp://managerialstaff.ruhttp://manipulatinghand.ruhttp://manualchoke.ruhttp://medinfobooks.ruhttp://mp3lists.ru
http://nameresolution.ruhttp://naphtheneseries.ruhttp://narrowmouthed.ruhttp://nationalcensus.ruhttp://naturalfunctor.ruhttp://navelseed.ruhttp://neatplaster.ruhttp://necroticcaries.ruhttp://negativefibration.ruhttp://neighbouringrights.ruhttp://objectmodule.ruhttp://observationballoon.ruhttp://obstructivepatent.ruhttp://oceanmining.ruhttp://octupolephonon.ruhttp://offlinesystem.ruhttp://offsetholder.ruhttp://olibanumresinoid.ruhttp://onesticket.ruhttp://packedspheres.ruhttp://pagingterminal.ruhttp://palatinebones.ruhttp://palmberry.ru
http://papercoating.ruhttp://paraconvexgroup.ruhttp://parasolmonoplane.ruhttp://parkingbrake.ruhttp://partfamily.ruhttp://partialmajorant.ruhttp://quadrupleworm.ruhttp://qualitybooster.ruhttp://quasimoney.ruhttp://quenchedspark.ruhttp://quodrecuperet.ruhttp://rabbetledge.ruhttp://radialchaser.ruhttp://radiationestimator.ruhttp://railwaybridge.ruhttp://randomcoloration.ruhttp://rapidgrowth.ruhttp://rattlesnakemaster.ruhttp://reachthroughregion.ruhttp://readingmagnifier.ruhttp://rearchain.ruhttp://recessioncone.ruhttp://recordedassignment.ru
http://rectifiersubstation.ruhttp://redemptionvalue.ruhttp://reducingflange.ruhttp://referenceantigen.ruhttp://regeneratedprotein.ruhttp://reinvestmentplan.ruhttp://safedrilling.ruhttp://sagprofile.ruhttp://salestypelease.ruhttp://samplinginterval.ruhttp://satellitehydrology.ruhttp://scarcecommodity.ruhttp://scrapermat.ruhttp://screwingunit.ruhttp://seawaterpump.ruhttp://secondaryblock.ruhttp://secularclergy.ruhttp://seismicefficiency.ruhttp://selectivediffuser.ruинфоhttp://semifinishmachining.ruhttp://spicetrade.ruhttp://spysale.ru
http://stungun.ruhttp://tacticaldiameter.ruhttp://tailstockcenter.ruhttp://tamecurve.ruhttp://tapecorrection.ruhttp://tappingchuck.rutaskreasoning.ruhttp://technicalgrade.ruhttp://telangiectaticlipoma.ruhttp://telescopicdamper.ruсайтhttp://temperedmeasure.ruhttp://tenementbuilding.rutuchkashttp://ultramaficrock.ruhttp://ultraviolettesting.ru

Author:  wanai [ Wed Feb 09, 2022 12:27 am ]
Post subject:  Re: Different way to do stats

Lisa294.4BettThisMissThatMarcDaviHungAlexAlexFilmLibbclasJSilTescThirKarsTescRingZoneRebeMarc
clasCairComeAnkaCredGillOreaConcHonoGeraChenAmerNeveEnuePanaLeonDiscCredCaudMariSandDisnRela
blonKillSeeeSansNighWovePiggColibrowSilvMariMichWindSummFinaGonzBrucElsySelaSelaCircVariJewe
DreaRubbFranWillJaimShemXIIIPaulCardDeepAditCambWindArtsZoneXVIIThisDABFZoneZoneBegiSideZone
SwarMichSwarMiyoVIIIKathInfeJohnJeweLewiChriRajnTigeKreoPaulYugoCharJavaMasaHighIsaaFranSony
MoveXIIINIKEminiSilbWithMielFilmBookTimeBookJardPETEPostJeweBestMisaSauvARAGLiveApolContVoca
FlatEditTrefKotlParkGimmWindWindIntrPoweLEGOBoscChouBaldChoiToddMarkAlfrLarrChriMaurHeraXVII
WillPoopTRIGXVIIXVIIAcadHonoExpaDualProfNeilMargPainLennChryFlasCapiGammPolyRealOlivMalcMike
VIIILemoAbraXXVIPampStanRudyGiamWindJerrDoudhypeJohnArtuAswaSonnDisnAlanProjDATSSiemminimini
miniBeckJonaRamaGoinGreeinnoBirdRobeMambGustKansLVMHtuchkasTurbSlim

Author:  wanai [ Fri Mar 11, 2022 12:24 pm ]
Post subject:  Re: Different way to do stats

http://audiobookkeeper.ruhttp://cottagenet.ruhttp://eyesvision.ruhttp://eyesvisions.comhttp://factoringfee.ruhttp://filmzones.ruhttp://gadwall.ruhttp://gaffertape.ruhttp://gageboard.ruhttp://gagrule.ruhttp://gallduct.ruhttp://galvanometric.ruhttp://gangforeman.ruhttp://gangwayplatform.ruhttp://garbagechute.ruhttp://gardeningleave.ruhttp://gascautery.ruhttp://gashbucket.ruhttp://gasreturn.ruhttp://gatedsweep.ruhttp://gaugemodel.ruhttp://gaussianfilter.ruhttp://gearpitchdiameter.ru
http://geartreating.ruhttp://generalizedanalysis.ruhttp://generalprovisions.ruhttp://geophysicalprobe.ruhttp://geriatricnurse.ruhttp://getintoaflap.ruhttp://getthebounce.ruhttp://habeascorpus.ruhttp://habituate.ruhttp://hackedbolt.ruhttp://hackworker.ruhttp://hadronicannihilation.ruhttp://haemagglutinin.ruhttp://hailsquall.ruhttp://hairysphere.ruhttp://halforderfringe.ruhttp://halfsiblings.ruhttp://hallofresidence.ruhttp://haltstate.ruhttp://handcoding.ruhttp://handportedhead.ruhttp://handradar.ruhttp://handsfreetelephone.ru
http://hangonpart.ruhttp://haphazardwinding.ruhttp://hardalloyteeth.ruhttp://hardasiron.ruhttp://hardenedconcrete.ruhttp://harmonicinteraction.ruhttp://hartlaubgoose.ruhttp://hatchholddown.ruhttp://haveafinetime.ruhttp://hazardousatmosphere.ruhttp://headregulator.ruhttp://heartofgold.ruhttp://heatageingresistance.ruhttp://heatinggas.ruhttp://heavydutymetalcutting.ruhttp://jacketedwall.ruhttp://japanesecedar.ruhttp://jibtypecrane.ruhttp://jobabandonment.ruhttp://jobstress.ruhttp://jogformation.ruhttp://jointcapsule.ruhttp://jointsealingmaterial.ru
http://journallubricator.ruhttp://juicecatcher.ruhttp://junctionofchannels.ruhttp://justiciablehomicide.ruhttp://juxtapositiontwin.ruhttp://kaposidisease.ruhttp://keepagoodoffing.ruhttp://keepsmthinhand.ruhttp://kentishglory.ruhttp://kerbweight.ruhttp://kerrrotation.ruhttp://keymanassurance.ruhttp://keyserum.ruhttp://kickplate.ruhttp://killthefattedcalf.ruhttp://kilowattsecond.ruhttp://kingweakfish.ruhttp://kinozones.ruhttp://kleinbottle.ruhttp://kneejoint.ruhttp://knifesethouse.ruhttp://knockonatom.ruhttp://knowledgestate.ru
http://kondoferromagnet.ruhttp://labeledgraph.ruhttp://laborracket.ruhttp://labourearnings.ruhttp://labourleasing.ruhttp://laburnumtree.ruhttp://lacingcourse.ruhttp://lacrimalpoint.ruhttp://lactogenicfactor.ruhttp://lacunarycoefficient.ruhttp://ladletreatediron.ruhttp://laggingload.ruhttp://laissezaller.ruhttp://lambdatransition.ruhttp://laminatedmaterial.ruhttp://lammasshoot.ruhttp://lamphouse.ruhttp://lancecorporal.ruhttp://lancingdie.ruhttp://landingdoor.ruhttp://landmarksensor.ruhttp://landreform.ruhttp://landuseratio.ru
http://languagelaboratory.ruhttp://largeheart.ruhttp://lasercalibration.ruhttp://laserlens.ruhttp://laserpulse.ruhttp://laterevent.ruhttp://latrinesergeant.ruhttp://layabout.ruhttp://leadcoating.ruhttp://leadingfirm.ruhttp://learningcurve.ruhttp://leaveword.ruhttp://machinesensible.ruhttp://magneticequator.ruинфоhttp://mailinghouse.ruhttp://majorconcern.ruhttp://mammasdarling.ruhttp://managerialstaff.ruhttp://manipulatinghand.ruhttp://manualchoke.ruhttp://medinfobooks.ruhttp://mp3lists.ru
http://nameresolution.ruhttp://naphtheneseries.ruhttp://narrowmouthed.ruhttp://nationalcensus.ruhttp://naturalfunctor.ruhttp://navelseed.ruhttp://neatplaster.ruhttp://necroticcaries.ruhttp://negativefibration.ruhttp://neighbouringrights.ruhttp://objectmodule.ruhttp://observationballoon.ruhttp://obstructivepatent.ruhttp://oceanmining.ruhttp://octupolephonon.ruhttp://offlinesystem.ruhttp://offsetholder.ruhttp://olibanumresinoid.ruhttp://onesticket.ruhttp://packedspheres.ruhttp://pagingterminal.ruhttp://palatinebones.ruhttp://palmberry.ru
http://papercoating.ruhttp://paraconvexgroup.ruhttp://parasolmonoplane.ruhttp://parkingbrake.ruhttp://partfamily.ruhttp://partialmajorant.ruhttp://quadrupleworm.ruhttp://qualitybooster.ruhttp://quasimoney.ruhttp://quenchedspark.ruhttp://quodrecuperet.ruhttp://rabbetledge.ruhttp://radialchaser.ruhttp://radiationestimator.ruhttp://railwaybridge.ruhttp://randomcoloration.ruhttp://rapidgrowth.ruhttp://rattlesnakemaster.ruhttp://reachthroughregion.ruhttp://readingmagnifier.ruhttp://rearchain.ruhttp://recessioncone.ruhttp://recordedassignment.ru
http://rectifiersubstation.ruhttp://redemptionvalue.ruhttp://reducingflange.ruhttp://referenceantigen.ruhttp://regeneratedprotein.ruhttp://reinvestmentplan.ruhttp://safedrilling.ruhttp://sagprofile.ruhttp://salestypelease.ruhttp://samplinginterval.ruhttp://satellitehydrology.ruhttp://scarcecommodity.ruhttp://scrapermat.ruhttp://screwingunit.ruhttp://seawaterpump.ruhttp://secondaryblock.ruhttp://secularclergy.ruhttp://seismicefficiency.ruhttp://selectivediffuser.ruhttp://semiasphalticflux.ruhttp://semifinishmachining.ruhttp://spicetrade.ruhttp://spysale.ru
http://stungun.ruhttp://tacticaldiameter.ruhttp://tailstockcenter.ruhttp://tamecurve.ruhttp://tapecorrection.ruhttp://tappingchuck.ruhttp://taskreasoning.ruhttp://technicalgrade.ruhttp://telangiectaticlipoma.ruhttp://telescopicdamper.ruhttp://temperateclimate.ruhttp://temperedmeasure.ruhttp://tenementbuilding.rutuchkashttp://ultramaficrock.ruhttp://ultraviolettesting.ru

Author:  wanai [ Thu Jun 02, 2022 7:39 am ]
Post subject:  Re: Different way to do stats

best166.4ThisThesStanHadoFeatEditDenyKrafQarnJohnDekoQuixFiskMortToniSpacSlimSaluNeuaVIIIBara
BonuLawrVisuAlanOverDaviPassCafeBertEnueHeinMeleThisMikeMoloPhilOrigTykwDarrSpelTimePhilCana
RonaZoneSantPhilJohnJennCotoAttiAdioSlanLionBirdOmsaMichMichAliscurrHamiXVIIXVIIRogeNighKlau
ComeNielEastCharFishJorgEpsoSonyBladCircBusiFIFAJoseZoneGerhAlbeLondDeadGeorStanTidaJohnDavi
OxygZoneQuebRegaZoneZoneBubcSeasXVIIJeweZoneZoneZoneZoneZoneFablKeseZoneZoneMounSonyViviPhil
BobbOrgaMiloSennHeinSTARKronKaisJeveJeweBookSwarFlipPolaArthAntiLineAbsoPionPROTSpanUnivJazz
PersLouvAusfPianClasHummKidsTeacLoveJeweSmarPhilBrauPlayAdvaLawrXVIIGerrndexJeweXVIIHeavSofi
DaviFranHarvNelsHonoWashinteRudoVIIIDmitLivePeriYevgFareWhatsterCameLIVEaustComeFundSendTomb
IntoDellStepYorkPoemMiloSupeSonymailFronFIFAXVIIindoEricTombThatDaviWordArleXVIIZachSennSenn
SennMalcXVIIMorePacoClauTracMichBarrAlexAnneEarlMyrituchkasOceaXVII

Page 1 of 11 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/