Dragon-Based Timer Game

By Arigateaux on Aug 15, 2010

This is a dragon-based timer-style game for mIRC mostly based on DragonScript created by Brownjam0.

/server -m irc.swiftirc.net -j #msl and look for me, evilMonkey, if you have any questions.

on *:start:{
  $iif(!$isdir(Dragon),mkdir Dragon,halt)
  .auser -a 10 $address($me,2) $me $+ :10
}

;#####################
;ALIASES
;#####################

alias -l pDir { return Dragon\players.ini }

alias -l pFile { return $ini($pDir,$1) }

alias -l pDragon {
  if $prop = name { return $ini(dragon\players.ini,$ini($pDir,$1)) }
  if $prop = age { return $readini($pDir,$1,age) }
  if $prop = lvl { return $readini($pDir,$1,lvl) }
  if $prop = tolvl { return $calc($lvlUp($1).check - $readini($pDir,$1,exp)) }
  if $prop = exp { return $readini($pDir,$1,exp) }
  else return $readini($pDir,$1,dragon)
}

alias -l lvlUp {
  var %exp = $floor($calc(80 * (1 + $readini($pDir,$1,lvl)) ^ 2.35))
  var %lvl = $floor($calc(($readini($pDir,$1,exp)/80)^(1/2.35))))
  if $prop = check { return %exp }
  if $prop = exp { return %lvl }
  if $pDragon($1).exp >= %exp {
    writeini -n $pDir $1 lvl %lvl
    if $pDragon($1).lvl >= 0 { writeini -n $pDir $1 age Hatchling }
    if $pDragon($1).lvl >= 15 { writeini -n $pDir $1 age Dragonet }
    if $pDragon($1).lvl >= 30 { writeini -n $pDir $1 age Juvenile }
    if $pDragon($1).lvl >= 60 { writeini -n $pDir $1 age Adolescent }
    if $pDragon($1).lvl >= 90 { writeini -n $pDir $1 age Adult }
    if $pDragon($1).lvl >= 150 { writeini -n $pDir $1 age Elder }
    .notice $1 7(14Level Up7) $1 14has leveled up!7 $1 14 $+ 's $pDragon($1) 14dragon is now a 7Lv. $+ $bytes($pDragon($1).lvl,b) $pDragon($1).age $+ 14!
  }
}

alias -l hs { 
  var %p = Dragon\players.ini
  .window -c @hs
  .window -h @hs
  var %x = $ini(%p,0)
  while (%x) {
    var %y = $ini(%p,%x)
    aline @hs $+(%y,=,$readini(%p,%y,$2))
    dec %x
  }
  .filter -wwctue 2 61 @hs @hs *=*
  if $prop = score { return $gettok($line(@hs,$fline(@hs,$1 $+ =*)),2,61) }
  if $prop = total { return $line(@hs,0) }
  if $prop = name { return $gettok($line(@hs,$1),1,61) }
  if $prop = xscore { return $gettok($line(@hs,$1),2,61) }
  ;if $prop = rank { return $gettok($line(@hs,$2)) }
  return $fline(@hs,$1 $+ =*)
}

;#####################
;ADMIN
;#####################

on $*:text:/^[\`!@.]admin*/Si:#:{
  var %msg = $iif($left($1,1) = @,.msg #,.notice $nick)
  var %nick = $nick(#,$nick(#,$3))
  if !$2 { %msg 7(14Admin7) 14Commands are: 7enable14, 7disable14, 7set14, 7xp | halt }
  if $2 = $gettok($ulist($address($2,2)).info,1,58) { %msg 7(14Admin7) $nick(#,$nick(#,$2)) 14is a7 Lv. $+ $gettok($ulist($address($2,2)).info,2,58) 14admin. | halt }
  if $regex($2,/(dis|en)able/Si) {
    var %group = dragon,bite,dquest,burn,hunt,explore,fight,rank
    if !$3 { %msg 7(14Admin7) 14Groups are:7 $replace(%group,$chr(44),$+(14,$chr(44),7,$chr(32))) $+ 14. | halt }
    if $istok(%group,$3,44) {
      $2 $+($chr(35),$3) $iif($2 = enable,on,off)
      %msg 7(14Admin7) $3 14has been $iif($2 = enable,turned on,shut off) by7 $nick $+ 14.
    }
  }
  elseif $ini($pDir,$3) && $3 !isnum {
    if $2 = set && $4 isnum {
      if $ulevel = 10 {
        if $ulevel > $4 && $address($nick,2) != $address($me,2) { %msg 7(14Error7) 14Only the bot owner can downgrade. | halt }
        if $4 >= 10 && $address($nick,2) != $address($me,2) { %msg 7(14Error7) 14Only the bot owner can add that high. | halt }
        .ruser $address($3,2)
        .auser -a $4 $address($3,2) $nick $+ : $+ $4
        %msg 7(14Admin7) 14Successfully added7 %nick 14as7 Lv. $+ $4 14admin.
      }
      else %msg 7(14Error7) $nick 14is a7 Lv. $+ $ulevel 14admin and cannot access that command.
    }
    if $regex($2,/(e|xp)/Si) && $4 isnum && $ulevel >= 5 {
      %msg 7(14Admin7) %nick $+ 14's XP has been successfully changed from7 $bytes($pDragon($3).exp,b) 14to7 $bytes($4,b) $+ 14.
      writeini -n $pDir $3 exp $floor($4)
      writeini -n $pDir $3 lvl 0
      writeini -n $pDir $3 age Hatchling
      lvlUp $3
    }
  }
  else %msg 7(14Error7) 14You must specify a player.
}

;#####################
;TRIGGERS
;#####################

#dragon on
on $*:text:/^[\`!@.]dragon/Si:#:{
  var %msg = $iif($left($1,1) = @,.msg #,.notice $nick)
  if !$pFile($nick) {
    var %dragon = 05Earth,14Air,04Fire,12Water,11Ice,13Poison,06Dark,14Light,10Ghost
    hmake $nick 1
    hadd $nick quest
    writeini -n $pDir $nick dragon $gettok(%dragon,$r(1,$numtok(%dragon,44)),44)
    writeini -n $pDir $nick age Hatchling
    writeini -n $pDir $nick exp 0
    writeini -n $pDir $nick lvl 0
    %msg 07(14Dragon07)14 $nick finds an abandoned 07(14Lv. $+ $pDragon($nick).lvl $+ 07)14 $pDragon($nick) Egg.
  }
  elseif $2 {
    lvlUp $2
    %msg 07(14Dragon07) $pDragon($2).name 14has a 07Lv. $+ $bytes($pDragon($2).lvl,b) $pDragon($2) $&
      07 $+ $pDragon($2).age $+ . 07(14 $+ $bytes($readini($pDir,$2,exp),b) $+ 07/14 $+ $bytes($lvlUp($2).check,b) 07XP) $&
      (14XP to Level:07 $bytes($pDragon($2).tolvl,b) $+ )  
  }
  else {
    lvlUp $nick
    %msg 07(14Dragon07) $pDragon($nick).name 14has a 07Lv. $+ $bytes($pDragon($nick).lvl,b) $pDragon($nick) $&
      07 $+ $pDragon($nick).age $+ . 07(14 $+ $bytes($readini($pDir,$nick,exp),b) $+ 07/14 $+ $bytes($lvlUp($nick).check,b) 07XP) $&
      (14XP to Level:07 $bytes($pDragon($nick).tolvl,b) $+ )
  }
}
#dragon end

#bite on
on $*:text:/^[`@!.]bite/Si:#:{
  var %msg = $iif($left($1,1) = @,.msg #,.notice $nick)
  var %exp = $r(10,99)
  if $pFile($nick) {
    if $hget($nick,bite) { %msg 07(14Error07) $nick 14cannot bite again for another07 $duration($hget($nick,bite)) $+ 14. | halt }
    hadd -mz $nick bite $r(30,180)
    %msg 07(14Bite07) $pDragon($nick).name 14sets out their $pDragon($nick) 07Dragon 14to bite07 a random person $&
      14and has gained07 %exp XP!
    .writeini -n $pDir $nick exp $calc($pDragon($nick).exp + %exp)
    lvlUp $nick
  }
}
#bite end

#dquest on
on $*:text:/^[`@!.]dquest/Si:#:{
  var %msg = $iif($left($1,1) = @,.msg #,.notice $nick)
  if !$hget($nick,quest) {
    var %quest.list = burn,hunt
    hadd -m $nick quest $gettok(%quest.list,$r(1,$numtok(%quest.list,44)),44)
    hadd -m $nick $hget($nick,quest) $r(3,7)
  }
  if $hget($nick,quest) = burn { %msg 07(14Quest07) $nick 14must burn down07 $hget($nick,burn) 14areas. }
  if $hget($nick,quest) = hunt { %msg 07(14Quest07) $nick 14must hunt07 $hget($nick,hunt) 14creatures. }
}
#dquest end

#hunt on
on $*:text:/^[`@!.]hunt/Si:#:{
  var %msg = $iif($left($1,1) = @,.msg #,.notice $nick)
  if $hget($nick,hunt) > 0 {
    if $hget($nick,hunt.timer) { %msg 07(14Error07) $nick 14cannot hunt again for another07 $duration($hget($nick,hunt.timer)) $+ 14. | halt }
    var %list = mouse,snake,deer,bobcat,wolf,moose,polar bear,grizzly bear
    var %hunt = $gettok(%list,$r(1,$numtok(%list,44)),44)
    var %exp = $calc($r(250,500) * (0.1 * $findtok(%list,%hunt,1,32) + 1) * 10)
    .writeini -n $pDir $nick exp $calc($pDragon($nick).exp + %exp)
    hdec $nick $hget($nick,quest)
    %msg 07(14Quest07)07 $nick $+ 14's 07Lv. $+ $pDragon($nick).lvl $pDragon($nick) 07 $+ $pDragon($nick).age 14has $&
      hunted down a07 %hunt 14and gains07 %exp XP14!
    lvlUp $nick
    if $hget($nick,$hget($nick,quest)) <= 0 { hdel $nick quest }
    hadd -mz $nick hunt.timer $r(30,90)
  }
  else %msg 07(14Error07) 14There is nothing left to hunt. 07[14.dquest07]
}
#hunt end

#burn on
on $*:text:/^[`@!.]burn/Si:#:{
  var %msg = $iif($left($1,1) = @,.msg #,.notice $nick)
  if $hget($nick,burn) > 0 {
    if $hget($nick,burn.timer) { %msg 07(14Error07) $nick 14cannot burn again for another07 $duration($hget($nick,burn.timer)) $+ 14. | halt }
    var %list = teepee,hut,cabin,cottage,house,villa,mansion,village,town,city
    var %burn = $gettok(%list,$r(1,$numtok(%list,44)),44)
    var %exp = $calc($r(250,500) * (0.1 * $findtok(%list,%burn,1,32) + 1) * 10)
    .writeini -n $pDir $nick exp $calc($pDragon($nick).exp + %exp)
    hdec $nick $hget($nick,quest)
    %msg 07(14Quest07)07 $nick $+ 14's 07Lv. $+ $pDragon($nick).lvl $pDragon($nick) 07 $+ $pDragon($nick).age 14has $&
      burned down a07 %burn 14and gains07 %exp XP14!
    lvlUp $nick
    if $hget($nick,$hget($nick,quest)) <= 0 { hdel $nick quest }
    hadd -mz $nick burn.timer $r(30,90)
  }
  else %msg 07(14Error07) 14There is nothing left to burn down. 07[14.dquest07]
}
#burn end

#fight on
on $*:text:/^[`@!.]fight*/Si:#:{
  var %msg = $iif($left($1,1) = @,.msg #,.notice $nick)
  if $hget($nick,fight.timer) { %msg 7(14Error7) $nick 14cannot fight for another7 $duration($hget($nick,fight.timer)) $+ 14. | halt }
  if $2 = $nick { %msg 7(14Error7) $nick 14cannot fight themself. | halt }
  if $2 && $ini($pDir,$2) {
    var %p1.lv = $pDragon($nick).lvl
    var %p2.lv = $pDragon($pDragon($2).name).lvl
    var %p1 = $calc($r(1,10) + %p1.lv))
    var %p2 = $calc($r(1,10) + %p2.lv))
    var %result = $iif(%p2 >= %p1,loses,wins)
    var %exp = $iif($calc(%p1.lv - %p2.lv) < 10,$calc(($r(500,2000) * (%p1.lv + %p2.lv) * 0.1)),0)
    if %result = wins { .writeini -n $pDir $nick exp $calc(%exp + $pDragon($nick).exp) }
    %msg 7(14Fight7) $nick 14challenges7 $pDragon($2).name 14to a duel and $iif(%result = wins,%result gaining7 $bytes(%exp,b) XP14!,%result $+ !)
    lvlUp $nick
    hadd -mz $nick fight.timer $r(300,600)
  }
  elseif !$2 { %msg 7(14Error7) $nick 14must specify a user. }
  else %msg 7(14Error7)14 There is no one by that name.
}
#fight end

#rank on
on $*:text:/^[`@!.]rank*/Si:#:{
  var %msg = $iif($left($1,1) = @,.msg #,.notice $nick)
  if $2 = $null {
    %msg 07(14Rank07) $nick 14is ranked07 $ord($hs($nick,exp)) 14of07 $hs($nick,exp).total 14players at $&
      7Lv. $+ $bytes($pDragon($nick).lvl,b) 14with07 $bytes($hs($nick,exp).score,b) XP14!
    halt
  }
  if $2 !isnum && $ini($pDir,$2) {
    %msg 07(14Rank07) $pDragon($2).name 14is ranked07 $ord($hs($2,exp)) 14of07 $hs($2,exp).total 14players at $&
      7Lv. $+ $bytes($pDragon($2).lvl,b) 14with07 $bytes($hs($2,exp).score,b) XP14!
    halt
  }
  if $2 > 0 && $2 isnum {
    %msg 07(14Rank07) $hs($2,exp).name 14is ranked07 $ord($2) 14of07 $hs($2,exp).total 14players at $&
      7Lv. $+ $bytes($pDragon($hs($2,exp).name).lvl,b) 14with07 $bytes($hs($2,exp).xscore,b) XP14!
    halt
  }
}
#rank end

Comments

Sign in to comment.
cutie-unit   -  Jan 17, 2011

I can't get this script to work. I loaded and changed the channel but nothing is working. help :(

 Respond  
Abcdefmonkey   -  Nov 15, 2010

Ooh. I remember this :P I actually liked playing it in #Wyvern :P I could've helped you out evilMonkey :P This is Blunt btw from #PartyRoom :P

 Respond  
GuitarMasterx7   -  Oct 28, 2010

The Snippet within the original bot is in open BETA
so hit us up on
/server -m irc.swiftirc.net -j #dragonrage

Bot Now in OPEN BETA for testing purposes. If there are any issues, please contact an Op @ for help. :: [Commands]: !dragon, !bite, !burn, !dhunt, !timers, !fight, !explore ::

i haven't been on to be testing/helping out for i am
a bit busy with school work an after school activities.

and on that note, srry evil for
abandoning you with out notice on the project.
everything seems to be cming out great ;]
but how have you been ;D

 Respond  
cutiechan   -  Aug 25, 2010

Can we get a !top10 soon?

 Respond  
Arigateaux   -  Aug 22, 2010

henrique.v.oliveira: reload the new script and it should auto make you admin.

cutiechan: I wasn't really planning on updating the bot that much, because it's meant to be a bare-bone bot for people to edit/add their own stuff to. =) I may add a few new features once I finish them, but that's about it.

 Respond  
cutiechan   -  Aug 21, 2010

Update please :P

 Respond  
henrique.v.oliveira   -  Aug 18, 2010

sorry for the noob question...how do i set up admins? :x
im with some problems , i did !admin enable dragon, but the command dont work =p idk, explain how do it works for me? XD

 Respond  
Arigateaux   -  Aug 16, 2010

Anthos, this is just the bare bones of the game, and I'm still working on more. I dunno if I will add more to the script, but this is like a small working part of the game.

cutiechan, I had considered a top 10, and I may still add it, but for now, it's just a cosmetic thing to me. Also, the reason it was set that way was because I had the bot in separate chans, but thanks for the note. I meant to make this as clean as possible for people to use. =)

 Respond  
cutiechan   -  Aug 16, 2010

Well done

But idk why you would specify it for just one channel. Remove the #wyvern and replace it with # if you want it to work on every channel.

Top 10 ranking would be nice too :P

 Respond  
Anthos   -  Aug 15, 2010

not bad but you might want to include a handy trigger for the commands and i take it from looking at the admin part that this isnt the full game as there isnt an explore part of the game, also it might be nice if there was a reward for compleating the quests

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.