Toribash
Prev Previous Post   Next Post Next
Original Post
TESRPG IRC script (cave mapping) (blame stonewall not me D:)
this is a quick mapping script i made and a description of how to use it
note; if you don't care that much don't bother reading, it's a long read xD

honestly i only really did this because i was so board, and it will probably only ever be of use with stonewall's character, and even then that might not be the case, but if he dose take over a cave then this will make my life alot easyer and i don't like keeping tools all to my self...


the code:
/map {
  %seek = 0
  set %read
  set %data
  set %mapline
  %n = 1
  set %thing
  %line = 0
  %end = 0
  %pos = 0
  %mstore

  if ($1 = 1) {
    %say = 1
  }
  else %say = 0

  %data = $?"Please enter map code."

  :Mrepeat
  if (%n < $calc($len(%data) + 1)) %read = $mid(%data,%n,1)
  MapProc
  inc %n
  if (%end = 0) {
    if (%n < $calc($len(%data) + 1)) goto Mrepeat
  }
}

/MapProc {
  if (%read === A) %seek = $calc(0 - %pos)
  elseif (%read === B) %seek = $calc(1 - %pos)
  elseif (%read === C) %seek = $calc(2 - %pos)
  elseif (%read === D) %seek = $calc(3 - %pos)
  elseif (%read === E) %seek = $calc(4 - %pos)
  elseif (%read === F) %seek = $calc(5 - %pos)
  elseif (%read === G) %seek = $calc(6 - %pos)
  elseif (%read === H) %seek = $calc(7 - %pos)
  elseif (%read === I) %seek = $calc(8 - %pos)
  elseif (%read === J) %seek = $calc(9 - %pos)
  elseif (%read === K) %seek = $calc(10 - %pos)
  elseif (%read === L) %seek = $calc(11 - %pos)
  elseif (%read === M) %seek = $calc(12 - %pos)
  elseif (%read === N) %seek = $calc(13 - %pos)
  elseif (%read === O) %seek = $calc(14 - %pos)
  elseif (%read === P) %seek = $calc(15 - %pos)
  elseif (%read === Q) %seek = $calc(16 - %pos)
  elseif (%read === R) %seek = $calc(17 - %pos)
  elseif (%read === S) %seek = $calc(18 - %pos)
  elseif (%read === T) %seek = $calc(19 - %pos)
  elseif (%read === U) %seek = $calc(20 - %pos)
  elseif (%read === V) %seek = $calc(21 - %pos)
  elseif (%read === W) %seek = $calc(22 - %pos)
  elseif (%read === X) %seek = $calc(23 - %pos)
  elseif (%read === Y) %seek = $calc(24 - %pos)
  elseif (%read === Z) %seek = $calc(25 - %pos)
  elseif (%read === 1) {
    set %thing 1,15*
    inc %pos
  }
  elseif (%read === 2) {
    set %thing 1,14*
    inc %pos
  }
  elseif (%read === 3) {
    set %thing 1,1*
    inc %pos
  }
  elseif (%read === 4) {
    set %thing 1,34
    inc %pos
  }
  elseif (%read === 5) {
    set %thing 1,105
    inc %pos
  }
  elseif (%read === 6) {
    set %thing 1,106
    inc %pos
  }
  elseif (%read === 7) {
    set %thing 1,107
    inc %pos
  }
  elseif (%read === 8) {
    set %thing 1,78
    inc %pos
  }
  elseif (%read === 9) {
    set %thing 1,79
    inc %pos
  }
  elseif (%read === |) %line = 1
  elseif (%read === \) %end = 1
  else {
    %thing = 4 INVALID ARG seek: $+ %seek $+ read: $+ %read $+ #
    %end = 1
  }

  if (%line != 1) {
    set %mapline %mapline $+ %thing
  }

  set %thing

  if (%seek != 0) seekRWhead
  if (%line != 0) VertSeek
}

/seekRWhead {
  if (%seek < 0) {
    echo INVALID SEEK- seek: $+ %seek $+ pos: $+ %pos
    %end = 1
  }
  %pos =  %pos + %seek
  if (seek > 0) {
    :repseek
    set %mapline %mapline $+ 0,0*
    dec %seek
    if (%seek > 0) goto repseek
  }
}

/VertSeek {
  %seek = $calc(26 - %pos)
  seekRWhead
  if (%say = 1) say # %mapline
  if (%say = 0) echo # %mapline
  set %mapline
  %line = 0
  %seek = 0
  %pos = 0
}


ok right, so the script is vastly long, it could easaly be shorter but i did this from 3 to 4 AM and i was ill so you will have to excuse my lazy programing, i wont really be explaining how the script it's self works so if you want to know how to do mirc scripting PM me it will be easyer, but here is how it turns plain text into maps:

basicaly, it has a seeker which is done through the letters A to Z, so 26 columns, to refernce one you would just put that letter, so lets say we want to start a cave at Q, so far we have Q, now we need an entrace, so at Q we will put an entrance, to put a spesific object or terrain type in a place, just type the corresponding number of that type, (this allso moves the seek on one, so putting a number directly affter will make that appear directly next to the first object. (seek gose left to right)) you can change these without editing the script they are up to you however 1 through 3 are allways the same...

1=hard to move terrain
2=easyer to move terrain
3=open terrain
4=entrace/exit
5=create
6=bed
7=chest
8=training dummie
9=book shelf

is what i will use for this, but remember you can edit 4 through to 9 for your own usage.

So, we put an entrance at Q, that gives us Q4 so far, now columns are all good and well but maps are 2D so we need rows, to go to the next row it is |. so we will here go to the next row; Q4|

now skipping just a little ahead, i'm going to do Q4|P131|, this will give us an entrance, then a small amount of terrain directly south of it (these maps are all birds eye view North up)

what this achtualy looks like is this;


(this is in MIRC : classic colour scheme)

not a huge amount, just an entrance and terrain, but here is the finished product affter i made this entire map:

Q4|P131|P232|P331|M2P11|L252P11|K2838211|K1333222| K2393312|K2111112|P131|P131|I36P23|F22236P13|E1G33 33P13|H23322P13|H223P31|B11H11Q2|B272H1111O223|B13 23332223O233|J23333336|J23311136|J23N133331|J22N23 3331|I232O2121|H1321|H131|C4111112|C411111|\

(note; the \ is the ending character however it isn't nessessary and is mostly there for while i was testing the scripts, however you do need an | at the end so that the last line is output.)

(note; when making an area that has 2 seperate sections on the same row, such as L252P11, all you need to do is put a new reference to the column and the code will pick this up and seek there, note that there is no 0 so you do this even if there is a single gap like in said case. you will also get an error if you seek backwards.)

final map output in mirc classic colour scheme:


and in my colour scheme:


so yea, there you have it, i'll probably have to do something like hit my self latter today when i wake up because 4AM programing and writing of threads normaly sucks but meh lets see what happens lol.


errors and what they mean:
everything looks (bleep)ed up for me! - this is probably a bad font, so change your font to something like Lucida Console.

INVALID ARG seek:xread:y (where x and y are numbers) This means your map script is (bleep)ed up and it read a character it can't interperate. (like a 0 or a space) the seek tells you where it (bleep)ed up and the read tells you what character it didn't understand.

INVALID SEEK-seek:xpos:y (where x and y are numbers) This means that it tried to seek backwards, you probably told it to seek to a lesser character than the one you are currently at, or forgot to put a new line.


useing the script:

K this is simple just type /map to use, then it will pop up asking for the MAP code, you put it in and the map pops out in /echo (read additional options)

Additional options:
if you type /map 1 then it will /say the map rather than /echo it.


Why this might be usefull to at least vox and maybe other GM's and people.

Stonewall wanted to own a cave and i needed a way to remember all the spesific details of a custom cave in plain text so i created this, it allows you to customise caves and such with what ever you like and edited there topography, the use of this will probably be mostly GM's and all most (if not) exclusively me at that i'm sure, but the plan is now stonewall can dig around in his cave, and add new things to it and i'm not taxed with memory.
Last edited by Vox; Oct 26, 2008 at 07:07 AM.