
Turtlix21
Active Members-
Posts
30 -
Joined
-
Last visited
Everything posted by Turtlix21
-
TCP, UDP problem with receiving data
Turtlix21 replied to Turtlix21's topic in AutoIt General Help and Support
When server is on VM, IPs are 0.21(it's VM's IP), and it's working. When server is on PC, IPs are 0.18 (it's PC's IP), and it's not working. So everything should be good. Yeah, i know that server have to be started first -
TCP, UDP problem with receiving data
Turtlix21 replied to Turtlix21's topic in AutoIt General Help and Support
No, they haven't same IP (PC's IP: 0.18 and VM's IP: 0.21), but in both of this codes I have to set up servers IP (in server I'm setting on what ip server will be working, and on client to what server I'm trying to connect). -
TCP, UDP problem with receiving data
Turtlix21 replied to Turtlix21's topic in AutoIt General Help and Support
Works good if server and client are on the PC. -
I've a problem with receiving data on my PC by TCP and UDP. I can send data to another computer, but can't receive it. I'm not shure where is the problem (on PC or on "another comupers") This is client code: ;TCP client TCPStartup() $socket = TCPConnect("192.168.0.18", 7777) ;try to connect to server and save number of socket If $socket = -1 Then ;if $socket = -1 then error MsgBox(16, "Error:", "Can't connect to server") EndIf $sendedBytes = TCPSend($socket, "nothing here :)") ;send message to connected socket If $sendedBytes = 0 Then ;if receiving data TCPSend(...) = 0 then error MsgBox(16, "Error", "Can't send message") EndIf TCPCloseSocket($socket) TCPShutdown() and server code: ;TCP server TCPStartup() $mainsocket = TCPListen("192.168.0.18", 7777) ;making main receiving socket While 1 ;receiving loop $acceptedSocket = TCPAccept($mainsocket) ;possible connection to accept If $acceptedSocket <> -1 Then $receivedData = TCPRecv($acceptedSocket, 1024) ;if main socket is connected then receive message MsgBox(64, "Received message!", "Message: " & $receivedData) TCPCloseSocket($acceptedSocket) ;close open connecion EndIf WEnd TCPShutdown() When server is on PC I can't receive any messages from any other computers. When client is on PC I can receive messages on any another computer. I tried to turn off antiviruses and windows firewall but it did't change anything EDIT: Error code from client from TCPConnect is 10060 (connection time out) and from TCPSend: 10038 I've found something about 10060 error code, Microsoft says "Connection timed out. A connection attempt failed because the connected party did not properly respond after a period of time, or the established connection failed because the connected host has failed to respond." So it means that the problem is with time of response but it makes no sense couse "another computer" is Virtual Machine with bridge internet connection from PC (pings beetwen PC and VM are lower than 1ms. About 10038 error code microsoft says that this is problem with socket and it actually makes sense.
-
Problem with registry permission
Turtlix21 replied to Turtlix21's topic in AutoIt General Help and Support
I want to make function to change audio output, it's all. -
Problem with registry permission
Turtlix21 replied to Turtlix21's topic in AutoIt General Help and Support
I want to change audio output by turning off all audio devices except one (eg. I want to change output to speakers, from headphones). I found location of registry key in Internet which change the state of device ("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\MMDevices\Audio\Render\{DEVICE-HASH}", "DeviceState"). When DeviceState is equal 1 device is on and when it's equal 268435457 device is off. I've made this and everythig looks fine, but I can't write in registry from script (I can write and delete keys by manually using regedit.exe) #RequireAdmin #include <array.au3> Func AudioOutput($DeviceName) Local $i = 0 Local $Devices[0 + 1][3 + 1] Local $RegistryLocation = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\MMDevices\Audio\Render" While 1 $i += 1 Local $DeviceID = RegEnumKey($RegistryLocation, $i) If $DeviceID = "" Then ExitLoop If RegRead($RegistryLocation & "\" & $DeviceID, "Role:0") <> "" Then If RegRead($RegistryLocation & "\" & $DeviceID, "DeviceState") = 1 Then Local $IsOn = 1 Else Local $IsOn = 0 EndIf _ArrayAdd($Devices, $DeviceID & "|" & RegRead($RegistryLocation & "\" & $DeviceID & "\Properties", "{a45c254e-df1c-4efd-8020-67d146a850e0},2") & "|" & $IsOn, 1) EndIf WEnd _ArrayDisplay($Devices) $WhereDeviceInArray = _ArraySearch($Devices, $DeviceName) If $WhereDeviceInArray = -1 Then Return -1 ElseIf $Devices[$WhereDeviceInArray][3] = 1 Then Return 2 Else For $i = 1 To UBound($Devices) RegWrite($RegistryLocation & "\" & $Devices[$i][1], "DeviceState", "REG_DWORD", 268435457) Next RegWrite($RegistryLocation & "\" & $Devices[$WhereDeviceInArray][1], "DeviceState", "REG_DWORD", 1) Return 1 EndIf EndFunc ;==>AudioOutput MsgBox(0, "", AudioOutput("Speakers")) Changing audio output by registry looks like the most unproblematic way. -
Problem with registry permission
Turtlix21 replied to Turtlix21's topic in AutoIt General Help and Support
So, which group of permissions autoit script is using ? (ALL APPLICATION PACKAGES, User, Administrator, AudioEndpointBuilder or Audiosrv) I also don't know how to change permissions in MMDevices becouse all time "access danied", any ideas ? -
I'm trying to make a simple program which will turn off all audio devices, except chosen one. I found registry locations and keys to make it, but I only can read values from this location. All attemps to make a new one or delete a key returns 0 and sets extended to 5 ("unable to open requested main key" and "unable to remote connect to the registry"). It looks like autoit script only has permissions to read values, I added #ReguireAdmin in first line but It changed nothing. I also tried to change permissions in registry but it all time ends with "access denied". #RequireAdmin ;~ $Return = RegWrite("HKLM64\SOFTWARE\Microsoft\Windows\CurrentVersion\MMDevices\Audio\Render\{96b80f31-032c-46e7-bde0-5485e67679ce}", "DeviceState", "REG_DWORD", 1) ;Return: 0 ;extended: 5 (doesn't work) Goal is to make it works $Return = RegWrite("HKLM64\SOFTWARE\Microsoft\Windows\CurrentVersion", "State", "REG_DWORD", "1") ;Return: 1 ;extended: 0 (works) RegDelete("HKLM64\SOFTWARE\Microsoft\Windows\CurrentVersion", "State") ;~ $Return = RegWrite("HKLM64\SOFTWARE\Microsoft\Windows\CurrentVersion\MMDevices", "State", "REG_DWORD", "1") ;Return: 0 ;extended: 5 (doesn't work) ;~ RegDelete("HKLM64\SOFTWARE\Microsoft\Windows\CurrentVersion\MMDevices", "State") MsgBox(0, "", "Returned value: " & $Return & @CRLF & "Extended: " & @extended) Problem starts in "MMDevices" location, in lower stages of location everythig is fine.
-
Deleting string from ComboBox
Turtlix21 replied to Turtlix21's topic in AutoIt General Help and Support
This is exceactly what I was looking for. I was using array becouse I didn't know about _GUICtrlComboBox_FindStringExact command. Thank you so much guys. -
Deleting string from ComboBox
Turtlix21 replied to Turtlix21's topic in AutoIt General Help and Support
@MichaelHB Ok, one problem solved, thanks. But I have more problems, adding works perfect (I think so), but deleting strings still doesn't work correctly, I think part of problem is in the _ArrayBinarySearch command, becouse sometimes when command should find string in array it just can't find it (returns -1), I can't understand why. Next part of problem is in the deleting string from ComboBox command (_GUICtrlComboBox_DeleteString), command just delete bad string (It could be bad declarated array variable, but I can't solve this problem too.) I made code a little more clearly, and added some descriptions. #include <GUIConstantsEx.au3> #include <EditConstants.au3> #include <GuiComboBox.au3> #include <Array.au3> $Window = GUICreate("Window", 540, 600) GUICtrlCreateLabel("Autorzy:", 5, 36) $Autor = GUICtrlCreateCombo("", 44, 33, 388) $Add = GUICtrlCreateButton("Add", 435, 30, 50) $Delete = GUICtrlCreateButton("Delete", 485, 30, 50) GUISetState(@SW_SHOW) Local $AutorCombo[0 + 1][1 + 1] ;[String][Handle to string in ComboBox] While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $Add $StringAdd = StringStripWS(GUICtrlRead($Autor), 3);..............................................Deleting White Characters before and after string $SearchingAdd = _ArrayBinarySearch($AutorCombo, $StringAdd);.....................................Searching for string in array ;~ MsgBox(0,"$SearchingAdd", $SearchingAdd) If StringIsSpace($StringAdd) <> 1 And $SearchingAdd = -1 Then;...................................Checking isn't the string white character only and isn't occured in array _ArrayAdd($AutorCombo, $StringAdd);..........................................................Adding String to array $AutorCombo[UBound($AutorCombo) - 1][1] = _GUICtrlComboBox_AddString($Autor, $StringAdd);....Adding string to ComboBox EndIf GUICtrlSetData($Autor, $StringAdd);..............................................................Setting string in ComboBox for the same string without white characters before and after string ;~ _ArrayDisplay($AutorCombo) Case $Delete $StringDelete = StringStripWS(GUICtrlRead($Autor), 3);...........................................Deleting White Characters before and after string $SearchingDelete = _ArrayBinarySearch($AutorCombo, $StringDelete);...............................Searching for string in array ;~ MsgBox(0,"$SearchingDelete", $SearchingDelete) If $SearchingDelete <> -1 Then;..................................................................Checking is string occured in the array _ArrayDelete($AutorCombo, $SearchingDelete);.................................................Deleting string from array _GUICtrlComboBox_DeleteString($Autor, $AutorCombo[$SearchingDelete][1]);.....................Deleting string from ComboBox EndIf GUICtrlSetData($Autor, $StringDelete);...........................................................Setting string in ComboBox for the same string without white characters before and after string ;~ _ArrayDisplay($AutorCombo) EndSwitch WEnd -
I have a problem with deleting string from ComboBox. I found _GUICtrlComboBox_DeleteString command but it doesn't work. I found next problem, why when I add string started by any number, _ArrayBinarySearch return -1, when the string is in the array ? #include <GUIConstantsEx.au3> #include <EditConstants.au3> #include <GuiComboBox.au3> #include <Array.au3> $Window = GUICreate("Window", 540, 600) GUICtrlCreateLabel("Autorzy:", 5, 36) $Autor = GUICtrlCreateCombo("", 44, 33, 388) $Add = GUICtrlCreateButton("Add", 435, 30, 50) $Delete = GUICtrlCreateButton("Delete", 485, 30, 50) GUISetState(@SW_SHOW) Local $AutorCombo[0 + 1][1 + 1] While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $Add If StringIsSpace(GUICtrlRead($Autor)) <> 1 And (_ArrayBinarySearch($AutorCombo, GUICtrlRead($Autor)) = -1) Then _ArrayAdd($AutorCombo, GUICtrlRead($Autor)) $AutorCombo[UBound($AutorCombo) - 1][1] = _GUICtrlComboBox_AddString($Autor, GUICtrlRead($Autor)) EndIf Case $Delete MsgBox(0, "", _ArrayBinarySearch($AutorCombo, GUICtrlRead($Autor))) If (_ArrayBinarySearch($AutorCombo, GUICtrlRead($Autor)) <> -1) Then _GUICtrlComboBox_DeleteString($AutorCombo, $AutorCombo[_ArrayBinarySearch($AutorCombo, GUICtrlRead($Autor))][1]) EndIf EndSwitch WEnd
-
How to check is the input focused ?
Turtlix21 replied to Turtlix21's topic in AutoIt GUI Help and Support
@Inpho ControlGetFocus is command what I was looking for, thanks for help. -
I tried to use GUIctrlgetstate in loop few times but all time it just doesn't work. I want to see something in console when the input is focused. #include <GUIConstantsEx.au3> $Form1 = GUICreate("Form1", 615, 437, 192, 124) $Input1 = GUICtrlCreateInput("Input1", 16, 24, 209, 21) GUISetState(@SW_SHOW) While 1 If GUIGetMsg() = $GUI_EVENT_CLOSE Then Exit WEnd
-
Problem with game, pic not disappears
Turtlix21 replied to Turtlix21's topic in AutoIt General Help and Support
help... -
I've problem with my game, in game we driving tank and shoot to other tanks. But when I press space shoot fly how i want but first graphic not disappear. I don't know why :C (I think u can not understand, just use code and download graphics) #include <GUIConstantsEx.au3> #include <misc.au3> #include <array.au3> #include <timers.au3> Global $vDLL = "user32.dll" ;--------------------------------------------------------------------------------------------------Kreator mapy--------------------------------------------------------------------------------------------------; $aw = 0 $as = 0 While 1 $s = InputBox("Rozmiar mapy", "Podaj poziomy rozmiar mapy" & @CRLF & "- Minimum 3" & @CRLF & "- Maksimum 50", 15) If (@error = 1) Then Exit If (StringIsDigit($s) = 1) And (($s > 50) = 0) And (($s < 3) = 0) Then ExitLoop WEnd While 1 $w = InputBox("Rozmiar mapy", "Podaj pionowy rozmiar mapy" & @CRLF & "- Minimum 3" & @CRLF & "- Maksimum 50", 15) If (@error = 1) Then Exit If (StringIsDigit($w) = 1) And (($w > 50) = 0) And (($w < 3) = 0) Then ExitLoop WEnd While 1 $roz = InputBox("Rozmiar czołgu", "Podaj rozmiar czołgu w pixelach" & @CRLF & "- Minimum 20" & @CRLF & "- Maksimum 500", 60) If (@error = 1) Then Exit If (StringIsDigit($roz) = 1) And (($roz > 500) = 0) And (($roz < 20) = 0) Then ExitLoop WEnd While 1 $zdrowie = InputBox("Zdrowie czołgu", "Podaj startowe zdrowie czołgu", 100) If (@error = 1) Then Exit If (StringIsDigit($s) = 1) Then ExitLoop WEnd Dim $check[$s * $w + 1] ;[numer checkbox'a] $mapa = GUICreate("Kreator mapy", $s * $roz, $w * $roz, 4, 4) For $l = 0 To $s * $w - 1 If ($as >= $s) Then $as = 0 $aw += 1 EndIf If $l = 0 Or $l = $s - 1 Or $l = $s * $w - 1 Or $l = $s * $w - $s Then $as += 1 ContinueLoop EndIf $check[$l + 1] = GUICtrlCreateCheckbox("", $roz * $as, $roz * $aw, 20, 20) $as += 1 Next GUISetState(@SW_SHOW) While 1 If (GUIGetMsg() = $GUI_EVENT_CLOSE) Then For $k = 1 To UBound($check) - 1 $check[$k] = GUICtrlRead($check[$k]) Next GUIDelete($mapa) ExitLoop EndIf WEnd ;--------------------------------------------------------------------------------------------------Generator mapy--------------------------------------------------------------------------------------------------; Dim $pol[$s * $w + 1][4 + 1] ;[numer pola][uchwyt, kamień, położenie1, położenie2] Dim $pczol[4 + 1][9 + 1] ;[numer czołgu][numer pola, uchwyt, kierunek, zdrowie, czy strzela, uchwyt do strzału, numer pola strzału, kierunek strzału, siła] $aw = 0 $as = 0 ;~ _ArrayDisplay($check) $czolgi = GUICreate("Czołgi", $s * $roz, $w * $roz, 4, 4) For $i = 0 To $s * $w - 1 If ($as >= $s) Then $as = 0 $aw += 1 EndIf Switch $check[$i + 1] Case 1 $pol[$i + 1][1] = GUICtrlCreatePic("mapa2.jpg", $roz * $as, $roz * $aw, $roz, $roz) $pol[$i + 1][2] = 1 $pol[$i + 1][3] = $roz * $as $pol[$i + 1][4] = $roz * $aw Case 0, 4 $pol[$i + 1][1] = GUICtrlCreatePic("mapa.jpg", $roz * $as, $roz * $aw, $roz, $roz) $pol[$i + 1][2] = 0 $pol[$i + 1][3] = $roz * $as $pol[$i + 1][4] = $roz * $aw EndSwitch $as += 1 Next ;~ _ArrayDisplay($pol) $pczol[1][1] = 1 $pczol[2][1] = $s $pczol[3][1] = $s * $w $pczol[4][1] = $s * $w - $s + 1 $pczol[1][2] = GUICtrlCreatePic("czolg1p.jpg", $pol[$pczol[1][1]][3], $pol[$pczol[1][1]][4], $roz, $roz) $pczol[2][2] = GUICtrlCreatePic("czolg2d.jpg", $pol[$pczol[2][1]][3], $pol[$pczol[2][1]][4], $roz, $roz) $pczol[3][2] = GUICtrlCreatePic("czolg3l.jpg", $pol[$pczol[3][1]][3], $pol[$pczol[3][1]][4], $roz, $roz) $pczol[4][2] = GUICtrlCreatePic("czolg4g.jpg", $pol[$pczol[4][1]][3], $pol[$pczol[4][1]][4], $roz, $roz) $pczol[1][3] = "p" $pczol[2][3] = "d" $pczol[3][3] = "l" $pczol[4][3] = "g" $pczol[1][4] = $zdrowie $pczol[2][4] = $zdrowie $pczol[3][4] = $zdrowie $pczol[4][4] = $zdrowie For $x = 1 To 4 $pczol[$x][5] = 0 $pczol[$x][6] = 0 $pczol[$x][7] = 0 $pczol[$x][8] = 0 Next GUICtrlDelete($pol[$pczol[1][1]][1]) GUICtrlDelete($pol[$pczol[2][1]][1]) GUICtrlDelete($pol[$pczol[3][1]][1]) GUICtrlDelete($pol[$pczol[4][1]][1]) ;~ _ArrayDisplay($pczol) Func czolg($NumCzolgu, $rzadanie) If ($NumCzolgu > 4) Or ($NumCzolgu < 1) Then MsgBox(16, "BŁAD", "Niepoprawny numer czołgu", 5) Return "" EndIf $NumPola = $pczol[$NumCzolgu][1] $RzadanePole = $NumPola + $rzadanie $CzyPoleZajete = 0 If IsInt($NumPola / $s) And $RzadanePole = $NumPola + 1 Then $CzyPoleZajete = 1 If IsInt(($NumPola - 1) / $s) And $RzadanePole = $NumPola - 1 Then $CzyPoleZajete = 1 If $RzadanePole > $w * $s Or $RzadanePole < 1 Then $CzyPoleZajete = 1 If $RzadanePole = $pczol[1][1] Or $RzadanePole = $pczol[2][1] Or $RzadanePole = $pczol[3][1] Or $RzadanePole = $pczol[4][1] Then $CzyPoleZajete = 1 Switch $rzadanie Case $s $RzadanieKierunku = "d" Case -$s $RzadanieKierunku = "g" Case 1 $RzadanieKierunku = "p" Case -1 $RzadanieKierunku = "l" Case Else MsgBox(16, "BŁĄD", "Niepoprawne żadanie kierunku", 5) Return "" EndSwitch $CzyUsunietyStaryCzolg = GUICtrlDelete($pczol[$NumCzolgu][2]) If $pczol[$NumCzolgu][3] = $RzadanieKierunku And $CzyPoleZajete = 0 And $pol[$RzadanePole][2] = 0 Then ;~ $ifelse = "if" $pczol[$NumCzolgu][1] = $RzadanePole $pol[$NumPola][1] = GUICtrlCreatePic("mapa.jpg", $pol[$NumPola][3], $pol[$NumPola][4], $roz, $roz) GUICtrlDelete($pol[$RzadanePole][1]) $pol[$RzadanePole][1] = "del" $pczol[$NumCzolgu][2] = GUICtrlCreatePic("czolg" & $NumCzolgu & $RzadanieKierunku & ".jpg", $pol[$RzadanePole][3], $pol[$RzadanePole][4], $roz, $roz) Else ;~ $ifelse = "else" $pczol[$NumCzolgu][3] = $RzadanieKierunku $pczol[$NumCzolgu][2] = GUICtrlCreatePic("czolg" & $NumCzolgu & $RzadanieKierunku & ".jpg", $pol[$pczol[$NumCzolgu][1]][3], $pol[$pczol[$NumCzolgu][1]][4], $roz, $roz) EndIf Sleep(400) ;~ MsgBox(0, "", "NumCzolgu = " & $NumCzolgu & @CRLF & "rzadanie: " & $rzadanie & @CRLF & "NumPola: " & $NumPola & @CRLF & "RzadanePole: " & $RzadanePole & @CRLF & "RzadanieKierunku: " & $RzadanieKierunku & @CRLF & "CzyUsunietoStaryCzolg: " & $CzyUsunietyStaryCzolg & @CRLF & "if/else: " & $ifelse & @CRLF & "Numer pola po zmianie(istotne przy if): " & $pczol[$NumCzolgu][1] & @CRLF & "Uchwyt starej lokalizacji czołgu (teraz mapa)(istotne przy if): " & $pol[$NumPola][1] & @CRLF & "Uchwyt pola mapy na którym jest czołg (del)(istotne przy if): " & $pol[$RzadanePole][1] & @CRLF & "Uchwyt nowej grafiki czołgu: " & $pczol[$NumCzolgu][2] & @CRLF & "Kierunek czołgu (istotne przy else): " & $pczol[$NumCzolgu][3]) EndFunc ;==>czolg Func strzal($NumCzolgu) If ($NumCzolgu > 4) Or ($NumCzolgu < 1) Then MsgBox(16, "BŁAD", "Niepoprawny numer czołgu", 5) Return "" EndIf $NumPola = $pczol[$NumCzolgu][1] $KierunekCzolgu = $pczol[$NumCzolgu][3] Switch $KierunekCzolgu Case "g" $KierunekStrzalu = -$s Case "d" $KierunekStrzalu = $s Case "l" $KierunekStrzalu = -1 Case "p" $KierunekStrzalu = 1 EndSwitch $RzadanePole = $NumPola + $KierunekStrzalu If IsInt($NumPola / $s) And $RzadanePole = $NumPola + 1 Then Return "" If IsInt(($NumPola - 1) / $s) And $RzadanePole = $NumPola - 1 Then Return "" If $RzadanePole > $w * $s Or $RzadanePole < 1 Then Return "" If $pol[$RzadanePole][2] = 1 Then Return "" Switch $RzadanePole Case $pczol[1][1] $pczol[1][4] -= 100 Return "" Case $pczol[2][1] $pczol[2][4] -= 100 Return "" Case $pczol[3][1] $pczol[3][4] -= 100 Return "" Case $pczol[4][1] $pczol[4][4] -= 100 Return "" EndSwitch $pczol[$NumCzolgu][5] = 1 GUICtrlDelete($pol[$RzadanePole][1]) $pol[$RzadanePole][1] = "del" $pczol[$NumCzolgu][6] = GUICtrlCreatePic("strzal100.jpg", $pol[$RzadanePole][3], $pol[$RzadanePole][4], $roz, $roz) $pczol[$NumCzolgu][7] = $RzadanePole $pczol[$NumCzolgu][8] = $KierunekStrzalu $pczol[$NumCzolgu][9] = 100 AdlibRegister("strzal" & $NumCzolgu) EndFunc ;==>strzal ;[numer czołgu][numer pola, uchwyt, kierunek, zdrowie, czy strzela, uchwyt do strzału, numer pola strzału, kierunek strzału, siła] Func strzal1() ;~ _ArrayDisplay($pczol, "pczol") ;~ _ArrayDisplay($pol, "pol") $NumPola = $pczol[1][7] $RzadanePole = $NumPola + $pczol[1][8] $Sila = $pczol[1][9] - 25 If $RzadanePole > $w * $s Or $RzadanePole < 1 Then $pczol[1][5] = 0 AdlibUnRegister("strzal1") Return "" EndIf If $pol[$RzadanePole][2] = 1 Then AdlibUnRegister("strzal1") $pczol[1][5] = 0 GUICtrlDelete($pczol[1][6]) $pczol[1][6] = "del" $pol[$NumPola][1] = GUICtrlCreatePic("mapa.jpg", $pol[$NumPola][3], $pol[$NumPola][4], $roz, $roz) Return "" EndIf If $pczol[1][9] = 25 Then AdlibUnRegister("strzal1") $pczol[1][5] = 0 GUICtrlDelete($pczol[1][6]) $pczol[1][6] = "del" $pol[$NumPola][1] = GUICtrlCreatePic("mapa.jpg", $pol[$NumPola][3], $pol[$NumPola][4], $roz, $roz) Return "" EndIf ;~ MsgBox(0,"",$pczol[1][6]) $a = GUICtrlDelete($pczol[1][6]) ;~ ConsoleWrite($Sila & @CRLF & $a & @CRLF) $pczol[1][6] = "del" ;~ MsgBox(0,"",$a) $pol[$NumPola][1] = GUICtrlCreatePic("mapa.jpg", $pol[$NumPola][3], $pol[$NumPola][4], $roz, $roz) If IsInt($NumPola / $s) And $RzadanePole = $NumPola + 1 Then $pczol[1][5] = 0 AdlibUnRegister("strzal1") Return "" EndIf If IsInt(($NumPola - 1) / $s) And $RzadanePole = $NumPola - 1 Then $pczol[1][5] = 0 AdlibUnRegister("strzal1") Return "" EndIf Switch $RzadanePole Case $pczol[1][1] $pczol[1][4] -= $Sila $pczol[1][5] = 0 AdlibUnRegister("strzal1") Return "" Case $pczol[2][1] $pczol[2][4] -= $Sila $pczol[1][5] = 0 AdlibUnRegister("strzal1") Return "" Case $pczol[3][1] $pczol[3][4] -= $Sila $pczol[1][5] = 0 AdlibUnRegister("strzal1") Return "" Case $pczol[4][1] $pczol[4][4] -= $Sila $pczol[1][5] = 0 AdlibUnRegister("strzal1") Return "" EndSwitch GUICtrlDelete($pol[$RzadanePole][1]) $pol[$RzadanePole][1] = "del" $pczol[1][6] = GUICtrlCreatePic("strzal" & $Sila & ".jpg", $pol[$RzadanePole][3], $pol[$RzadanePole][4], $roz, $roz) $pczol[1][7] = $RzadanePole $pczol[1][9] = $Sila EndFunc ;==>strzal1 Func strzal2() Sleep(1000) EndFunc ;==>strzal2 Func strzal3() Sleep(1000) EndFunc ;==>strzal3 Func strzal4() Sleep(1000) EndFunc ;==>strzal4 GUISetState(@SW_SHOW) ;--------------------------------------------------------------------------------------------------Pętla i Multiplayer--------------------------------------------------------------------------------------------------; ;~ Func komendy($kom) ;~ $kom = StringSplit($kom, ":") ;~ Switch $kom[1] ;~ Case "connect" ;~ EndSwitch ;~ EndFunc While 1 If (GUIGetMsg() = $GUI_EVENT_CLOSE) Then ExitLoop If _IsPressed("1B", $vDLL) And WinActive($czolgi) Then Exit If _IsPressed("25", $vDLL) And WinActive($czolgi) Then czolg(1, -1) If _IsPressed("26", $vDLL) And WinActive($czolgi) Then czolg(1, -$s) If _IsPressed("27", $vDLL) And WinActive($czolgi) Then czolg(1, 1) If _IsPressed("28", $vDLL) And WinActive($czolgi) Then czolg(1, $s) If _IsPressed("20", $vDLL) And WinActive($czolgi) Then strzal(1) ;If _IsPressed("41", $vDLL) And WinActive($czolgi) Then czolg(2, -1) ;If _IsPressed("57", $vDLL) And WinActive($czolgi) Then czolg(2, -$s) ;If _IsPressed("44", $vDLL) And WinActive($czolgi) Then czolg(2, 1) ;If _IsPressed("53", $vDLL) And WinActive($czolgi) Then czolg(2, $s) ;If $pczol[1][4] < 1 Then ;komenda do odłączenia czołgu 1 ;If $pczol[2][4] < 1 Then ;komenda do odłączenia czołgu 2 ;If $pczol[3][4] < 1 Then ;komenda do odłączenia czołgu 3 ;If $pczol[4][4] < 1 Then ;komenda do odłączenia czołgu 4 WEnd ;~ Dim $Gracz[4 + 1][3 + 1] ;[numer gracza][ip, port, socket] ;~ Dim $Serv[3 + 1] = ["25.69.134.219", "21917"] ;[ip, port, socket] ;~ Dim $Komenda ;~ UDPStartup() ;~ $Serv[3] = UDPBind($Serv[1], $Serv[2]) ;~ While 1 ;~ If (GUIGetMsg() = $GUI_EVENT_CLOSE) Then ExitLoop ;~ $Komenda = UDPRecv($Serv[3], 2048) ;~ If $Komenda <> "" Then ;~ komendy($Komenda) ;~ EndIf ;~ WEnd (I think problem is in "strzal" or "strzal1" functions)
-
Problem with changing car position in 2D game.
Turtlix21 replied to Turtlix21's topic in AutoIt General Help and Support
I found problem, all cars was hide under the map (i found problem when i trying to edit code descriptions to english to you and i forget to put map.jpg in folder, so u helped me thank to try to help -
Problem with changing car position in 2D game.
Turtlix21 replied to Turtlix21's topic in AutoIt General Help and Support
Link to game BTW. I've next solution, it's probably better, i can load map one time and in all loop runs load only cars -
I'm trying to make simple game in autoit. But I found one problem what I can't solve. I load a 2D map, but I can't change position of cars. Probably problem is in funcion what changing cars positon, becouse new car position is load for small moment and next disappears. If i want to keep new place of car I must put command in loop, but if i did it script stay in loop and i cant do anythig. I found resolution but i think its not good, I can load map (250 pictures) in all loop runs. Is there a better solution? BTW.Firstly im trying to load all combinations of map but i cant load more than ~10000 pictures
-
No, I just run from SciTe, when I compile this it give me same error but in msgbox Maybe i should change something in ff.au3
-
#include <ff.au3> _FFStart("www.autoitscript.com") When I start this I get error __FFStartProcess ==> General Error: Error reading registry entry for FireFox. HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Mozilla\Mozilla Firefox\*CurrentVersion*\Main\PathToExe Error from RegRead: 1 Please give me simply answer and dont use hard words
-
File was in "\\users\public" but should be in "\\users\public\documents" BTW. error returned -1 And now i will use ini commands couse I know about it
-
Hello, I've problem with filereadline command (probably). $settings = FileOpen(@DocumentsCommonDir & "\settings.ini", 1) $ostzdj = FileReadLine($settings, 1) MsgBox(0,"",$ostzdj) Inside settings.ini in public documents I've Ostatnie zdjęcie:IMG_8092 I tried change format, change file open mode, without macro, but all time it return nothing. One strange thing what I found is when i was use MsgBox(0,"","'" & $ostzdj * "'") It return '0 but idk why