balliztik1 Posted June 12, 2007 Author Share Posted June 12, 2007 I wanted to make something on the server that would allow me to see what timers were running, and allow me to remove and add them from outside the client, so I made a ListBox within the server that allows me to do that.Here's how I have it set up.![](http://www.freemmorpgmaker.com/Hosting/balliztik/frmserver.GIF)I added a new tab to the server. Change the _Tabs_ and _TabsPerRow_ properties of _frmServer_ to 5 each, and you can change the caption of the new tab to suit you (I used "Timers").Now, on this new tab, add the _ListBox_, two _TextBox_es, and the _Command Button_ shown above, making sure you use the names provided.View the code of _frmServer_ and add these subs in.```Private Sub cmdTimerAdd_Click()Call AddNewTimer(txtTmrName.text, Int(txtTmrInt.text))End SubPrivate Sub lstTimers_DblClick() Call GetRidOfTimer(lstTimers.List(lstTimers.ListIndex)) lstTimers.RemoveItem lstTimers.ListIndexEnd SubPrivate Sub txtTmrInt_Click()If txtTmrInt.text = "Interval" ThentxtTmrInt.text = ""End IfEnd SubPrivate Sub txtTmrName_Click()If txtTmrName.text = "Timer Name" ThentxtTmrName.text = ""End IfEnd Sub```Finally, open up _modGameLogic_ and find the subs _AddNewTimer_ and _GetRidOfTimer_. Replace them with these modified subs.```Sub AddNewTimer(ByVal Name As String, ByVal Interval As Long)On Error Resume Next Dim TmpTimer As clsCTimers Set TmpTimer = New clsCTimers TmpTimer.Name = Name TmpTimer.Interval = Interval TmpTimer.tmrWait = GetTickCount + Interval CTimers.add TmpTimer, Name frmServer.lstTimers.AddItem Name If Err.number > 0 Then Debug.Print "Err: " & Err.number CTimers.item(Name).Name = Name CTimers.item(Name).Interval = Interval CTimers.item(Name).tmrWait = GetTickCount + Interval Err.Clear End IfEnd SubSub GetRidOfTimer(ByVal Name As String) Call CTimers.Remove(Name)End Sub```And there you have it. When you run a timer, it will show up on the list now. Double clicking the timer name will remove the timer (I added this just in case a timer is being troublesome), and you can add a timer yourself by filling in the two fields and clicking the Add Timer button.Enjoy. :-) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now