Jump to content

Tank game


Fabry
 Share

Recommended Posts

This is a lan game, like tank. You use up,down,left and right arrow to move and space to shoot. It works, but not perfectly.

It needs Grafica.txt.

This is the code:

[autoit]#cs ----------------------------------------------------------------------------

AutoIt Version: 3.2.4.9

Author: Fabrizio2210

Script Function:

Template AutoIt script.

#ce ----------------------------------------------------------------------------

#include <GUIConstants.au3>

#Include <GuiListView.au3>

#Include <Misc.au3>

#region Dichiarazione variabili

Dim $left = 64, $top = 48, $riga = 15, $width = 495, $height = 360, $maxspari = 10

Dim $Label1[$riga + 1], $Label2[$riga + 1], $ips[101][9], $punti = 0, $data = '', $morti = 0, $MySpari[$maxspari + 4][13], $spari[100][13], $c = 1

$MySpari[0][0] = 0

$spari[0][0] = 0

$timersparo = 0

$ultimosparo=0

$destra = ChrW(0x25BA)

$sinistra = ChrW(0x25C4)

$su = ChrW(0x25B2)

$giu = ChrW(0x25BC)

$tondo = ChrW(0x2022)

#endregion Variabili

#region Parametri server

$My_ips = StringSplit(@IPAddress1, '.')

$Broadcast = $My_ips[1] & '.' & $My_ips[2] & '.' & $My_ips[3] & '.255'

UDPStartup()

$nome = InputBox('Nome:', 'Inserisci il tuo nick', @UserName, ' M20')

If $nome = '' Or $nome = ' ' Then $nome = @UserName

$socket = UDPBind(@IPAddress1, 65530)

If @error <> 0 Then

MsgBox(16, 'Errore socket', 'Controlla di non aver gi

Edited by Fabry
A lan chat (Multilanguage)LanMuleFile transferTank gameTank 2 an online game[center]L'esperienza è il nome che tutti danno ai propri errori.Experience is the name everyone gives to their mistakes.Oscar Wilde[/center]
Link to comment
Share on other sites

Neu AutoIt v3 Script.au3(61,64) : ERROR: BinaryToString() [built-in] called with wrong number of args.
        If IsBinary($data) Then $data = BinaryToString($data, 4)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
Neu AutoIt v3 Script.au3(317,80) : ERROR: StringToBinary() [built-in] called with wrong number of args.
    If Not IsBinary($messaggio) Then $messaggio1 = StringToBinary($messaggio, 4)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
Neu AutoIt v3 Script.au3 - 2 error(s), 0 warning(s)

And please translate it into english... and discribe it a little bit more

Edited by Sn0opy
Link to comment
Share on other sites

In autoit 3.2.4.9 Stringtobinary has the flag (See the help). 4 is for UTF8 code instead ansi or ascii. Scite poll the flag as a error, but works.

I have the necessity of send in binary because I use unicode.►◄▼▲

A lan chat (Multilanguage)LanMuleFile transferTank gameTank 2 an online game[center]L'esperienza è il nome che tutti danno ai propri errori.Experience is the name everyone gives to their mistakes.Oscar Wilde[/center]
Link to comment
Share on other sites

Grafica.txt contains only this:

CODE

You can use

Alt + 16 ►

Alt + 17 ◄

Alt + 30 ▲

Alt + 31 ▼

Alt + 7

Chr in autoit is different by normal.

A lan chat (Multilanguage)LanMuleFile transferTank gameTank 2 an online game[center]L'esperienza è il nome che tutti danno ai propri errori.Experience is the name everyone gives to their mistakes.Oscar Wilde[/center]
Link to comment
Share on other sites

Take out the need for the text file with the following

$destra = ChrW(0x25BA)
$sinistra = ChrW(0x25C4)
$su = ChrW(0x25B2)
$giu = ChrW(0x25BC)
$tondo = ChrW(0x2022)

My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop.
Link to comment
Share on other sites

Take out the need for the text file with the following

$destra = ChrW(0x25BA)
$sinistra = ChrW(0x25C4)
$su = ChrW(0x25B2)
$giu = ChrW(0x25BC)
$tondo = ChrW(0x2022)
Thank you, I tried with Chr(16), Chr(17).... but doesn't work.

Instead with your ChrW works, now it doesn't need the file grafica.txt.

I release a better version:

[autoit]#cs ----------------------------------------------------------------------------

AutoIt Version: 3.2.4.9

Author: Fabrizio2210

Script Function:

Template AutoIt script.

#ce ----------------------------------------------------------------------------

#include <GUIConstants.au3>

#Include <GuiListView.au3>

#Include <Misc.au3>

#region Dichiarazione variabili

Dim $left = 64, $top = 48, $riga = 15, $width = 495, $height = 360, $maxspari = 10

Dim $Label1[$riga + 1], $Label2[$riga + 1], $ips[101][9], $punti = 0, $data = '', $morti = 0, $MySpari[$maxspari + 4][13], $spari[100][13], $c = 1

$MySpari[0][0] = 0

$spari[0][0] = 0

$timersparo=0

$destra =ChrW(0x25BA)

$sinistra = ChrW(0x25C4)

$su = ChrW(0x25B2)

$giu = ChrW(0x25BC)

$tondo = ChrW(0x2022)

#endregion Variabili

#region Parametri server

$My_ips = StringSplit(@IPAddress1, '.')

$Broadcast = $My_ips[1] & '.' & $My_ips[2] & '.' & $My_ips[3] & '.255'

UDPStartup()

$nome = InputBox('Nome:', 'Iserisci il tuo nick', @UserName, ' M20')

If $nome = '' Or $nome = ' ' Then $nome = @UserName

$socket = UDPBind(@IPAddress1, 65530)

If @error <> 0 Then

MsgBox(16, 'Errore socket', 'Controlla di non aver gi

A lan chat (Multilanguage)LanMuleFile transferTank gameTank 2 an online game[center]L'esperienza è il nome che tutti danno ai propri errori.Experience is the name everyone gives to their mistakes.Oscar Wilde[/center]
Link to comment
Share on other sites

AutoIt Help file has a good list of ascii codes. In Character map, if a character says U+FFFC use ChrW(0xFFFC)

My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop.
Link to comment
Share on other sites

Thak you for information, I will need it in future.

I rewrite the program.

[autoit]#cs ----------------------------------------------------------------------------

AutoIt Version: 3.2.4.9

Author: Fabrizio2210

Script Function:

Template AutoIt script.

#ce ----------------------------------------------------------------------------

#include <GUIConstants.au3>

#Include <GuiListView.au3>

#Include <Misc.au3>

#region Dichiarazione variabili

Dim $left = 64, $top = 48, $riga = 15, $width = 495, $height = 360, $maxspari = 10

Dim $Label1[$riga + 1], $Label2[$riga + 1], $ips[101][9], $punti = 0, $data = '', $morti = 0, $MySpari[$maxspari + 4][13], $spari[100][13], $c = 1

$MySpari[0][0] = 0

$spari[0][0] = 0

$timersparo = 0

$ultimosparo=0

$destra = ChrW(0x25BA)

$sinistra = ChrW(0x25C4)

$su = ChrW(0x25B2)

$giu = ChrW(0x25BC)

$tondo = ChrW(0x2022)

#endregion Variabili

#region Parametri server

$My_ips = StringSplit(@IPAddress1, '.')

$Broadcast = $My_ips[1] & '.' & $My_ips[2] & '.' & $My_ips[3] & '.255'

UDPStartup()

$nome = InputBox('Nome:', 'Iserisci il tuo nick', @UserName, ' M20')

If $nome = '' Or $nome = ' ' Then $nome = @UserName

$socket = UDPBind(@IPAddress1, 65530)

If @error <> 0 Then

MsgBox(16, 'Errore socket', 'Controlla di non aver gi

Edited by Fabry
A lan chat (Multilanguage)LanMuleFile transferTank gameTank 2 an online game[center]L'esperienza è il nome che tutti danno ai propri errori.Experience is the name everyone gives to their mistakes.Oscar Wilde[/center]
Link to comment
Share on other sites

  • 1 year later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...