mIRC Home    About    Download    Register    News    Help

Print Thread
#172469 10/03/07 06:40 PM
Joined: Feb 2007
Posts: 91
S
spermis Offline OP
Babel fish
OP Offline
Babel fish
S
Joined: Feb 2007
Posts: 91
Could someone make game script. Works like this

User types
!story There was a small boy
User2 types
!story who was 11 years old
User
!story he was going to school
User3
!story When he saw a big tree

So when someone types !story Text ir writes to file word Text. User cant type !story twice in a row. He have to wait until someone else types !story Text and then he can continue story. When the story command was typed 100 times it shows Saved to story1.txt , next time when story is full it shows Saved to story2.txt etc. Only user with @ can start story by typing !start story 100 - then it starts story with max times typed !story 100 if !start story 500 then max times ir 500

spermis #172479 10/03/07 10:29 PM
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Try this:

Code:
on *:text:!story *:#: {
  if ($nick isop $chan && $2 isnum && !$3) {
    if (%StoryStatus == On) { .notice $nick There is already an active story. | return }
    msg $chan Starting Story ( $+ $2 lines)...
    set %StoryLines $2
    if (!$isdir(Stories)) { mkdir Stories }
    var %cnt = 1
    while ($isfile($+(Stories\story,%cnt,.txt))) {
      inc %cnt
    }
    set %StoryFilename $+(Stories\story,%cnt,.txt)
  }
  elseif (%StoryStatus == On) {
    if (!%StoryFilename) { msg $chan Error writing story.  Ask an op to start a new story. | return }
    if (%StoryLastNick == $nick) { msg $chan Please wait for someone else to add to the story before you do so again. | return }
    set %StoryLastNick $nick
    write %StoryFilename $2-
    if ($lines(%StoryFilename) >= %StoryLines) {
      msg $chan Saved story to %StoryFilename
      unset %StoryFilename %StoryStatus %StoryLastNick %StoryLines
    }
  }
}

on *:text:!status:#: {
  if (%StoryStatus == On) {
    msg $chan Story is active: $lines(%StoryFilename) $+ / $+ %StoryLines lines completed.
  }
  else msg $chan No active story.
}


Note that I added a !status command if you want to use it to see how the story is coming along. **These commands do not work from the client running the script.


Invision Support
#Invision on irc.irchighway.net
Riamus2 #172499 11/03/07 01:55 PM
Joined: Feb 2007
Posts: 91
S
spermis Offline OP
Babel fish
OP Offline
Babel fish
S
Joined: Feb 2007
Posts: 91
[15:56:00] <spermer_co> !story 5
[15:56:00] <spermiits> Starting Story (5 lines)...
[15:56:01] <spermer_co> !status
[15:56:01] <spermiits> No active story.

Last edited by spermis; 11/03/07 01:56 PM.
spermis #172526 11/03/07 05:04 PM
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Oops. Forgot to set the status to On when it was started. Here you go:

Code:
on *:text:!story *:#: {
  if ($nick isop $chan && $2 isnum && !$3) {
    if (%StoryStatus == On) { .notice $nick There is already an active story. | return }
    msg $chan Starting Story ( $+ $2 lines)...
    inc %StoryNumber
    set %StoryStatus On
    set %StoryLines $2
    if (!$isdir(Stories)) { mkdir Stories }
    var %cnt = %StoryNumber
    while ($isfile($+(Stories\story,%cnt,.txt))) {
      inc %cnt
    }
    set %StoryFilename $+(Stories\story,%cnt,.txt)
  }
  elseif (%StoryStatus == On) {
    if (!%StoryFilename) { msg $chan Error writing story.  Ask an op to start a new story. | return }
    if (%StoryLastNick == $nick) { msg $chan Please wait for someone else to add to the story before you do so again. | return }
    set %StoryLastNick $nick
    write %StoryFilename $2-
    if ($lines(%StoryFilename) >= %StoryLines) {
      msg $chan Saved story to %StoryFilename
      unset %StoryFilename %StoryStatus %StoryLastNick %StoryLines
    }
  }
}

on *:text:!status:#: {
  if (%StoryStatus == On) {
    msg $chan Story is active: $lines(%StoryFilename) $+ / $+ %StoryLines lines completed.
  }
  else msg $chan No active story.
}


EDIT: I also improved a bit of it.

Last edited by Riamus2; 11/03/07 05:27 PM.

Invision Support
#Invision on irc.irchighway.net
Riamus2 #172745 14/03/07 11:06 PM
Joined: Nov 2006
Posts: 9
L
Nutrimatic drinks dispenser
Offline
Nutrimatic drinks dispenser
L
Joined: Nov 2006
Posts: 9
I was planning on using:
on *:TEXT:!read:#: {
/play $chan %storyfilename

to read teh story, and that works alright, but the way the script is setup it writes each 3 word block on a new line, so its kind of cumbersome to present/read. Is there an easy way to make it into a paragraph?


Nooblets Unite :P
Lucan #172755 15/03/07 03:15 AM
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Try this:

Code:
on *:text:!story *:#: {
  if ($nick isop $chan && $2 isnum && !$3) {
    if (%StoryStatus == On) { .notice $nick There is already an active story. | return }
    msg $chan Starting Story ( $+ $2 lines)...
    inc %StoryNumber
    set %StoryStatus On
    set %StoryLines $2
    if (!$isdir(Stories)) { mkdir Stories }
    var %cnt = %StoryNumber
    while ($isfile($+(Stories\story,%cnt,.txt))) {
      inc %cnt
    }
    set %StoryFilename $+(Stories\story,%cnt,.txt)
  }
  elseif (%StoryStatus == On) {
    if (!%StoryFilename) { msg $chan Error writing story.  Ask an op to start a new story. | return }
    if (%StoryLastNick == $nick) { msg $chan Please wait for someone else to add to the story before you do so again. | return }
    set %StoryLastNick $nick
    write %StoryFilename $2-
    if ($lines(%StoryFilename) >= %StoryLines) {
      msg $chan Saved story to %StoryFilename
      unset %StoryFilename %StoryStatus %StoryLastNick %StoryLines
    }
  }
}

on *:text:!status:#: {
  if (%StoryStatus == On) {
    msg $chan Story is active: $lines(%StoryFilename) $+ / $+ %StoryLines lines completed.
  }
  else msg $chan No active story.
}

on *:text:!read &:#: {
  if (.txt !isin $2) { set %storyname $2 $+ .txt }
  else set %storyname $2
  if ($isfile(Stories\ $+ %storyname)) {
    play -a PlayStory $chan Stories\ $+ %storyname 500
  }
  else msg $chan Invalid Filename: $2
}

alias PlayStory {
  inc %StoryLineCnt
  if ($calc($len(%StoryLine) + $len($2-)) < 400) {
    set %StoryLine %StoryLine $2-
  }
  elseif ($len(%StoryLine) == 0 && $len($2-) >= 400) {
    msg $1 $2-
  }
  else {
    msg $1 %StoryLine
    set %StoryLine $2-
  }
  if (%StoryLineCnt >= $lines(Stories\ $+ %storyname)) {
    if (%StoryLine) { msg $1 %StoryLine }
    unset %StoryLine %StoryLineCnt %storyname
  }
}


That will combine the lines for you. You may want to adjust the "500" in the /play command so that it goes faster or slower depending on how long the lines are... if the lines are always 100+ characters, you probably want it around 300-500. If they are always around 20-40 characters, you probably want it around 100-200. Just play around with it a bit to see what works.

Also, the "400" used in the < and >= comparisons is the number of characters allowed per line in your channel. You can raise or lower that to whatever it acceptable on your network as it varies.


Invision Support
#Invision on irc.irchighway.net
Riamus2 #172818 16/03/07 03:30 PM
Joined: Nov 2006
Posts: 9
L
Nutrimatic drinks dispenser
Offline
Nutrimatic drinks dispenser
L
Joined: Nov 2006
Posts: 9
Thanks Riamus2, thats great laugh


Nooblets Unite :P
Lucan #172833 16/03/07 11:09 PM
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
You could do a similar thing when writing the lines and then just play it normally, but I didn't feel like redoing that part. It would probably be "smoother" when playing it back, though.


Invision Support
#Invision on irc.irchighway.net

Link Copied to Clipboard