Mouselocker - Prevents mouse from going out of game window

Mouselocker - Prevents mouse from going out of game window

Postby polite » Mon Jun 07, 2010 6:26 pm

I just made easy to use mouse locker, which locks your mouse in selected window.

My inspiration to write this program: I was in middle of fight when I clicked out of game window, as a result of this game window went behind other window and when I switched back to game window i was almost dead.

Usages
* Lock mouse in selected window and keep it active.
- Can be used with windowed games to avoid accidents that happen if you click out of window and as a result window goes behind other window.

Features
*Lock/unlock mouse in selected window
*Prevets selected window from going background
*Dynamic key combination binding
*Tutorials for beginners
v1.1
*Locks mouse in client area

Bugs/ToDo
*Post please

v1.0
Code: Select all
#include <Misc.au3>
#include <GuiComboBox.au3>
#include <Array.au3>

Global $ini = @ScriptDir & "\mouselock.ini"
Global $KeyList = "Left mouse button|Right mouse button|Middle mouse button (three-button mouse)|Windows 2000/XP: X1 mouse button|Windows 2000/XP: X2 mouse button|BACKSPACE |TAB |CLEAR |ENTER |SHIFT |CTRL |ALT |PAUSE |CAPS LOCK |ESC |SPACEBAR|PAGE UP |PAGE DOWN |END |HOME |LEFT ARROW |UP ARROW |RIGHT ARROW |DOWN ARROW |SELECT |PRINT |EXECUTE |PRINT SCREEN |INS |DEL |0 |1 |2 |3 |4 |5 |6 |7 |8 |9 |A |B |C |D |E |F |G |H |I |J |K |L |M |N |O |P |Q |R |S |T |U |V |W |X |Y |Z |Left Windows |Right Windows |Numeric pad 0 |Numeric pad 1 |Numeric pad 2 |Numeric pad 3 |Numeric pad 4 |Numeric pad 5 |Numeric pad 6 |Numeric pad 7 |Numeric pad 8 |Numeric pad 9 |Multiply |Add |Separator |Subtract |Decimal |Divide |F1 |F2 |F3 |F4 |F5 |F6 |F7 |F8 |F9 |F10 |F11 |F12 |F13 |F14|F15|F16|F17 |F18|F19|F20|F21|F22|F23|F24|NUM LOCK |SCROLL LOCK |Left SHIFT |Right SHIFT |Left CONTROL |Right CONTROL |Left MENU |Right MENU |;|=|,|-|.|/|`|["
Global $KeylistSplitted = StringSplit($KeyList, "|")
Global $KeyListSplitedMatchList = StringSplit("01|02|04|05|06|08|09|0C|0D|10|11|12|13|14|1B|20|21|22|23|24|25|26|27|28|29|2A|2B|2C|2D|2E|30|31|32|33|34|35|36|37|38|39|41|42|43|44|45|46|47|48|49|4A|4B|4C|4D|4E|4F|50|51|52|53|54|55|56|57|58|59|5A|5B|5C|60|61|62|63|64|65|66|67|68|69|6A|6B|6C|6D|6E|6F|70|71|72|73|74|75|76|77|78|79|7A|7B|7C|7D|7E|7F|80|81|82|83|84|85|86|87|90|91|A0|A1|A2|A3|A4|A5|BA|BB|BC|BD|BE|BF|C0|DB|DC|DD|", "|")


While Not FileExists($ini)
   CreateConf()
WEnd

$Key1Code = IniRead($ini, "MouseLocker", "KEY1", "A2")
$Key2Code = IniRead($ini, "MouseLocker", "KEY2", "11")
$DisplaTutorial = IniRead($ini, "MouseLocker", "Tutorial", "False")

$Key1String = $KeylistSplitted[ArrayFind($KeyListSplitedMatchList, $Key1Code)]
$Key2String = $KeylistSplitted[ArrayFind($KeyListSplitedMatchList, $Key2Code)]

Func ArrayFind($Array, $Val)
   For $i = 1 To $Array[0]
      If $Array[$i] = $Val Then Return $i
   Next
EndFunc   ;==>ArrayFind

Func CreateConf()

   MsgBox(64, "Configuration not found", "Configuration not found, click OK to create.")
   $hGui = GUICreate("Mouselocker configuration", 320, 180)
   $TutorialCheck = GUICtrlCreateCheckbox("Display tutorials", 5, 10)
   GUICtrlCreateLabel("Please select key combination.", 5, 35)
   GUICtrlCreateLabel("Key 1:", 5, 55)
   $Key1 = _GUICtrlComboBox_Create($hGui, $KeyList, 40, 55, 250)
   _GUICtrlComboBox_SetCurSel($Key1, 112)
   GUICtrlCreateLabel("Key 2:", 5, 85)
   $Key2 = _GUICtrlComboBox_Create($hGui, $KeyList, 40, 85, 250)
   _GUICtrlComboBox_SetCurSel($Key2, 11)
   $Save = GUICtrlCreateButton("Save", 10, 125, 75)
   $Cancel = GUICtrlCreateButton("Discard", 95, 125, 75)
   GUICtrlCreateLabel("If you want reconfigure this program later, delete mouselock.ini", 5, 155)
   GUISetState()

   While 1
      $nMsg = GUIGetMsg()
      Switch $nMsg
         Case -3
            Exit
         Case $Cancel
            Return
            GUIDelete()
         Case $Save
            $VK_KEY1 = $KeyListSplitedMatchList[_GUICtrlComboBox_GetCurSel($Key1) + 1]
            $VK_KEY2 = $KeyListSplitedMatchList[_GUICtrlComboBox_GetCurSel($Key2) + 1]
            $IsChecked = GUICtrlRead($TutorialCheck)
            IniWrite($ini, "MouseLocker", "KEY1", $VK_KEY1)
            IniWrite($ini, "MouseLocker", "KEY2", $VK_KEY2)
            If $IsChecked = 1 Then
               IniWrite($ini, "MouseLocker", "Tutorial", "True")
            Else
               IniWrite($ini, "MouseLocker", "Tutorial", "False")
            EndIf
            MsgBox(0, "Done", "Configuration file created in: " & @ScriptDir & "\mouselock.ini")
            GUIDelete()
            Return
      EndSwitch
   WEnd

EndFunc   ;==>CreateConf

Func DisplayTutorial($sTitle, $sText, $iW, $iH)
   If $DisplaTutorial = "True" Then
      $hGui = GUICreate($sTitle, $iW, $iH + 35)
      GUICtrlCreateLabel($sText, 10, 10, $iW - 20, $iH)
      $NoTutorial = GUICtrlCreateButton("Do not show tutorials anymore", 10, $iH + 5, 170)
      $Continue = GUICtrlCreateButton("Continue >>", 180, $iH + 5, 75)
      GUISetState()

      While 1
         $nMsg = GUIGetMsg()
         Switch $nMsg
            Case -3
               Exit
            Case $Continue
               GUIDelete()
               Return
            Case $NoTutorial
               GUIDelete()
               IniWrite($ini, "MouseLocker", "Tutorial", "False")
               $DisplaTutorial = "False"
               Return
         EndSwitch
      WEnd
   EndIf
   Return
EndFunc   ;==>DisplayTutorial

While 1
   DisplayTutorial("Select window", "Select window in where you want to lock your mouse" & @CRLF & "After that press " & $Key1String & " + " & $Key2String & "to lock mouse in selected window", 450, 70)
   WinWaitSelected()
WEnd

Func WinWaitSelected()
   Sleep(250);Prevent bugs

   $dll = DllOpen("user32.dll")

   While 1
      Sleep(10)
      If _IsPressed($Key1Code, $dll) And _IsPressed($Key2Code, $dll) Then
         $Title = WinGetTitle("[Active]")
         DisplayTutorial("Selected: " & $Title, "To allow your mouse leave from selected window, press " & $Key1String & " + " & $Key2String, 450, 70)
         If MouseLock($Title) = False Then MsgBox(16, "Error", "Window lost")
         ExitLoop
      EndIf
   WEnd
   DllClose($dll)

EndFunc   ;==>WinWaitSelected

Func MouseLock($Title)
   $xywh = WinGetPos($Title)
   ConsoleWriteLine("Mouse Locked in window: " & $Title)
   $Lock = True
   $dll = DllOpen("user32.dll")
   If $DisplaTutorial = "true" Then
      SplashTextOn("Selected: " & $Title, "To allow your mouse leave from selected window, press " & $Key1String & " + " & $Key2String, 450, 70, 0, 0)
   EndIf
   Sleep(250);In order not to let _IsPressed capture keystoke used to lock mouse
   ;If you remove this sleep, mouse will unlocked instantly
   While $Lock = True
      If Not WinExists($Title) Then Return False
      $xy = MouseGetPos()
      If $xy[0] < $xywh[0] Then MouseMove($xywh[0], $xy[1], 0)
      If $xy[0] > $xywh[0] + $xywh[2] Then MouseMove($xywh[0] + $xywh[2], $xy[1], 0)
      If $xy[1] < $xywh[1] Then MouseMove($xy[0], $xywh[1], 0)
      If $xy[1] > $xywh[1] + $xywh[3] Then MouseMove($xy[0], $xywh[1] + $xywh[3], 0)
      If Not WinActive($Title) Then WinActivate($Title)
      If _IsPressed($Key1Code, $dll) And _IsPressed($Key2Code, $dll) Then
         ConsoleWriteLine("Deactivated (" & $Key1Code & ";" & $Key2Code & ")")
         If $DisplaTutorial = "true" Then
            SplashOff()
         EndIf
         DisplayTutorial("Unselected", "You can now freely move your mouse again", 450, 70)
         $Lock = False
         Return True
      EndIf
      Sleep(10)
   WEnd
   DllClose($dll)
EndFunc   ;==>MouseLock

Func ConsoleWriteLine($sData)
   ConsoleWrite($sData & @CRLF)
EndFunc   ;==>ConsoleWriteLine


Download
http://autoit.pri.ee/downloads/mouseholder.exe

If you want to donate me at D2Jsp : http://forums.d2jsp.org/user.php?i=345348

v 1.1
Code: Select all
#include <Misc.au3>
#include <GuiComboBox.au3>
#include <Array.au3>
#include <WinAPI.au3>


Global $ini = @ScriptDir & "\mouselock.ini"
Global $KeyList = "Left mouse button|Right mouse button|Middle mouse button (three-button mouse)|Windows 2000/XP: X1 mouse button|Windows 2000/XP: X2 mouse button|BACKSPACE |TAB |CLEAR |ENTER |SHIFT |CTRL |ALT |PAUSE |CAPS LOCK |ESC |SPACEBAR|PAGE UP |PAGE DOWN |END |HOME |LEFT ARROW |UP ARROW |RIGHT ARROW |DOWN ARROW |SELECT |PRINT |EXECUTE |PRINT SCREEN |INS |DEL |0 |1 |2 |3 |4 |5 |6 |7 |8 |9 |A |B |C |D |E |F |G |H |I |J |K |L |M |N |O |P |Q |R |S |T |U |V |W |X |Y |Z |Left Windows |Right Windows |Numeric pad 0 |Numeric pad 1 |Numeric pad 2 |Numeric pad 3 |Numeric pad 4 |Numeric pad 5 |Numeric pad 6 |Numeric pad 7 |Numeric pad 8 |Numeric pad 9 |Multiply |Add |Separator |Subtract |Decimal |Divide |F1 |F2 |F3 |F4 |F5 |F6 |F7 |F8 |F9 |F10 |F11 |F12 |F13 |F14|F15|F16|F17 |F18|F19|F20|F21|F22|F23|F24|NUM LOCK |SCROLL LOCK |Left SHIFT |Right SHIFT |Left CONTROL |Right CONTROL |Left MENU |Right MENU |;|=|,|-|.|/|`|["
Global $KeylistSplitted = StringSplit($KeyList, "|")
Global $KeyListSplitedMatchList = StringSplit("01|02|04|05|06|08|09|0C|0D|10|11|12|13|14|1B|20|21|22|23|24|25|26|27|28|29|2A|2B|2C|2D|2E|30|31|32|33|34|35|36|37|38|39|41|42|43|44|45|46|47|48|49|4A|4B|4C|4D|4E|4F|50|51|52|53|54|55|56|57|58|59|5A|5B|5C|60|61|62|63|64|65|66|67|68|69|6A|6B|6C|6D|6E|6F|70|71|72|73|74|75|76|77|78|79|7A|7B|7C|7D|7E|7F|80|81|82|83|84|85|86|87|90|91|A0|A1|A2|A3|A4|A5|BA|BB|BC|BD|BE|BF|C0|DB|DC|DD|", "|")


While Not FileExists($ini)
   CreateConf()
WEnd

$Key1Code = IniRead($ini, "MouseLocker", "KEY1", "A2")
$Key2Code = IniRead($ini, "MouseLocker", "KEY2", "11")
$DisplaTutorial = IniRead($ini, "MouseLocker", "Tutorial", "False")

$Key1String = $KeylistSplitted[ArrayFind($KeyListSplitedMatchList, $Key1Code)]
$Key2String = $KeylistSplitted[ArrayFind($KeyListSplitedMatchList, $Key2Code)]

Func ArrayFind($Array, $Val)
   For $i = 1 To $Array[0]
      If $Array[$i] = $Val Then Return $i
   Next
EndFunc   ;==>ArrayFind

Func CreateConf()

   MsgBox(64, "Configuration not found", "Configuration not found, click OK to create.")
   $hGui = GUICreate("Mouselocker configuration", 320, 180)
   $TutorialCheck = GUICtrlCreateCheckbox("Display tutorials", 5, 10)
   GUICtrlCreateLabel("Please select key combination.", 5, 35)
   GUICtrlCreateLabel("Key 1:", 5, 55)
   $Key1 = _GUICtrlComboBox_Create($hGui, $KeyList, 40, 55, 250)
   _GUICtrlComboBox_SetCurSel($Key1, 112)
   GUICtrlCreateLabel("Key 2:", 5, 85)
   $Key2 = _GUICtrlComboBox_Create($hGui, $KeyList, 40, 85, 250)
   _GUICtrlComboBox_SetCurSel($Key2, 11)
   $Save = GUICtrlCreateButton("Save", 10, 125, 75)
   $Cancel = GUICtrlCreateButton("Discard", 95, 125, 75)
   GUICtrlCreateLabel("If you want reconfigure this program later, delete mouselock.ini", 5, 155)
   GUISetState()

   While 1
      $nMsg = GUIGetMsg()
      Switch $nMsg
         Case -3
            Exit
         Case $Cancel
            Return
            GUIDelete()
         Case $Save
            $VK_KEY1 = $KeyListSplitedMatchList[_GUICtrlComboBox_GetCurSel($Key1) + 1]
            $VK_KEY2 = $KeyListSplitedMatchList[_GUICtrlComboBox_GetCurSel($Key2) + 1]
            $IsChecked = GUICtrlRead($TutorialCheck)
            IniWrite($ini, "MouseLocker", "KEY1", $VK_KEY1)
            IniWrite($ini, "MouseLocker", "KEY2", $VK_KEY2)
            If $IsChecked = 1 Then
               IniWrite($ini, "MouseLocker", "Tutorial", "True")
            Else
               IniWrite($ini, "MouseLocker", "Tutorial", "False")
            EndIf
            MsgBox(0, "Done", "Configuration file created in: " & @ScriptDir & "\mouselock.ini")
            GUIDelete()
            Return
      EndSwitch
   WEnd

EndFunc   ;==>CreateConf

Func DisplayTutorial($sTitle, $sText, $iW, $iH)
   If $DisplaTutorial = "True" Then
      $hGui = GUICreate($sTitle, $iW, $iH + 35)
      GUICtrlCreateLabel($sText, 10, 10, $iW - 20, $iH)
      $NoTutorial = GUICtrlCreateButton("Do not show tutorials anymore", 10, $iH + 5, 170)
      $Continue = GUICtrlCreateButton("Continue >>", 180, $iH + 5, 75)
      GUISetState()

      While 1
         $nMsg = GUIGetMsg()
         Switch $nMsg
            Case -3
               Exit
            Case $Continue
               GUIDelete()
               Return
            Case $NoTutorial
               GUIDelete()
               IniWrite($ini, "MouseLocker", "Tutorial", "False")
               $DisplaTutorial = "False"
               Return
         EndSwitch
      WEnd
   EndIf
   Return
EndFunc   ;==>DisplayTutorial

While 1
   DisplayTutorial("Select window", "Select window in where you want to lock your mouse" & @CRLF & "After that press " & $Key1String & " + " & $Key2String & "to lock mouse in selected window", 450, 70)
   WinWaitSelected()
WEnd

Func WinWaitSelected()
   Sleep(250);Prevent bugs

   $dll = DllOpen("user32.dll")

   While 1
      Sleep(10)
      If _IsPressed($Key1Code, $dll) And _IsPressed($Key2Code, $dll) Then
         $Title = WinGetTitle("[Active]")
         DisplayTutorial("Selected: " & $Title, "To allow your mouse leave from selected window, press " & $Key1String & " + " & $Key2String, 450, 70)
         If MouseLock($Title) = False Then MsgBox(16, "Error", "Window lost")
         ExitLoop
      EndIf
   WEnd
   DllClose($dll)

EndFunc   ;==>WinWaitSelected

Func MouseLock($Title)
   $xywh = WinGetPos($Title)
   ConsoleWriteLine("Mouse Locked in window: " & $Title)
   $Lock = True
   $dll = DllOpen("user32.dll")
   If $DisplaTutorial = "true" Then
      SplashTextOn("Selected: " & $Title, "To allow your mouse leave from selected window, press " & $Key1String & " + " & $Key2String, 450, 70, 0, 0)
   EndIf
   $Client = WinGetClientSize($Title)
   $ClientWidth = $Client[0]
   $ClientHeight = $Client[1]
   $WindowBorderWidth = ($xywh[2] - $ClientWidth) / 2
   $WindowTilebarHeight= ($xywh[3] - $WindowBorderWidth) - $ClientHeight
   Sleep(250);In order not to let _IsPressed capture keystoke used to lock mouse
   ;If you remove this sleep, mouse will unlocked instantly
   While $Lock = True
      If Not WinExists($Title) Then Return False
      $xy = MouseGetPos()
      If $xy[0] < $xywh[0] + $WindowBorderWidth Then MouseMove($xywh[0] + $WindowBorderWidth, $xy[1], 0);left
      If $xy[0] > $xywh[0] + $xywh[2] - $WindowBorderWidth -1 Then MouseMove($xywh[0] + $xywh[2] - $WindowBorderWidth -1, $xy[1], 0);right
      If $xy[1] < $xywh[1] + $WindowTilebarHeight Then MouseMove($xy[0], $xywh[1] + $WindowTilebarHeight, 0);top
      If $xy[1] > $xywh[1] + $xywh[3] - $WindowBorderWidth -1 Then MouseMove($xy[0], $xywh[1] + $xywh[3] - $WindowBorderWidth -1, 0);bottom
      If Not WinActive($Title) Then WinActivate($Title)
      If _IsPressed($Key1Code, $dll) And _IsPressed($Key2Code, $dll) Then
         ConsoleWriteLine("Deactivated (" & $Key1Code & ";" & $Key2Code & ")")
         If $DisplaTutorial = "true" Then
            SplashOff()
         EndIf
         DisplayTutorial("Unselected", "You can now freely move your mouse again", 450, 70)
         $Lock = False
         Return True
      EndIf
      Sleep(10)
   WEnd
   DllClose($dll)
EndFunc   ;==>MouseLock

Func ConsoleWriteLine($sData)
   ConsoleWrite($sData & @CRLF)
EndFunc   ;==>ConsoleWriteLine
Last edited by polite on Sun Jun 13, 2010 11:15 am, edited 1 time in total.
Genius over there is trying to call the telephone repairman because the phones don't work.
If I helped you feel free to increase my karma.
Image
User avatar
polite
 
Posts: 997
Joined: Thu Aug 14, 2008 9:17 am
Location: Estonia
Karma: 65

Re: Mouselocker - Prevents mouse from going out of game window

Postby CTS » Thu Jun 10, 2010 3:01 am

nice
I found a few things you might want to fix up
check window's position in case it moved
also check if the window has been closed ;)

I have thought of this method before, but
I'd still like to know how other more advance ones are able to
completely change the mouse's bounds and restrictions
surely it's some window dll call, but I haven't ran across anything
about it yet... : (

Another thing I'd also love to know is how they
are able to do the one deal where you can drag a
cursor over a window and it will know which window
you're hovering above
Image
You take and you learn, give and teach back.
For we will give and teach what we have taken and learned.
- CTS_AE -
User avatar
CTS
Global Moderator
Global Moderator
 
Posts: 2368
Joined: Sat Aug 02, 2008 8:25 am
Location: USA West Side! OR, Central
Karma: 99

Re: Mouselocker - Prevents mouse from going out of game window

Postby polite » Thu Jun 10, 2010 1:17 pm

check window's position in case it moved

You can't move while you are trapped in window.

To move window just press ctrl +alt again(to unlock mouse), move window, and press Ctrl + Alt again (to lock mouse in window's position).

also check if the window has been closed ;)

If I were you I would read the source before posting that.

Just copied part from source for you :)
Code: Select all
If Not WinExists($Title) Then Return False
Genius over there is trying to call the telephone repairman because the phones don't work.
If I helped you feel free to increase my karma.
Image
User avatar
polite
 
Posts: 997
Joined: Thu Aug 14, 2008 9:17 am
Location: Estonia
Karma: 65

Re: Mouselocker - Prevents mouse from going out of game window

Postby CTS » Thu Jun 10, 2010 11:55 pm

If you're checking by title or exe name,
the issue is that I surely used notepad, but if I have two opened then I have issues that it doesn't recognize the correct closing window, because it waits for both to be closed.
If you can grab it's process ID that would be a more reliable method to check by.

I did read your source but then I fizzled out through it and stopped :P

But I was just stating some issues

And you trap the mouse in the window's bounds not the active area's bounds,
thus you can move the title bar of the window, which then the program doesn't get the new window's location's bounds
I wouldn't imagine someone bounding their mouse to a window that would be moving around, but it is something that does happen which is slightly problematic, but maybe it helps on performance that you're not checking the window location every loop?
Image
You take and you learn, give and teach back.
For we will give and teach what we have taken and learned.
- CTS_AE -
User avatar
CTS
Global Moderator
Global Moderator
 
Posts: 2368
Joined: Sat Aug 02, 2008 8:25 am
Location: USA West Side! OR, Central
Karma: 99

Re: Mouselocker - Prevents mouse from going out of game window

Postby polite » Fri Jun 11, 2010 8:33 am

Let me see if I can lock mouse to client area....
Genius over there is trying to call the telephone repairman because the phones don't work.
If I helped you feel free to increase my karma.
Image
User avatar
polite
 
Posts: 997
Joined: Thu Aug 14, 2008 9:17 am
Location: Estonia
Karma: 65

Re: Mouselocker - Prevents mouse from going out of game window

Postby murder567 » Fri Jun 11, 2010 6:47 pm

You could use the _MouseTrap UDF that comes with au3 :P
#include <Misc.au3> and your good :P
It locks mouse in between coords. You could probly look for that source if u wanted to make urs more pro
Beta 3 Pickit Editor viewtopic.php?f=153&t=16898
Image
User avatar
murder567
 
Posts: 879
Joined: Sun Oct 12, 2008 2:37 pm
Location: Massachusetts, USA
Karma: 38

Re: Mouselocker - Prevents mouse from going out of game window

Postby polite » Sun Jun 13, 2010 9:56 am

I don't understand how can this make my script more pro?

Updated source only - v 1.1 locks mouse in window's client area.
Genius over there is trying to call the telephone repairman because the phones don't work.
If I helped you feel free to increase my karma.
Image
User avatar
polite
 
Posts: 997
Joined: Thu Aug 14, 2008 9:17 am
Location: Estonia
Karma: 65

Re: Mouselocker - Prevents mouse from going out of game window

Postby Jaenster » Sun Jun 27, 2010 2:25 pm

its just mousetrap with an hotkeyset in it.
It isn't that hard program

But it is handy :)
Dont want to get banned? Dont bot.
Stay out the kitchen when you can't handle the heat
User avatar
Jaenster
Donor
 
Posts: 159
Joined: Thu Nov 26, 2009 5:24 pm
Karma: 5

Re: Mouselocker - Prevents mouse from going out of game window

Postby polite » Sun Jul 04, 2010 7:23 pm

Jaenster wrote:its just mousetrap with an hotkeyset in it.
It isn't that hard program

But it is handy :)

True. I coded my own way to trap mouse and then I found that autoit has udf func for it :P. plus it keeps window active.
Genius over there is trying to call the telephone repairman because the phones don't work.
If I helped you feel free to increase my karma.
Image
User avatar
polite
 
Posts: 997
Joined: Thu Aug 14, 2008 9:17 am
Location: Estonia
Karma: 65


Return to Tools

Who is online

Users browsing this forum: No registered users and 1 guest