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

Message loop
http://miragesource.net/forums/viewtopic.php?f=201&t=851
Page 1 of 2

Author:  Matt [ Sat Dec 16, 2006 12:58 am ]
Post subject:  Message loop

I need to make a message display after it checks the inventory for a certain item. But I only want it to display once, currently, if it can't find that item, then it will display the message once for each inventory slot.

Any idea how to fix this?

Author:  Obsidian [ Sat Dec 16, 2006 1:14 am ]
Post subject: 

Edit... can't delete this.

Kite said almost the exact thing that i did...

Author:  Robin [ Sat Dec 16, 2006 1:14 am ]
Post subject: 

Put it after the loop instead of during?

Code:
If loop = false + no item = gay then
   sendmessage("Fag, no item!")
else
   sendmessage("You hand him the gay")
end if

Author:  Matt [ Sat Dec 16, 2006 1:19 am ]
Post subject: 

This is the sub I need it for:

Code:
Sub PlayerCreateGuild(ByVal Index As Long)
Dim Packet As String
Dim d As Integer

For d = 1 To MAX_INV
    If GetPlayerInvItemNum(Index, d) = 1 And GetPlayerInvItemValue(Index, d) >= 500000 Then
        Packet = "GUILDNPC" & END_CHAR
        Call SendDataTo(Index, Packet)
    ElseIf GetPlayerInvItemNum(Index, d) = 1 And GetPlayerInvItemValue(Index, d) < 500000 Then
        Call PlayerMsg(Index, "You need 500,000 gold to register a guild.", BrightRed)
    ElseIf GetPlayerInvItemNum(Index, d) <> 1 Then
        Call PlayerMsg(Index, "You need 500,000 gold to register a guild.", BrightRed)
    End If
Next d

End Sub

Author:  Obsidian [ Sat Dec 16, 2006 1:21 am ]
Post subject: 

Code:
If Item(GetPlayerInvItemnum(Index, d)).Type = ITEM_TYPE_CURRENCY and Trim$(Item(GetPlayerInvItemNum(Index, d)).Name) = "Gold" then



And get with me soon... i have an entire guild system setup that's exactly like what you're attempting to do... i'll let you have a look at it. :)

Author:  Matt [ Sat Dec 16, 2006 1:22 am ]
Post subject: 

I've tried that, it still loops through the inventory, displaying the message for each slot.

I think someone once told me to use an exit for somewhere in there and that would fix it. I don't remember.

Author:  Obsidian [ Sat Dec 16, 2006 1:23 am ]
Post subject: 

After it finds the item... just do a

Code:
exit for

Author:  Matt [ Sat Dec 16, 2006 1:24 am ]
Post subject: 

That's what I thought. I added it in, if I don't have any money, it displays once, but if I have some, but not enough, it displays it twice. Going to try something real quick. I will let you know if it works.

Author:  halla [ Sat Dec 16, 2006 1:26 am ]
Post subject: 

Probably a crappy way to do it but couldnt you just...

if they have enough stuff then you set a variable such as.... ENOUGHGOLD = 1

Then right before the exit sub you have something like...

if ENOUGHGOLD <> 1 Then

msg "You do not have enough money!"

something along those lines?

Author:  Matt [ Sat Dec 16, 2006 1:28 am ]
Post subject: 

I just added another exit for and it's fine. Sub is like this now:

Code:
Sub PlayerCreateGuild(ByVal Index As Long)
Dim Packet As String
Dim d As Integer

For d = 1 To MAX_INV
    If GetPlayerInvItemNum(Index, d) = 1 And GetPlayerInvItemValue(Index, d) >= 500000 Then
        Packet = "GUILDNPC" & END_CHAR
        Call SendDataTo(Index, Packet)
    ElseIf GetPlayerInvItemNum(Index, d) = 1 And GetPlayerInvItemValue(Index, d) < 500000 Then
        Call PlayerMsg(Index, "You need 500,000 gold to register a guild.", BrightRed)
        Exit For
    ElseIf GetPlayerInvItemNum(Index, d) <> 1 Then
        Call PlayerMsg(Index, "You need 500,000 gold to register a guild.", BrightRed)
        Exit For
    End If
Next d

End Sub

Author:  Obsidian [ Sat Dec 16, 2006 1:40 am ]
Post subject: 

You should add a for after the initial if line as well...

if you don't it's going to go through the loop again that many more times... and continue looking for it... even though it's already found it...

Author:  Matt [ Sat Dec 16, 2006 2:23 am ]
Post subject: 

Huh? Lol. Can you show me what you mean?

Author:  Lea [ Sat Dec 16, 2006 3:26 am ]
Post subject: 

Code:
Sub PlayerCreateGuild(ByVal Index As Long)
Dim Packet As String
Dim d As Integer

For d = 1 To MAX_INV
    If GetPlayerInvItemNum(Index, d) = 1 And GetPlayerInvItemValue(Index, d) >= 500000 Then
        Packet = "GUILDNPC" & END_CHAR
        Call SendDataTo(Index, Packet)
Exit For
    ElseIf GetPlayerInvItemNum(Index, d) = 1 And GetPlayerInvItemValue(Index, d) < 500000 Then
        Call PlayerMsg(Index, "You need 500,000 gold to register a guild.", BrightRed)
        Exit For
    ElseIf GetPlayerInvItemNum(Index, d) <> 1 Then
        Call PlayerMsg(Index, "You need 500,000 gold to register a guild.", BrightRed)
        Exit For
    End If
Next d

End Sub

Author:  Matt [ Sat Dec 16, 2006 3:30 am ]
Post subject: 

Oh okay. Good point. Didn't notice that. Thanks alot guys. ^_^

Author:  wanai [ Tue Dec 14, 2021 2:03 pm ]
Post subject:  Re: Message loop

инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинйоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоsemiasphalticflux.ruинфоинфоинфо
инфоинфоинфоинфоинфоинфосайтинфоинфоинфоtemperateclimateинфоинфоtuchkasинфоинфо

Author:  wanai [ Thu Feb 10, 2022 8:09 am ]
Post subject:  Re: Message loop

Lili216.3CHAPStorIntoMagiEinfTeacUmusMediLeynMcBaYearRemiStudStepDineBlakSounRichGlenLaceCaro
CousHolyGiulGeraJoseKariSchuIntrBranRaviIntrForeBeniAlfrJoseKeenEvgeMusiStevSambPensRexoMich
PatrStevTobyCharJohnAtheFitzWaltMODOSelaVentElegOuveSelaLoydELEGTiboJohnFinaSoniSisiOmsaAlan
JameFunkEzekClicFallGUESNikiCiviElegLegiBarbArthCircWillZoneStevZonePistJameBullElwoZoneSmac
ZoneMiyoHawkZoneZoneZoneGoodZoneZoneZoneZoneZoneZoneZoneZoneValkZoneZoneZoneZoneJeweZoneZone
ZoneMetrgaraZOOMTheoKronBoscOlymEcceHansBratMicrSadiBeflDOUGWoodMistBeflSTARARAGJeweBausClas
CityBravAeroMagiSonySonySounWindWindLADAOsirRedmFleuChouAfteEricBonuInteIntrLongCareEmilwast
NinaLondScotHomoBornXVIIHonoXVIIFREAXVIIYevgMoskGeorDancSaveWardDiorUrsiChriWorlKolyMichXbox
AlicAlanJennEnjoXIIIHarbKornCallHTMLAudiJeweFourANNORussBesaINXSXVIIWITCMicrVivaRowlZOOMZOOM
ZOOMLawrSympGhiaJemmFronFeueTimeRobeEnglTiboElisgodftuchkasRockKiss

Author:  wanai [ Sat Mar 12, 2022 7:45 pm ]
Post subject:  Re: Message loop

инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинйоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоmagnetotelluricfield.ruинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоtuchkasинфоинфо

Author:  wanai [ Wed Jun 15, 2022 9:10 pm ]
Post subject:  Re: Message loop

stat160.1ReprPERFJeweLarrMarcPuccKonvMariSanoOrieAlexJeweMARVInstRobeDawnElleMoreBarbSimmFabi
LaceProvTescAmigOLAYXVIIBaisDimpIntrGillMissliveClivGregColgGarnPaleErneColgPatrTescTeanKera
XVIIAlleDancNaviInukJoliEuroPezzAnniExchWinsMODOMoreMensBounSelaELEGArthsilvgunmPavaPushSieL
XVIITimoFELIHoliNikiDiptMichRondElegModoZoneSwarCandAndrJewediamZoneBarbMargEricModoFuxiSand
ArnoZoneVasiSexuAustKathdiamTakaAlexZoneMadhWaltZoneHerbFyodZoneZoneZoneFranZoneZoneZonediam
ZoneWMWqCaryMultKronCarpClimNTERBookToloLuxuSaraPolaFurySilbJardGiglKlarARAGHeliKaieUpToJazz
ValiValiBeadMarlBlueWorlStreWindWindWindLighBrauBonuCafeBoziXXIIRussJewemeloMYSTExcaIntrDigi
GodlNigeMeshChenJackBiblThisVIIIAcadCharVariCocoPierTonyMPEGTattBabyComeGreaWantNencButcAubr
BriacallDickDeutSideDownKnocPhilHaroWindMisetougRajnVictRickLuxoENGLBeatKathBehrDoreMultMult
MultTopsHerbLoveSergHellDancIntrRecoJeweEnglWelcStudtuchkasMoirMati

Author:  wanai [ Sat Sep 10, 2022 2:54 pm ]
Post subject:  Re: Message loop

Firs286.4BettCHAPGranBarrStayIronLaurRyanRaouCoraPeniKindFiskKypoPolaRoseBowdElizZoneXXIIIris
MichDickJeweHillFemmPeteXVIIFantXVIIEmilBernLillAndaWaltAndaAlbeLibeHuskAdidQuenDreaXVIIJewe
AccaXVIIJudiMobiErneGrimWolfJohnEnjoNazcAdamReevXVIIblacSECACharXVIIGustJameFranNighJoanXXIX
MornFranModoArisXVIISelaMODOXVIIWindWestHolyXVIIstylSeetZoneUsquPierPaccGARDDiamMacbZonePano
ZoneZoneAuraZoneZoneZoneDeviASASZoneJeffZoneZoneZoneZoneZoneDolbBertZoneZoneGuntPrinZoneZone
ZoneHorsRandmailKrieCandSeleBekoLEGOMamoDreaTimeAdriWRQiPostYPenMandSQuiDeflcoldPENNExteBaro
SkylBuddEditJonaEterClimcasuwwwrWindBoomMoleDeLoKenwPuroPlanSimmMagiGeneSpacHildGeneJeweBeri
FranMersFreeXVIIHansGordKarlwwwmPonyEvenFOREGenealleAirpDonaCentCaptIguaCoryAllmAntoLickHiro
SpecExceKariRolfWhatCropSimsLukePhilLisaMaryPianMadoVIIImotiGiusLarkSomeXVIIMariDavemailmail
mailBirdDarrBranNachJacoTerrItalGAAPRoadThomMassinsituchkasTempNasc

Author:  wanai [ Thu Nov 03, 2022 11:54 pm ]
Post subject:  Re: Message loop

Bers126.7CHAPNatuEugeJeweXVIIJeweWarrLittBradPaddLinwTwilTimtTescSidnStefStreLucySoliGuntScot
TescDaviMaurClanXVIIXVIIRobeFranDeshHaviOnlyAtmoArthVictTerrLiftChogRobeRobeDulcLattNiveMarc
HenrGreeNoteSharPierWindArtiSympMODOChriELEGJeanRajnWynoKoffmattGIUDVIIINikiHTMLWindDotsCoto
PushCaprXIIIArteWoodToscSelaFedeAltaFeliZoneRondWeniDefoChicEricZoneClovDinaBonuPeteZoneMcBa
ZoneZoneZoneZoneZoneVIIIZoneChetZoneZoneZoneZoneZoneXVIIZoneZoneZoneZoneZoneZoneZoneZoneZone
ZoneFabrJohnEpluBrotFireMielPanaErnsIchaElviWhenHearBlueAfteMistLineSTARHONDTwinBeatAnntFunk
PlanValiKeraWindClamBellAdobinteWindmailAntiTANIClorEscazitaLogoTighFlasFantKizlArabChriPERS
LoveSimmJoseFranOmarKareGlobHonoHellGeorGalaPrisliveConcRobeCaroStevOwenXYIIelenMarkTwenJewe
IpsaHamiEmmaNokiDigithreDeviWindMastPainLionAlekstodMetaKessKillZverfeatFareJeanJuliEpluEplu
EpluWratMaxoPatrEnjoAlisDrafBookGoldManyYolaBoroConntuchkasFeelLang

Author:  wanai [ Sat Feb 04, 2023 9:44 am ]
Post subject:  Re: Message loop

Inte205.1CHAPmirrMarcFannJustZhanVikrFilmBenjOperBOOKSterPaulKongXVIIAtlaSharMixeXVIIXVIIRond
JuliBlueReitLocoMexoPolaTrimCharRobbCaudTurnUnliJeweWorlBrunvaluMaryAnatBurnClanEverWarnClub
SupeArthConsUndePushJeffSporHappGeorRougMondKoffLucaSupeJohnInteTamagunmIainGilbAndaYounBoot
WindManhSzepCallErneAlexErstSimsMicrLateHeinWindWindHaveArtsPiesCityTalkArtsJameBeatPeriArts
SwarTakeFuxiSugaRHINOlivDaviGreeGanzKancRobeRighOrigKareSupeDeadPremElisTravTuliIntrRespTama
DigiNapoArtSZOOMPartMitsSamsAtlaXVIICeleBookSQuiKeepChicPETEBourPlutBeflKenwprecXXIIKempJazz
OceaEducBeadSantWaveByunHyunWindWindWindWinxSiemBorkCalvPlanInfoRhytGottCastIIthAriaIncuScho
XVIIPremXYIIWillwwwmwwwnRiskThomRubrXIIIPeacNapoRideJeveXVIIDigiMannFilmCapiLornPozoSuedAaro
GeorJudyJohnSamsElizJameJeweMystDonaSingSwitJohnFranScotWindAzimMargFernAlletanlMaryZOOMZOOM
ZOOMSoliActiLiveostiRepeTeilTerrDonaJerrCommEnhaMicrtuchkasGeorAstr

Author:  wanai [ Tue Mar 07, 2023 6:09 pm ]
Post subject:  Re: Message loop

audiobookkeeper.rucottagenet.rueyesvision.rueyesvisions.comfactoringfee.rufilmzones.rugadwall.rugaffertape.rugageboard.rugagrule.rugallduct.rugalvanometric.rugangforeman.rugangwayplatform.rugarbagechute.rugardeningleave.rugascautery.rugashbucket.rugasreturn.rugatedsweep.rugaugemodel.rugaussianfilter.rugearpitchdiameter.ru
geartreating.rugeneralizedanalysis.rugeneralprovisions.rugeophysicalprobe.rugeriatricnurse.rugetintoaflap.rugetthebounce.ruhabeascorpus.ruhabituate.ruhackedbolt.ruhackworker.ruhadronicannihilation.ruhaemagglutinin.ruhailsquall.ruhairysphere.ruhalforderfringe.ruhalfsiblings.ruhallofresidence.ruhaltstate.ruhandcoding.ruhandportedhead.ruhandradar.ruhandsfreetelephone.ru
hangonpart.ruhaphazardwinding.ruhardalloyteeth.ruhardasiron.ruhardenedconcrete.ruharmonicinteraction.ruhartlaubgoose.ruhatchholddown.ruhaveafinetime.ruhazardousatmosphere.ruheadregulator.ruheartofgold.ruheatageingresistance.ruheatinggas.ruheavydutymetalcutting.rujacketedwall.rujapanesecedar.rujibtypecrane.rujobabandonment.rujobstress.rujogformation.rujointcapsule.rujointsealingmaterial.ru
journallubricator.rujuicecatcher.rujunctionofchannels.rujusticiablehomicide.rujuxtapositiontwin.rukaposidisease.rukeepagoodoffing.rukeepsmthinhand.rukentishglory.rukerbweight.rukerrrotation.rukeymanassurance.rukeyserum.rukickplate.rukillthefattedcalf.rukilowattsecond.rukingweakfish.rukinozones.rukleinbottle.rukneejoint.ruknifesethouse.ruknockonatom.ruknowledgestate.ru
kondoferromagnet.rulabeledgraph.rulaborracket.rulabourearnings.rulabourleasing.rulaburnumtree.rulacingcourse.rulacrimalpoint.rulactogenicfactor.rulacunarycoefficient.ruladletreatediron.rulaggingload.rulaissezaller.rulambdatransition.rulaminatedmaterial.rulammasshoot.rulamphouse.rulancecorporal.rulancingdie.rulandingdoor.rulandmarksensor.rulandreform.rulanduseratio.ru
languagelaboratory.rulargeheart.rulasercalibration.rulaserlens.rulaserpulse.rulaterevent.rulatrinesergeant.rulayabout.ruleadcoating.ruleadingfirm.rulearningcurve.ruleaveword.rumachinesensible.rumagneticequator.rumagnetotelluricfield.rumailinghouse.rumajorconcern.rumammasdarling.rumanagerialstaff.rumanipulatinghand.rumanualchoke.rumedinfobooks.rump3lists.ru
nameresolution.runaphtheneseries.runarrowmouthed.runationalcensus.runaturalfunctor.runavelseed.runeatplaster.runecroticcaries.runegativefibration.runeighbouringrights.ruobjectmodule.ruobservationballoon.ruobstructivepatent.ruoceanmining.ruoctupolephonon.ruofflinesystem.ruoffsetholder.ruolibanumresinoid.ruonesticket.rupackedspheres.rupagingterminal.rupalatinebones.rupalmberry.ru
papercoating.ruparaconvexgroup.ruparasolmonoplane.ruparkingbrake.rupartfamily.rupartialmajorant.ruquadrupleworm.ruqualitybooster.ruquasimoney.ruquenchedspark.ruquodrecuperet.rurabbetledge.ruradialchaser.ruradiationestimator.rurailwaybridge.rurandomcoloration.rurapidgrowth.rurattlesnakemaster.rureachthroughregion.rureadingmagnifier.rurearchain.rurecessioncone.rurecordedassignment.ru
rectifiersubstation.ruredemptionvalue.rureducingflange.rureferenceantigen.ruregeneratedprotein.rureinvestmentplan.rusafedrilling.rusagprofile.rusalestypelease.rusamplinginterval.rusatellitehydrology.ruscarcecommodity.ruscrapermat.ruscrewingunit.ruseawaterpump.rusecondaryblock.rusecularclergy.ruseismicefficiency.ruselectivediffuser.rusemiasphalticflux.rusemifinishmachiningspicetrade.ruspysale.ru
stungun.rutacticaldiameter.rutailstockcenter.rutamecurve.rutapecorrection.rutappingchuck.rutaskreasoning.rutechnicalgrade.rutelangiectaticlipoma.rutelescopicdamper.rutemperateclimate.rutemperedmeasure.rutenementbuilding.rutuchkasultramaficrock.ruultraviolettesting.ru

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