\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
Welcome to Omnicron Software
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\

 

Home

Scripts

Malicious Scripts

DSINs

Help

About

Employment

Employees

Contact Us

Links

Battle Ships

////////////////////////
//Battle Ships //
//By Omnicron Software//
////////////////////////

//This has one of the most advanced
//scripts OmniSoft has EVER written
//What a nightmare :)


///////////
//Startup//
///////////
// Needed to restore original settings
getcolor
getbgcolor

//OmniSoft Color Setter
color 4
bgcolor 5

////////////////////////////
//declaration of variables//
////////////////////////////

var menuchoice
var PCAction
var shipcount
var PCshipcount

//shot variables
var shotx
var shoty
var pcshotx
var pcshoty

////////////
//PC ships//
////////////

//PC Ships X
var PCfrigatex
var PCbattleshipx
var PCdestroyerX
var PCdestroyer2x
var PCsubx

//PC Ships y
var PCfrigatey
var PCbattleshipy
var PCdestroyery
var PCdestroyer2y
var PCsuby

//PC Ships Hit?
var PCfrigatehit
var PCbattleshiphit
var PCdestroyerhit
var PCdestroyer2hit
var PCsubhit

////////////////
//Player Ships//
////////////////

//Player ships X
var frigatex
var battleshipx
var destroyerX
var destroyer2x
var subx

//Player Ships y
var frigatey
var battleshipy
var destroyery
var destroyer2y
var suby

//Player Ships Hit?
var frigatehit
var battleshiphit
var destroyerhit
var destroyer2hit
var subhit

//Grid Variables

var mark11
var mark12
var mark13
var mark14
var mark15

var mark21
var mark22
var mark23
var mark24
var mark25

var mark31
var mark32
var mark33
var mark34
var mark35

var mark41
var mark42
var mark43
var mark44
var mark45

var mark51
var mark52
var mark53
var mark54
var mark55

/////////////
//Main Menu//
/////////////

@menu
cls
color blue
say 10 /\/\/\/\/\/\/\/\/\/
color orange
say 10 BattleShips
color blue
say 10 \/\/\/\/\/\/\/\/\/\
color orange
say 10 By Omnicron Software
color blue
skipline
say 10 1. Play BattleShips
say 10 2. Quit
skipline
color white
INPUT menuchoice Please choose a number.

IF menuchoice = 1
goto gamestart
ENDIF

IF menuchoice = 2
goto quit
ENDIF

//ELSE
color blue
say 10 Sorry. Invalid Choice.
skipline
pause
skipline
goto menu


//////////////////////////////////////////////

///////////////
//BattleShips//
///////////////

@gamestart
color blue
Say 10 Welcome %myusername%.
Say 10 I am Computer.
skipline
say 10 You will be playing me today.
skipline
SAY 10 Just let me place my ships.

//Grid Setup

//UBER MEGA THANKS to Cerel

chr 160
! mark11 = %chr%
! mark12 = %chr%
! mark13 = %chr%
! mark14 = %chr%
! mark15 = %chr%

! mark21 = %chr%
! mark22 = %chr%
! mark23 = %chr%
! mark24 = %chr%
! mark25 = %chr%

! mark31 = %chr%
! mark32 = %chr%
! mark33 = %chr%
! mark34 = %chr%
! mark35 = %chr%

! mark41 = %chr%
! mark42 = %chr%
! mark43 = %chr%
! mark44 = %chr%
! mark45 = %chr%

! mark51 = %chr%
! mark52 = %chr%
! mark53 = %chr%
! mark54 = %chr%
! mark55 = %chr%

////////////
//PC Setup//
////////////

//PC Ships

SAY 10 Placing Frigate
@pcfrigatex
rndint 5
! pcfrigatex = %rndint% + 1
rndint 5
! pcfrigatey = %rndint% + 1

SAY 10 Placing Battle Ship
@pcbattleshipx
rndint 5
! pcbattleshipx = %rndint% + 1
rndint 5
! pcbattleshipy = %rndint% + 1

//Collision check

IF pcbattleshipx = pcfrigatex
IF pcbattleshipy = pcfrigatey
goto pcbattleshipx
endif

/////////////////

SAY 10 Placing Destroyer
@pcdestroyerx
rndint 5
! pcdestroyerx = %rndint% + 1
rndint 5
! pcdestroyery = %rndint% + 1

//Collision check

IF pcdestroyerx = pcfrigatex
IF pcdestroyery = pcfrigatey
goto destroyerx
endif

IF pcdestroyerx = pcbattleshipx
IF pcdestroyery = pcbattleshipy
goto destroyerx
endif
////////

SAY 10 Placing other Destroyer
@pcdestroyer2x
rndint 5
! pcdestroyer2x = %rndint% + 1
rndint 5
! pcdestroyer2y = %rndint% + 1

//Collision check

IF pcdestroyer2x = pcfrigatex
IF pcdestroyer2y = pcfrigatey
goto pcdestroyer2x
endif

IF pcdestroyer2x = pcbattleshipx
IF pcdestroyer2y = pcbattleshipy
goto pcdestroyer2x
endif

IF pcdestroyer2x = pcdestroyerx
IF pcdestroyer2y = pcdestroyery
goto pcdestroyer2x
endif
////////

SAY 10 Placing Submarine
@pcsubx
rndint 5
! pcsubx = %rndint% + 1
rndint 5
! pcsuby = %rndint% + 1

//Collision check

IF pcsubx = pcfrigatex
IF pcsuby = pcfrigatey
goto pcsubx
endif

IF pcsubx = pcbattleshipx
IF pcsuby = pcbattleshipy
goto pcsubx
endif

IF pcsubx = pcdestroyerx
IF pcsuby = pcdestroyery
goto pcsubx
endif

IF pcsubx = pcdestroyer2x
IF pcsuby = pcdestroyer2y
goto pcsubx
endif

////////

////////////
skipline
SAY 10 OK. My ships are placed.
skipline

////////////////
//Player Setup//
////////////////

color white
say 10 To quit, type quit at any time.
skipline
color blue
SAY 10 Placing : Frigate
@frigatex
color white
INPUT frigatex Specify X

////////////////
IF frigatex = quit
goto quit
ENDIF

IF frigatex > 5
say 10 Oops. Stay under 6.
goto frigatex
ENDIF

IF frigatex < 1
say 10 Oops. Stay over 0.
goto frigatex
ENDIF
////////////////

@frigateY
INPUT frigateY Specify Y

////////////////
IF frigatey = quit
goto quit
ENDIF

IF frigateY > 5
say 10 Oops. Stay under 6.
goto frigateY
ENDIF

IF frigateY < 1
say 10 Oops. Stay over 0.
goto frigateY
ENDIF

skipline
color blue
SAY 10 Placing : BattleShip
@battleshipx
color white
INPUT battleshipx Specify X

////////////////
IF battleshipx = quit
goto quit
ENDIF

IF battleshipx > 5
say 10 Oops. Stay under 6.
goto battleshipx
ENDIF

IF battleshipx < 1
say 10 Oops. Stay over 0.
goto battleshipx
ENDIF
////////////////

@battleshipY
INPUT battleshipY Specify Y

////////////////
IF battleshipy = quit
goto quit
ENDIF

IF battleshipY > 5
say 10 Oops. Stay under 6.
goto battleshipY
ENDIF

IF battleshipY < 1
say 10 Oops. Stay over 0.
goto battleshipY
ENDIF
////////////////

//Collision check

IF battleshipx = frigatex
IF battleshipY = frigatey
say 10 Sorry. Position occupied.
goto battleshipx
endif
////////

skipline
color blue
SAY 10 Placing : Destroyer
@destroyerx
color white
INPUT destroyerx Specify X

////////////////
IF destroyerx = quit
goto quit
ENDIF

IF destroyerx > 5
say 10 Oops. Stay under 6.
goto destroyerx
ENDIF

IF destroyerx < 1
say 10 Oops. Stay over 0.
goto destroyerx
ENDIF
////////////////

@destroyerY
INPUT destroyerY Specify Y

////////////////
IF destroyery = quit
goto quit
ENDIF

IF destroyerY > 5
say 10 Oops. Stay under 6.
goto destroyerY
ENDIF

IF destroyerY < 1
say 10 Oops. Stay over 0.
goto destroyerY
ENDIF
////////////////

//Collision check

IF destroyerx = frigatex
IF destroyerY = frigatey
say 10 Sorry. Position occupied.
goto destroyerx
endif

IF destroyerx = battleshipx
IF destroyerY = battleshipy
say 10 Sorry. Position occupied.
goto destroyerx
endif
////////

skipline
color blue
SAY 10 Placing : Destroyer 2
@Destroyer2x
color white
INPUT Destroyer2x Specify X

////////////////
IF destroyer2x = quit
goto quit
ENDIF

IF Destroyer2x > 5
say 10 Oops. Stay under 6.
goto Destroyer2x
ENDIF

IF Destroyer2x < 1
say 10 Oops. Stay over 0.
goto Destroyer2x
ENDIF
////////////////

@Destroyer2Y
INPUT Destroyer2Y Specify Y

////////////////
IF destroyer2y = quit
goto quit
ENDIF

IF Destroyer2Y > 5
say 10 Oops. Stay under 6.
goto Destroyer2Y
ENDIF

IF Destroyer2Y < 1
say 10 Oops. Stay over 0.
goto Destroyer2Y
ENDIF
////////////////

//Collision check

IF Destroyer2x = frigatex
IF Destroyer2Y = frigatey
say 10 Sorry. Position occupied.
goto Destroyer2x
endif

IF Destroyer2x = battleshipx
IF Destroyer2Y = battleshipy
say 10 Sorry. Position occupied.
goto Destroyer2x
endif

IF Destroyer2x = destroyerx
IF Destroyer2Y = destroyery
say 10 Sorry. Position occupied.
goto Destroyer2x
endif
////////

skipline
color blue
SAY 10 Placing : Submarine
@subx
color white
INPUT subx Specify X

////////////////
IF subx = quit
goto quit
ENDIF

IF subx > 5
say 10 Oops. Stay under 6.
goto subx
ENDIF

IF subx < 1
say 10 Oops. Stay over 0.
goto subx
ENDIF

////////////////
@subY
INPUT subY Specify Y

////////////////
IF suby = quit
goto quit
ENDIF

IF subY > 5
say 10 Oops. Stay under 6.
goto subY
ENDIF

IF subY < 1
say 10 Oops. Stay over 0.
goto subY
ENDIF
////////////////

//Collision check

IF subx = frigatex
IF subY = frigatey
say 10 Sorry. Position occupied.
goto subx
endif

IF subx = battleshipx
IF subY = battleshipy
say 10 Sorry. Position occupied.
goto subx
endif

IF subx = destroyerx
IF subY = destroyery
say 10 Sorry. Position occupied.
goto subx
endif

IF subx = destroyer2x
IF subY = destroyer2y
say 10 Sorry. Position occupied.
goto subx
endif

////////

skipline
color blue
SAY 10 OK. All your ships are placed.
SAY 10 It's your go first.
skipline

/////////////
//Player go//
/////////////

@shoot
//Run check if player still in

IF frigatehit = 1
IF battleshiphit = 1
IF destroyerhit = 1
IF destroyer2hit = 1
IF subhit = 1
skipline
color red
SAY 10 Sorry. You lost.
SAY 10 Better luck next time.
skipline
pause
skipline
goto quit
ENDIF

skipline
color blue
SAY 10 Your go.
skipline
//Ship count
! shipcount = 0
! pcshipcount = 0

IF frigatehit = 1
! shipcount = %shipcount% + 1
ENDIF
IF battleshiphit = 1
! shipcount = %shipcount% + 1
ENDIF
IF destroyerhit = 1
! shipcount = %shipcount% + 1
ENDIF
IF destroyer2hit = 1
! shipcount = %shipcount% + 1
ENDIF
IF subhit = 1
! shipcount = %shipcount% + 1
ENDIF

IF shipcount = 1
color red
Say 10 I've destroyed 1 ship so far.
goto playercount
endif
//ELSE
color red
Say 10 I've destroyed %shipcount% ships so far.

@playercount
skipline
IF pcfrigatehit = 1
! pcshipcount = %pcshipcount% + 1
ENDIF
IF pcbattleshiphit = 1
! pcshipcount = %pcshipcount% + 1
ENDIF
IF pcdestroyerhit = 1
! pcshipcount = %pcshipcount% + 1
ENDIF
IF pcdestroyer2hit = 1
! pcshipcount = %pcshipcount% + 1
ENDIF
IF pcsubhit = 1
! pcshipcount = %pcshipcount% + 1
ENDIF

IF pcshipcount = 1
color green
Say 10 You've destroyed 1 ship so far.
goto grid //This was bugged. Thanks to Salzy for finding it.
endif
//ELSE
color green
Say 10 You've destroyed %pcshipcount% ships so far.

////////
//GRID//
////////
@grid

skipline
COLOR Blue
SAY 1 X 1 2 3 4 5
SAY 1 Y--------------------
color white
SAY 1 1|%mark11%||%mark21%||%mark31%||%mark41%||%mark51%|
color blue
SAY 1 ---------------------
color white
SAY 1 2|%mark12%||%mark22%||%mark32%||%mark42%||%mark52%|
color blue
SAY 1 ---------------------
color white
SAY 1 3|%mark13%||%mark23%||%mark33%||%mark43%||%mark53%|
color blue
SAY 1 ---------------------
color white
SAY 1 4|%mark14%||%mark24%||%mark34%||%mark44%||%mark54%|
color blue
SAY 1 ---------------------
color white
SAY 1 5|%mark15%||%mark25%||%mark35%||%mark45%||%mark55%|
color blue
SAY 1 ---------------------
skipline


@xshoot
skipline
color white
say 10 To quit type QUIT
INPUT shotx Which X coordinate should we fire at?

//Error check
IF shotx = Quit
goto quit
endif

IF shotx > 5
say 10 Oops. Stay under 6.
goto xshoot
ENDIF

IF shotx < 1
say 10 Oops. Stay over 0.
goto xshoot
ENDIF

@yshoot
INPUT shoty Which Y coordinate should we fire at?

//Error check
IF shoty > 5
say 10 Oops. Stay under 6.
goto yshoot
ENDIF

IF shoty < 1
say 10 Oops. Stay over 0.
goto yshoot
ENDIF

//hit check
IF mark%shotx%%shoty% = X
SAY 10 You've already fired there.
skipline
goto grid
ENDIF

! mark%shotx%%shoty% = X

IF shotx = PCfrigatex
IF shoty = PCfrigatey
skipline
color green
SAY 10 You hit my frigate.
FREE PCfrigatex
FREE PCfrigatey
! PCfrigatehit = 1
! mark%shotx%%shoty% = H
skipline
goto PCGO
ENDIF

IF shotx = PCbattleshipx
IF shoty = PCbattleshipy
skipline
color green
SAY 10 You sunk my BattleShip.
FREE PCbattleshipx
FREE PCbattleshipy
! PCbattleshiphit = 1
! mark%shotx%%shoty% = H
skipline
goto PCGO
ENDIF

IF shotx = PCdestroyerX
IF shoty = PCdestroyery
skipline
color green
SAY 10 You destroyed my destoryer.
skipline
FREE PCdestroyerX
FREE PCdestroyery
! PCdestroyerhit = 1
! mark%shotx%%shoty% = H
goto PCGO
skipline
ENDIF

IF shotx = PCdestroyer2X
IF shoty = PCdestroyer2y
skipline
color green
SAY 10 You destroyed my other destroyer.
FREE PCdestroyer2X
FREE PCdestroyer2y
! PCdestroyer2hit = 1
! mark%shotx%%shoty% = H
skipline
goto PCGO
ENDIF

IF shotx = PCsubx
IF shoty = PCsuby
skipline
color green
SAY 10 You nuked my Submarine.
FREE PCsubx
FREE PCsuby
! PCsubhit = 1
! mark%shotx%%shoty% = H
skipline
goto PCGO
ENDIF

//ELSE
color blue
say 10 You missed :P

///////////
//PC Turn//
///////////

@PCGO

//Run check if PC still in

IF PCfrigatehit = 1
IF PCbattleshiphit = 1
IF PCdestroyerhit = 1
IF PCdestroyer2hit = 1
IF PCsubhit = 1
skipline
color green
SAY 10 CONGRATULATIONS!!!
SAY 10 You won!!!
skipline
PAUSE
skipline
goto menu
ENDIF

color blue
skipline
SAY 10 My go.....

rndint 5
! pcshotx = %rndint% + 1
rndint 5
! pcshoty = %rndint% + 1

//pcshot check

! pcaction = missed

IF pcshotx = frigatex
IF pcshoty = frigatey
skipline
color green
! PCAction = hit your frigate
FREE frigatex
FREE frigatey
! frigatehit = 1
skipline
ENDIF

IF pcshotx = battleshipx
IF pcshoty = battleshipy
skipline
color green
! PCAction = sunk your Battle Ship
FREE battleshipx
FREE battleshipy
! battleshiphit = 1
skipline
ENDIF

IF pcshotx = destroyerX
IF pcshoty = destroyery
skipline
color green
! PCAction = destroyed you destroyer
FREE destroyerX
FREE destroyery
! destroyerhit = 1
skipline
ENDIF

IF pcshotx = destroyer2x
IF pcshoty = destroyer2y
skipline
color green
! PCAction = destroyed you other destroyer
FREE destroyer2x
FREE destroyer2y
! destroyer2hit = 1
skipline
ENDIF

IF pcshotx = subx
IF pcshoty = suby
skipline
color green
! PCAction = sunk your sub
FREE subx
FREE suby
! subhit = 1
skipline
ENDIF

color blue
wait 1000
skipline
say 10 I shot %pcshotx%, %pcshoty% and %pcaction%.
goto shoot

////////
//Quit//
////////

@quit
CLS
color blue
say 10 Thank you for playing
color orange
say 10 OmniSoft BattleShips
skipline
color blue
say 10 Visit us on the web at
color green
say 10 http://clix.to/omnisoft
skipline
color White
SAY 10 Please tell all your friends about us!
skipline
SAY 10 This script is freeware, feel free to post
SAY 10 an un-edited version of it on any form of
SAY 10 electronic distribution system (BBS, FIDO,
SAY 10 e-mail etc.)
skipline

////////////////////////
//Release of variables//
////////////////////////

free menuchoice
free PCAction
free shipcount
free PCshipcount

//shot variables
free shotx
free shoty
free pcshotx
free pcshoty

////////////
//PC ships//
////////////

//PC Ships X
free PCfrigatex
free PCbattleshipx
free PCdestroyerX
free PCdestroyer2x
free PCsubx

//PC Ships y
free PCfrigatey
free PCbattleshipy
free PCdestroyery
free PCdestroyer2y
free PCsuby

//PC Ships Hit?
free PCfrigatehit
free PCbattleshiphit
free PCdestroyerhit
free PCdestroyer2hit
free PCsubhit

////////////////
//Player Ships//
////////////////

//Player ships X
free frigatex
free battleshipx
free destroyerX
free destroyer2x
free subx

//Player Ships y
free frigatey
free battleshipy
free destroyery
free destroyer2y
free suby

//Player Ships Hit?
free frigatehit
free battleshiphit
free destroyerhit
free destroyer2hit
free subhit

//Grid Variables

free mark11
free mark12
free mark13
free mark14
free mark15

free mark21
free mark22
free mark23
free mark24
free mark25

free mark31
free mark32
free mark33
free mark34
free mark35

free mark41
free mark42
free mark43
free mark44
free mark45

free mark51
free mark52
free mark53
free mark54
free mark55


// Return all original values
color 4
bgcolor 5
color %getcolor%
bgcolor %getbgcolor%

//Quit
END

STATS

Website (C) Omnicron Software 2003
Dark Signs is (c) Terminal Zero

1