I finally finished the shell for the Gangster Bot Purcell had asked for. I've added a few little snippets in there for easy addition of items. You are free to use this bot as you wish, but please give credit where credit is due. This was created from scratch, 100% by me.
Enjoy.
on *:load:{
.write gangster.txt 0
}
on *:connect:{
var %x 0
var %y $read(gangster.txt,-1)
while %x < %y {
hload -si $gettok($read(gangster.txt,%y),1,32) gangster.ini $gettok($read(gangster.txt,%y),1,32)
inc %x
}
}
on *:text:.gangster*:?:{
if !$2 || !$3 || $2 !isalnum || $3 !isalnum {
.notice $nick .gangster <name> <password>
}
if $gettok($read(gangster.txt,w,$2),2,32) !== $null {
.msg # That name has been taken.
halt
}
else {
hmake $nick
hadd $nick name $2
hadd $nick pass $3
hadd $nick cash 1000
hadd $nick atk 5
hadd $nick def 5
hadd $nick atk_mod 0
hadd $nick def_mod 0
hadd $nick points 0
hadd $nick level 1
hsave -i $nick gangster.ini $hget($nick,name)
write -l1 gangster.txt $calc($read(gangster.txt,-1) + 1)
write gangster.txt $nick $2
.msg # Welcome to Gangsters, $2 $+($chr(40),$nick,$chr(41))
.notice $nick Type .help for a list of commands.
stats
}
}
on *:text:.crime*:#:{
if !$hget($nick) {
.notice $nick .gangster <name> <password>
halt
}
if $hget($nick,jail) {
.notice $nick You cannot do that while in jail.
halt
}
else {
if !$2 {
.notice $nick Crimes: mug; carjack;
}
if $2 = mug {
if !$hfind($nick,mugging) {
var %x $rand(100,300)
var %cash $calc($hget($nick,cash) + %x)
hadd $nick cash %cash
hadd -z $nick mugging 60
.msg # $hget($nick,name) mugs an unsuspecting pedestrian for $+($chr(36),$bytes(%x,b),.)
.notice $nick Total Cash: $+($chr(36),$bytes($hget($nick,cash),b))
}
else {
.notice $nick You have to wait $+($duration($hget($nick,mugging),3),.)
halt
}
}
if $2 = carjack {
if !$hfind($nick,carjack) {
var %x $rand(0,100)
if %x <= 20 {
.msg # $hget($nick,name) finds an unlocked car. They proceed to hotwire the car and drive away.
.notice $nick You have obtained 1 car.
hadd $nick cars $calc($hget($nick,cars) + 1)
var %carjack $rand(60,180)
hadd -z $nick carjack %carjack
}
if %x > 20 && %x <= 50 {
var %jail.time $rand(60,300)
.msg # $hget($nick,name) was caught trying to steal a car and is sent to jail for $+($duration(%jail.time,3),.)
hadd -z $nick jail %jail.time
var %carjack $rand(60,180)
hadd -z $nick carjack %carjack
}
if %x > 50 && %x <= 100 {
var %cash $rand(500,2000)
.msg # $hget($nick,name) finds a car and breaks into it. Taking it to a local chop shop, $hget($nick,name) gets $+($chr(36),$bytes(%cash,b),.)
hadd $nick cash $calc($hget($nick,cash) + %cash)
var %carjack $rand(60,180)
hadd -z $nick carjack %carjack
.notice $nick Total cash: $+($chr(36),$bytes($hget($nick,cash),b))
}
hsave -i $nick gangster.ini $hget($nick,name)
}
else {
.notice $nick You have to wait $+($duration($hget($nick,carjack),3),.)
halt
}
}
}
}
on *:text:.buy*:#:{
if !$hget($nick) {
.notice $nick .gangster <name> <password>
halt
}
if $hget($nick,jail) {
.notice $nick You cannot do that while in jail.
halt
}
else {
if !$2 {
;//Edit these to your liking.
.notice $nick Shops: Armor; Weapon; Car;
halt
}
if $2 = armor {
;//ITEM_NAME [ITEM_HASH] PRICE
;//I did it this way so you can show what the item is, and have something
;//to put in the hash table without spamming it.
.notice $nick Armors: Bulletproof Vest [bpvest] $+($chr(36),500,;)
}
if $2 = weapon {
.notice $nick Weapons: Machette [machette] $+($chr(36),500,;) - Glock [glock] $+($chr(36),750,;)
}
if $2 = car {
.notice $nick Cars: Rolls Royce [rolls] $+($chr(36),$bytes(10000,b),;)
}
if $2 !isnum {
.notice $nick .buy <num> <item>
halt
}
/*
This is the template you can use to make new items.
Just change anything that says CHANGE_ME.
if $2 isnum && $3 = CHANGE_ME {
var %cash $calc($2 * CHANGE_ME)
if $hget($nick,cash) >= %cash {
hadd $nick cash $calc($hget($nick,cash) - %cash)
hadd $nick CHANGE_ME $calc($hget($nick,CHANGE_ME) + $2)
hadd $nick def_mod $calc($hget($nick,def_mod) + (CHANGE_ME * $2))
hadd $nick atk_mod $calc($hget($nick,atk_mod) + (CHANGE_ME * $2))
.msg # $nick buys $2 CHANGE_ME.
}
}
*/
;########### ARMORS ###########
if $2 isnum && $3 = bpvest {
var %cash $calc($2 * 500)
if $hget($nick,cash) >= %cash {
hadd $nick cash $calc($hget($nick,cash) - %cash)
hadd $nick bp_vest $calc($hget($nick,bp_vest) + $2)
hadd $nick def_mod $calc($hget($nick,def_mod) + (2 * $2))
hadd $nick atk_mod $calc($hget($nick,atk_mod) + (1 * $2))
.msg # $nick buys $2 Bulletproof Vest.
}
}
;########### WEAPONS ###########
if $2 isnum && $3 = machette {
var %cash $calc($2 * 500)
if $hget($nick,cash) >= %cash {
hadd $nick cash $calc($hget($nick,cash) - %cash)
hadd $nick machette $calc($hget($nick,machette) + $2)
hadd $nick def_mod $calc($hget($nick,def_mod) + (1 * $2))
hadd $nick atk_mod $calc($hget($nick,atk_mod) + (3 * $2))
.msg # $nick buys $2 Machette.
}
}
if $2 isnum && $3 = glock {
var %cash $calc($2 * 750)
if $hget($nick,cash) >= %cash {
hadd $nick cash $calc($hget($nick,cash) - %cash)
hadd $nick glock $calc($hget($nick,glock) + $2)
hadd $nick def_mod $calc($hget($nick,def_mod) + (2 * $2))
hadd $nick atk_mod $calc($hget($nick,atk_mod) + (4 * $2))
.msg # $nick buys $2 Glock.
}
}
;########### CARS ###########
if $2 isnum && $3 = rolls {
var %cash $calc($2 * 10000)
if $hget($nick,cash) >= %cash {
hadd $nick cash $calc($hget($nick,cash) - %cash)
hadd $nick rolls $calc($hget($nick,rolls) + $2)
hadd $nick def_mod $calc($hget($nick,def_mod) + (10 * $2))
hadd $nick atk_mod $calc($hget($nick,atk_mod) + (13 * $2))
.msg # $nick buys $2 Rolls Royce.
}
}
;########### END ###########
hsave -i $nick gangster.ini $hget($nick,name)
}
}
on *:text:.attack*:#:{
if !$hget($nick) {
.notice $nick .gangster <name> <password>
halt
}
if $hget($nick,jail) {
.notice $nick You cannot do that while in jail.
halt
}
if $hget($nick,attack) {
halt
}
if !$2 || !$gettok($read(gangster.txt,w,$+(*,$2)),2,32) {
.notice $nick .attack <name>
halt
}
else {
var %def $gettok($read(gangster.txt,w,$+(*,$2)),1,32)
var %atk.calc $calc(($hget($nick,atk) * $hget($nick,def)) + ($hget($nick,atk_mod) * $hget($nick,def_mod)) + ($hget($nick,level) * 1.5)) * $+(1.,$rand(1,9)))
var %def.calc $calc((($hget(%def,atk) * $hget(%def,def)) + ($hget(%def,atk_mod) * $hget(%def,def_mod)) + ($hget(%def,level) * 1.5)) * $+(1.,$rand(1,9)))
hadd -z $nick attack 10
if %atk.calc > %def.calc {
var %a $hget(%def,cash)
var %b $floor($rand($calc(%a/2),%a))
hadd %def cash $calc($hget(%def,cash) - %b)
hadd $nick cash $calc($hget($nick,cash) + %b)
.msg # $hget($nick,name) defeats $hget(%def,name) in battle, stealing $+($chr(36),$bytes(%b,b),.)
}
else {
var %c $hget($nick,cash)
var %d $floor($rand($calc(%c/2),%c))
hadd $nick cash $calc($hget($nick,cash) - %d)
hadd %def cash $calc($hget(%def,cash) + %d)
.msg # $hget(%def,name) defeats $hget($nick,name) in battle, stealing $+($chr(36),$bytes(%d,b),.)
}
}
}
on *:text:.stats:#:{
if !$hget($nick) {
.notice $nick .gangster <name> <password>
halt
}
else {
stats
}
}
on *:text:.help:#:{
if !$2 {
.notice $nick .gangster; .crime; .buy; .stats;
}
}
alias stats {
.notice $nick [Level: $+($hget($nick,level),]) [Cash: $+($chr(36),$bytes($hget($nick,cash),b),]) $&
[Attack: $+($hget($nick,atk),]) [Defense: $+($hget($nick,def),]) [Points: $+($hget($nick,points),]) $&
[Attack Bonus: $+($hget($nick,atk_mod),]) [Defense Bonus: $+($hget($nick,def_mod),])
}
We have fully redeveloped this game in another language and it all works great!
Come and check it out: http://www.textgangsters.com
levelup update
on :text:.levelup:#:{
if !$hget($nick) {
.notice $nick .gangster
halt
}
if $hget($nick,jail) {
.notice $nick negali to daryt kol sedi kalejime.
halt
}
else {
if $2 !isnum {
.notice $nick .levelup level
.notice $nick lygio pakelimo kaina 100 tasku.
halt
}
;########### LEVELS ###########
if $2 isnum && $3 = level {
var %points $calc($2 * 100)
if $hget($nick,points) >= %points {
hadd $nick points $calc($hget($nick,points) - %points)
hadd $nick level $calc($hget($nick,level) + $2)
hadd $nick def $calc($hget($nick,def) + (5 * $2))
hadd $nick atk $calc($hget($nick,atk) + (5 * $2))
.msg # $nick pereina i kita lygi.
}
}
;########### END ###########
hsave -i $nick gangster.ini $hget($nick,name)
}
}
text in LT
points update for crime carjack
if %x > 20 && %x <= 50 {
var %jail.time $rand(60,300)
var %points $rand(1,5)
.msg # $hget($nick,name) buvo pagauta(s) bandant nuvarit masina ir pasodinta(s) i kalejima $+($duration(%jail.time,3),.)
hadd -z $nick jail %jail.time
hadd $nick points $calc($hget($nick,points) - %points)
var %carjack $rand(60,180)
hadd -z $nick carjack %carjack
.notice $nick tasku: $+($chr(36),$bytes($hget($nick,points),b))
}
if %x > 50 && %x <= 100 {
var %cash $rand(1000,5000)
var %points $rand(1,5)
.msg # $hget($nick,name) randa masina ir isilauzia i ja. nuvaro ja i vietine superktuve, $hget($nick,name) ir gauna $+($chr(36),$bytes(%cash,b),.)
hadd $nick cash $calc($hget($nick,cash) + %cash)
hadd $nick points $calc($hget($nick,points) + %points)
var %carjack $rand(60,180)
hadd -z $nick carjack %carjack
.notice $nick isviso grinu: $+($chr(36),$bytes($hget($nick,cash),b)) tasku: $+($chr(36),$bytes($hget($nick,points),b))
sorry, text in LT :)
has anyone any idea at all how to work this?
@kyle ... just load the script in u r BOT by pressing Alt+R and then type .help
dose nothing at all
neither dose
.gangster
what are the commands for this? isnt there a list of commands or some sort of help, how are ppl ment to know what to do? there are no dialogs so its difficult to know, and reading the code is jsut dam confusing
"I finally finished the shell for the Gangster Bot Purcell had asked for. I've added a few little snippets in there for easy addition of items. You are free to use this bot as you wish, but please give credit where credit is due. This was created from scratch, 100% by me."
? i think u forgot to exaplin how to play it ;)