LED Wall Display: 0 - 99

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
trancelistic
Posts: 275
Joined: Sat Jun 16, 2012 5:32 am

Re: LED Wall Display: 0 - 99

Post by trancelistic »

Hey this is very awesome, Gives me some idea's. But i'm still a newby when it comes to scripting although my dungeon is coming along nicely with some neat tricks.

I have just very dumb question. How to add/sub the value of the number displayed?
Do I have to modify the script manually each time or can another script change the number displayed on the wall?.

Thanks in advanced.

ps: very awesome!
Darsithis
Posts: 51
Joined: Wed Jul 24, 2013 6:31 pm

Re: LED Wall Display: 0 - 99

Post by Darsithis »

Love it! I'm going to find a use for it in my newest dungeon
trancelistic
Posts: 275
Joined: Sat Jun 16, 2012 5:32 am

Re: LED Wall Display: 0 - 99

Post by trancelistic »

I do not get it. In play test mode I'm having no errors. But if I export the dungeon and then try to run it it gives an error on your led lights.
IS there something I must do?
trancelistic
Posts: 275
Joined: Sat Jun 16, 2012 5:32 am

Re: LED Wall Display: 0 - 99

Post by trancelistic »

trancelistic wrote:I do not get it. In play test mode I'm having no errors. But if I export the dungeon and then try to run it it gives an error on your led lights.
IS there something I must do?
NO 1 can help me out here?:( I love to use ur script:P
trancelistic
Posts: 275
Joined: Sat Jun 16, 2012 5:32 am

Re: LED Wall Display: 0 - 99

Post by trancelistic »

trancelistic wrote:
trancelistic wrote:I do not get it. In play test mode I'm having no errors. But if I export the dungeon and then try to run it it gives an error on your led lights.
IS there something I must do?
NO 1 can help me out here?:( I love to use ur script:P
Is this forum even alive?:P
User avatar
Isaac
Posts: 3185
Joined: Fri Mar 02, 2012 10:02 pm

Re: LED Wall Display: 0 - 99

Post by Isaac »

trancelistic wrote:
trancelistic wrote:
trancelistic wrote:I do not get it. In play test mode I'm having no errors. But if I export the dungeon and then try to run it it gives an error on your led lights.
IS there something I must do?
NO 1 can help me out here?:( I love to use ur script:P
Is this forum even alive?:P
There is a bit of a distraction today... LoG2 is out.
trancelistic
Posts: 275
Joined: Sat Jun 16, 2012 5:32 am

Re: LED Wall Display: 0 - 99

Post by trancelistic »

Meh.. I still wanna know.... Log2 is kinda over. ALot of people played it already.

IN a way I like log1 a.k dm1 style beter.
User avatar
Isaac
Posts: 3185
Joined: Fri Mar 02, 2012 10:02 pm

Re: LED Wall Display: 0 - 99

Post by Isaac »

trancelistic wrote:Meh.. I still wanna know.... Log2 is kinda over. ALot of people played it already.

IN a way I like log1 a.k dm1 style beter.
Have you checked the error log? (Text File in the AH documents folder.)
trancelistic
Posts: 275
Joined: Sat Jun 16, 2012 5:32 am

Re: LED Wall Display: 0 - 99

Post by trancelistic »

Isaac wrote:
trancelistic wrote:Meh.. I still wanna know.... Log2 is kinda over. ALot of people played it already.

IN a way I like log1 a.k dm1 style beter.
Have you checked the error log? (Text File in the AH documents folder.)
ABout my error?

Uhm how? Haha. still am a noob.
The game runs in the editor but refuse to run when in real game. ( so I though that is odd)
:(
SpoilerShow
script_entity_44: cannot serialize table with metatable
stack traceback:
[C]: in function 'error'
[string "ScriptEntity.lua"]: in function 'saveValue'
[string "ScriptEntity.lua"]: in function 'saveValue'
[string "ScriptEntity.lua"]: in function 'saveState'
[string "GameMode.lua"]: in function 'saveGame'
[string "GameMode.lua"]: in function 'autoSave'
[string "GameMode.lua"]: in function 'newGame'
[string "GameMode.lua"]: in function 'startGame'
[string "NewGameMenu.lua"]: in function 'startGame'
[string "NewGameMenu.lua"]: in function 'update'
[string "GameMode.lua"]: in function 'update'
[string "Grimrock.lua"]: in function 'display'
[string "Grimrock.lua"]: in main chunk

OS Version 6.1

OEM ID: 0
Number of processors: 6
Page size: 4096
Processor type: 586

Total memory: 8148 MB
Free memory: 4055 MB

Display device 0:
Device name: \\.\DISPLAY1
Device string: NVIDIA GeForce GTX 285
State flags: 00000005

Display device 1:
Device name: \\.\DISPLAY2
Device string: NVIDIA GeForce GTX 285
State flags: 00000000

Display device 2:
Device name: \\.\DISPLAYV1
Device string: RDPDD Chained DD
State flags: 00200008

Display device 3:
Device name: \\.\DISPLAYV2
Device string: RDP Encoder Mirror Driver
State flags: 00200008

Display device 4:
Device name: \\.\DISPLAYV3
Device string: RDP Reflector Display Driver
State flags: 00200008
this makes any sense? I honestly don't know;./ Please help. I like the led lights.

Edit the:
SpoilerShow
SpoilerShow
script_entity_44: cannot serialize table with metatable
stack traceback:
Doesn't matter each entity_X has its own number. Even having 1 entity in the entire game causes this error when compliling the dungeon. In the dungeon editor it does run.


Edit 2: Could you look at this please? Its a hidden video don't worry: I hope you will see my problem now. Thanks alot.
User avatar
Isaac
Posts: 3185
Joined: Fri Mar 02, 2012 10:02 pm

Re: LED Wall Display: 0 - 99

Post by Isaac »

Fixed. Image

Code: Select all

  ---[[
  ---------------------------------------------------------------------------------------
    ---  LED display:  version 1.4.1  10-10-2012     Written by Lark                    ---
    ---                                              Much thanks to:  Lmaoboat          ---
    ---------------------------------------------------------------------------------------

    ---
    ---  Light Parameters
    ---
    displayed = self.level       --the initial number displayed by the script
    wall = self.facing           --adjust wall used for display from script's facing; i.e. opposite = (self.facing + 2) % 4
    initallyOn = true            --specify if the light is initially on

    vertical_spacing = .17       --vertical LED spacing
    horizontal_spacing = .15     --horizontal LED spacing; center, left, & right values are based on this number being .15
    height = 3                   --height above the floor for the top row of LEDs
    center = -.3                 --start of row offset for single digit displays
    left = -.85                  --start of row offset for left digit
    right = .25                  --start of row offset for right digit

    ---  Usage:
    --- 
    ---  1.  drop this script into a square facing the wall where the display is desired (or adjust "wall" above)
    ---  2.  set parameters to suit:  displayed, wall, and initiallyOn for basic parameters
    ---  3.  on() to display the initial value
    ---  4.  off() to turn off lights
    ---  5.  add() to increment by one
    ---  6.  sub() to decrement by one
    ---  7.  display(number) to set the display to a new number
    ---  8.  do not call digit() directly

    ---
    ---  Create a LED panel for numbers 0 - 99.  LED grid is:
    ---

    --   00 01 02 03 04
    --   05 06 07 08 09
    --   10 11 12 13 14
    --   15 16 17 18 19
    --   20 21 22 23 24
    --   25 26 27 28 29
    --   30 31 32 33 34

    digits = 
	{
      {1,2,3,5,9,10,14,15,19,20,24,25,29,31,32,33},
      {6,2,7,12,17,22,27,31,32,33},
      {5,1,2,3,9,14,18,22,26,30,31,32,33,34},
      {5,1,2,3,9,14,18,17,16,24,29,33,32,31,25},
      {0,5,10,15,16,17,18,19,3,8,13,23,28,33},
      {4,3,2,1,0,5,10,15,16,17,18,24,29,33,32,31,30},
      {9,3,2,1,5,10,15,20,25,31,32,33,29,24,18,17,16},
      {5,0,1,2,3,4,9,14,18,22,27,32},
      {10,5,1,2,3,9,14,18,17,16,20,25,31,32,33,29,24},
      {25,31,32,33,29,24,19,14,9,3,2,1,5,10,16,17,18}
	}


    led = {nil}
    cos = math.cos(1.5707963267949 * wall)
    sin = math.sin(1.5707963267949 * wall)
    tz = 1.3

    ---
    ---  divide into digits and display in correct sector
    ---
    function display(number)
      if number == nil then return end
      local b = number % 10
      local a = (number - b) / 10
      off()

      if a > 0 then
        digit(a, left)
        digit(b, right)
      else
        digit(b, center)
        end
      displayed = number
      end

    ---
    ---  display a digit of the number at the given alignment and light set
    ---
    function digit(number, align)
		
		local dix = number + 1

      for ix = 1, 35 do
        local pix = digits[dix][ix]
    	
	  if pix == nil then return end
	 
        local tx = align + pix % 5 * horizontal_spacing
        lix = lix + 1

  -- Fixed ======[ You cannot serialize a table of objects; but you can with a table of names. ]===================================================
	     	led[lix] = spawn("fx", self.level, self.x, self.y, 3, self.id..lix).id
  		findEntity(led[lix]):setLight(1, 0, 0, 1500, 0.24, 360000, false)
         	findEntity(led[lix]):translate(tx * cos + tz * sin, height - math.floor(pix / 5) * vertical_spacing - 1, tz * cos + tx * sin * (1 - wall%2 * 2))
  --=====================================================================================================================================     
 		end

      end

    ---
    ---  add one to the current display w/ wrap
    ---
    function add()
      display((displayed + 1)%100)
      end

    ---
    ---  subtract one from the current display w/ wrap
    ---
    function sub()
      display((displayed + 99)%100)
      end

    ---
    ---  turn lights off
    ---
    function off()
      if lix ~= nil then
        for dix = 1, lix do
          led[dix]:destroy()
          end
        end
      lix = 0
      led = {nil}
     end

    ---
    ---  turn lights on
    ---
    function on()
      display(displayed)
      end

    ---
    ---  turn lights on if specified in parameters
    ---
    if initallyOn then on() end
--]]
Post Reply