Mirage Source

Free ORPG making software.
It is currently Thu Mar 28, 2024 3:14 pm

All times are UTC


Forum rules


Make sure your tutorials are kept up to date with the latest MS4 releases.



Post new topic Reply to topic  [ 1427 posts ]  Go to page 1, 2, 3, 4, 5 ... 58  Next
Author Message
 Post subject: General - AlertMessage
PostPosted: Fri Oct 30, 2009 3:14 pm 
Offline
Pro
User avatar

Joined: Tue Nov 13, 2007 2:42 pm
Posts: 509
This tutorial is a form that will allow a Yes/No or Okay button to be displayed and allow the game to continue processing while waiting on a response. I would like to thank Robin for the base form that I used to create this.

This works by passing in the memory address of a sub or function to run when the user clicks a button on the frmAlert. I use CallWindowProc to create a sort of call back function, just like the byte array packets.

Image

Adding to your project:
Download the following form and add it to your project.
http://www.deadnoggin.com/files/frmAlert.frm

This is the code for the form (just in case anyone would like to see it)
Code:
Option Explicit

Private Declare Function AlertCallBack Lib "user32" Alias "CallWindowProcA" (ByVal lpPrevWndFunc As Long, ByVal hwnd As Long, ByRef Msg As Byte, ByVal wParam As Long, ByVal lParam As Long) As Long

Public OkayOnly As Boolean
Public sMessage As String
Public YesNo As Byte
Public callBack As Long

Private Sub Form_Load()
    If OkayOnly Then
        lblOkay.Visible = True
    Else
        lblYes.Visible = True
        lblNo.Visible = True
    End If
    lblMessage.Caption = sMessage
End Sub

Private Sub lblNo_Click()
    YesNo = NO
    ProcessClick
End Sub

Private Sub lblOkay_Click()
    YesNo = OKAY
    ProcessClick
End Sub

Private Sub lblYes_Click()
    YesNo = YES
    ProcessClick
End Sub

Private Sub ProcessClick()
    ' Make sure there is something to call back to
    If callBack <> 0 Then AlertCallBack callBack, YesNo, 0, 0, 0
    Unload Me
End Sub


Add the following code to modGameLogic:
This code creates a new form for every alert message. This allows multiple AlertMessages at once.
Code:
Public Sub AlertMessage(ByVal message As String, Optional ByRef callBack As Long, Optional ByVal OkayOnly As Boolean = True)
Dim myForm As New frmAlert
   
    myForm.sMessage = message
    myForm.OkayOnly = OkayOnly
    myForm.callBack = callBack
    myForm.Show
End Sub


These consts are used by the form, so make sure you have them in your source somewhere.
Code:
Public Const NO As Byte = 0
Public Const YES As Byte = 1
Public Const OKAY As Byte = 2


How to use:
To use this alertmessage feature, you call the sub as follows:
Code:
AlertMessage "Whatever you want to appear", AddressOf sub/function to run when clicked, only display Okay or Yes/No


Example (For MR)
Code:
AlertMessage Name & " has offered to revive you. Do you accept?", AddressOf Revive_Click, False


To handle the click event:
All click events HAVE TO HAVE THESE EXACT PARAMETERS OR IT WILL NOT WORK!
Code:
Public Sub *_Click(ByVal YesNo As Long, ByRef Data As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)
     ' Check the YesNo for your value then process
End Sub


Example (For MR)
Code:
Public Sub Release_Click(ByVal YesNo As Long, ByRef Data As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)
    If YesNo = YES Then
        SendRelease
    End If
End Sub


Top
 Profile  
 
PostPosted: Wed Dec 01, 2021 9:39 am 
Offline
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 456192
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


Top
 Profile  
 
PostPosted: Sun Jan 09, 2022 4:43 pm 
Offline
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 456192
Econ


Top
 Profile  
 
PostPosted: Sun Jan 09, 2022 4:45 pm 
Offline
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 456192
127.8


Top
 Profile  
 
PostPosted: Sun Jan 09, 2022 4:46 pm 
Offline
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 456192
Bett


Top
 Profile  
 
PostPosted: Sun Jan 09, 2022 4:47 pm 
Offline
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 456192
Bett


Top
 Profile  
 
PostPosted: Sun Jan 09, 2022 4:48 pm 
Offline
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 456192
Gran


Top
 Profile  
 
PostPosted: Sun Jan 09, 2022 4:49 pm 
Offline
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 456192
Alle


Top
 Profile  
 
PostPosted: Sun Jan 09, 2022 4:50 pm 
Offline
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 456192
Jewe


Top
 Profile  
 
PostPosted: Sun Jan 09, 2022 4:51 pm 
Offline
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 456192
Marg


Top
 Profile  
 
PostPosted: Sun Jan 09, 2022 4:52 pm 
Offline
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 456192
Fran


Top
 Profile  
 
PostPosted: Sun Jan 09, 2022 4:54 pm 
Offline
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 456192
Alwa


Top
 Profile  
 
PostPosted: Sun Jan 09, 2022 4:55 pm 
Offline
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 456192
Naru


Top
 Profile  
 
PostPosted: Sun Jan 09, 2022 4:56 pm 
Offline
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 456192
Prem


Top
 Profile  
 
PostPosted: Sun Jan 09, 2022 4:57 pm 
Offline
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 456192
Deko


Top
 Profile  
 
PostPosted: Sun Jan 09, 2022 4:58 pm 
Offline
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 456192
Orie


Top
 Profile  
 
PostPosted: Sun Jan 09, 2022 4:59 pm 
Offline
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 456192
Haro


Top
 Profile  
 
PostPosted: Sun Jan 09, 2022 5:00 pm 
Offline
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 456192
sing


Top
 Profile  
 
PostPosted: Sun Jan 09, 2022 5:01 pm 
Offline
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 456192
Maki


Top
 Profile  
 
PostPosted: Sun Jan 09, 2022 5:03 pm 
Offline
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 456192
Rond


Top
 Profile  
 
PostPosted: Sun Jan 09, 2022 5:04 pm 
Offline
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 456192
Sent


Top
 Profile  
 
PostPosted: Sun Jan 09, 2022 5:05 pm 
Offline
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 456192
Blin


Top
 Profile  
 
PostPosted: Sun Jan 09, 2022 5:06 pm 
Offline
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 456192
Robe


Top
 Profile  
 
PostPosted: Sun Jan 09, 2022 5:07 pm 
Offline
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 456192
John


Top
 Profile  
 
PostPosted: Sun Jan 09, 2022 5:08 pm 
Offline
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 456192
Extr


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1427 posts ]  Go to page 1, 2, 3, 4, 5 ... 58  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 9 guests


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 post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group