Author Topic: [Scripts] Help Needed: a script that can detect a specified block  (Read 522 times)

0 Members and 1 Guest are viewing this topic.

Rock

  • Elite Member
  • *****
  • Posts: 819
  • rock
  • Awards 3 years on site 1 year on site Was in the top 10 of the forum stats page as of 4/12/15 Former MotM winners
    • View Profile
    • Awards
  • Xbox: extremely thick
  • PSN: extremely moist
  • Steam: at your service
[Scripts] Help Needed: a script that can detect a specified block
« on: February 28, 2018, 07:04:17 PM »
I made a mod request topic about this (a mod that would sort of do what this script I am requesting would do) and someone did respond to that topic with a link for learning CS which is nice and if it comes down to it, I'll turn to that link.  Before I do that I wanted to see if there was an easier way first.  I wanted to know if I could make a script in-game that detects for every "NPC spawn block" in my world and for each NPC spawn block is detects it'll place a particle emitter underneath the NPC spawn block which will make a large particle that beams into the sky so I can find my NPC spawn blocks.

Anyone know how to do this?
hi

Craig

  • Developer
  • Extreme Member
  • ******
  • Posts: 6650
  • Dig Deep
  • Awards Developer 5 years on site 4 years on site 3 years on site 2 years on site Was in the top 10 of the forum stats page as of 4/12/15 Members who have unlocked the robotic avatar 1 year on site Day 1 w/25+ posts (4/12/13)
    • View Profile
    • Twitter
    • Awards
  • Steam: tota1miner
Re: Help Needed: a script that can detect a specified block
« Reply #1 on: February 28, 2018, 09:37:21 PM »
I'm not sure how practical it would be with scripts.

An entire map is 1024x1024x512 blocks = 536 million blocks.
Testing each block in a loop, including script latency is going to take probably 2 millisecs per block = 1 billion ms = 1 million secs = 280 hours.

There are some optimizations you could do such as testing several blocks per loop, and only testing a smaller vertical band on the map (say sea level +-50 blocks) but it's still going to take hours.

Fuertey

  • Elite Member
  • *****
  • Posts: 862
  • Keyboard not found. Press F1 to continue.
  • Awards Awarded to exemplary forum members 2 years on site 4 years on site 3 years on site 1 year on site
    • View Profile
    • Awards
  • Xbox: Fuertey
  • Steam: Fuertey
Re: Help Needed: a script that can detect a specified block
« Reply #2 on: February 28, 2018, 10:18:21 PM »
You could do it manually in regions of 500,000 and use replace npcblock with say, cherry metal to help you locate where they are/were then replace them with npc blocks and write down the co-ordinates so you know in future. You'd still need to do this 1,072 times.

That's if they could be at all levels though.

If all your npc blocks are at surface level or -/+ 3 blocks then this would be reduced to 4 or 28 times respectively.

Rock

  • Elite Member
  • *****
  • Posts: 819
  • rock
  • Awards 3 years on site 1 year on site Was in the top 10 of the forum stats page as of 4/12/15 Former MotM winners
    • View Profile
    • Awards
  • Xbox: extremely thick
  • PSN: extremely moist
  • Steam: at your service
Re: Help Needed: a script that can detect a specified block
« Reply #3 on: March 01, 2018, 04:37:04 PM »
I'm not sure how practical it would be with scripts.

An entire map is 1024x1024x512 blocks = 536 million blocks.
Testing each block in a loop, including script latency is going to take probably 2 millisecs per block = 1 billion ms = 1 million secs = 280 hours.

There are some optimizations you could do such as testing several blocks per loop, and only testing a smaller vertical band on the map (say sea level +-50 blocks) but it's still going to take hours.
Gotcha.

You could do it manually in regions of 500,000 and use replace npcblock with say, cherry metal to help you locate where they are/were then replace them with npc blocks and write down the co-ordinates so you know in future. You'd still need to do this 1,072 times.

That's if they could be at all levels though.

If all your npc blocks are at surface level or -/+ 3 blocks then this would be reduced to 4 or 28 times respectively.
Thank you!  I'll try this. Hopefully it works even though my npc blocks are underground (I'll have to replace npc spawns with air or invisible blocks)
hi