Data Realms Fan Forums
http://45.55.195.193/

Lua
http://45.55.195.193/viewtopic.php?f=1&t=6339
Page 1 of 5

Author:  Xera [ Fri Jul 13, 2007 9:37 pm ]
Post subject:  Lua

I think CC would be a lot better off if it used Lua as its scripting language, it's a lot more flexible and easier to understand(And read :wink: ) and would allow for people to create much more complex stuff than currently possible.

What do you think?


Heh, my first post is a suggestion.. :grin:

Author:  AlphaCommando [ Fri Jul 13, 2007 9:39 pm ]
Post subject:  Re: Lua

I think its fine as is, but there is always room for improvement, however; I think we have gotten used to how it is now.

Author:  Alenth Eneil [ Fri Jul 13, 2007 9:41 pm ]
Post subject:  Re: Lua

Putting in lua would require a bunch of work for payoff that Data probably doesn't need.

Author:  p3lb0x [ Fri Jul 13, 2007 11:59 pm ]
Post subject:  Re: Lua

Lua isnt "easy to understand" if you cant understand simple variables, you have no chance to do ANYTHING in Lua

Author:  Shade [ Sat Jul 14, 2007 12:19 am ]
Post subject:  Re: Lua

Once I saw Lua code, I was baffled. Much later I found Cortex Command code, and I could at least understand the variables well enough on my own.

Author:  couchcaboose [ Sat Jul 14, 2007 3:00 am ]
Post subject:  Re: Lua

I'm fine by how the script works currently. No need to change it. (well for my opinion)

Author:  ProjektTHOR [ Sat Jul 14, 2007 4:25 am ]
Post subject:  Re: Lua

The code base requires more comments, or at least someone should post an indepth description of each variable possible.

Author:  Xera [ Sat Jul 14, 2007 7:24 pm ]
Post subject:  Re: Lua

IMO the current system is messy as hell - It's basically just a bunch of variables, sure, it's easy as moving an eye lid but it's inefficient and messy.

Author:  Pyrorex [ Sat Jul 14, 2007 7:26 pm ]
Post subject:  Re: Lua

It takes finnesse to make it efficient. You just haven't done enough for it to be easy and clean.

Author:  Xera [ Sat Jul 14, 2007 7:30 pm ]
Post subject:  Re: Lua

Pyrorex wrote:
It takes finnesse to make it efficient. You just haven't done enough for it to be easy and clean.

Seriously, how can you say something like
Code:
AddAmmo = Round
   InstanceName = Round Supreme Blast
   ParticleCount = 4
   Particle = MOPixel
      InstanceName = Particle Supreme Digger
      Mass = 0.2
      RestThreshold = 500
      LifeTime = 20
      Sharpness = 28
      HitsMOs = 1
      GetsHitByMOs = 0
      Color = Color
         R = 35
         G = 171
         B = 255
      Atom = Atom
         Material = Material
            CopyOf = Bullet Metal
         TrailColor = Color
            R = 35
            G = 171
            B = 255
         TrailLength = 10
   Shell = None
   FireVelocity = 95
   ShellVelocity = 10
   Separation = 10

AddAmmo = Round
   InstanceName = Round Very Supreme Blast
   ParticleCount = 4
   Particle = MOPixel
      InstanceName = Particle Very Supreme Digger
      Mass = 0.35
      RestThreshold = 500
      LifeTime = 20
      Sharpness = 28
      HitsMOs = 1
      GetsHitByMOs = 0
      Color = Color
         R = 255
         G = 255
         B = 255
      Atom = Atom
         Material = Material
            CopyOf = Bullet Metal
         TrailColor = Color
            R = 255
            G = 255
            B = 255
         TrailLength = 10
   Shell = None
   FireVelocity = 95
   ShellVelocity = 10
   Separation = 10

isn't messy?

Compared to this
Code:
if(SERVER) then

   AddCSLuaFile("autorun/healthfix.lua")

   function UpdateHealth()
   
      local Ents = ents.GetAll()
   
      for k,v in pairs(Ents) do
      
         if(v:GetHealth() != v:Health()) then
            
            v:SetNWFloat("hp", v:Health())
            
         end
         
         if(v:GetNWMaxHealth() != v:GetMaxHealth()) then
         
            v:SetNWFloat("maxhp", v:GetMaxHealth())
         
         end
      
      end
   
   end

   hook.Add("Think", "HealthThink", UpdateHealth)
   
end

local meta = FindMetaTable("Entity")

function meta:GetHealth()

   local hp = self:GetNWFloat("hp")

   return hp

end

function meta:GetNWMaxHealth()

   local mhp = self:GetNWFloat("maxhp")
   
   return mhp

end

if(CLIENT) then

   local function hphud()
   
      if(!LocalPlayer():Alive()) then return end
   
      local TR = LocalPlayer():GetEyeTrace()

      if(TR.HitWorld || !TR.Entity || !TR.Entity:IsValid()) then return end

      local sw,sh = ScrW(), ScrH()
      
      --draw.RoundedBox( 0, sw/2-53.5, sh/2-20, 107, 40, Color(173,255,47,200))
      
      local String1 = ""
      
      if(TR.Entity:IsPlayer()) then
         String1 = TR.Entity:GetName()
      else
         String1 = TR.Entity:GetClass()
      end
      
      local Percent = TR.Entity:GetHealth() / TR.Entity:GetNWMaxHealth()
      
      --print(Percent)
      
      Percent = Percent*100
      
      local Colour = Color((Percent*100)*4,0,math.fmod(255,(Percent*100)*3))
      
      draw.RoundedBox(0, (sw/2)-Percent, sh/2+20, Percent*2, 10, Colour)
      
      local Text = {}
      Text.text = "Name: "..String1
      Text.font = "GModWorldTip"
      Text.xalign = TEXT_ALIGN_CENTER
      Text.yalign = TEXT_ALIGN_CENTER
      Text.pos = {sw/2, sh/2-60}
      Text.color = Color(0,0,0,255)
      draw.Text(Text)
      
      Text.text = TR.Entity:GetHealth()
      Text.pos[2] = sh/2-40
      draw.Text(Text)
         
   end
   
   hook.Add("HUDPaint", "hphud", hphud)

end

Yeah, that's for a completely different game but the same principle could be applied to CC.

Author:  Alenth Eneil [ Sat Jul 14, 2007 7:34 pm ]
Post subject:  Re: Lua

It would take a lot of work to put in lua, and Data doesn't need anything near as powerful as lua for CC. Not to mention we are comparing apples to oranges here. CC's .inis are just variables, not code, not script, used properly you can emulate script... but that's not exactly it's real purpose. We can't see the scripts or code of CC right now. Lua is a rather different thing than our beloved .ini files.

Author:  ProjektTHOR [ Sat Jul 14, 2007 9:17 pm ]
Post subject:  Re: Lua

Also, I like working with a higher-level "language." That is--to be very similar to English. If I wanted to code in assembly, I would.

Author:  Kokits [ Sun Jul 15, 2007 12:56 am ]
Post subject:  Re: Lua

Alenth wrote:
It would take a lot of work to put in lua, and Data doesn't need anything near as powerful as lua for CC. Not to mention we are comparing apples to oranges here. CC's .inis are just variables, not code, not script, used properly you can emulate script... but that's not exactly it's real purpose. We can't see the scripts or code of CC right now. Lua is a rather different thing than our beloved .ini files.


Yep, yep, yep.

Author:  BreenedandScrooned [ Sun Jul 15, 2007 1:27 am ]
Post subject:  Re: Lua

I can't even understand the Lua code. I probably could learn it if I wanted to, but I don't think Cortex Command needs it. The .inis are fine, in my opinion.

Author:  venn177 [ Sun Jul 15, 2007 2:56 am ]
Post subject:  Re: Lua

Lua is easy to learn, but it's not necessary for ANY 2d game that people want to learn to mod. Anything lua can do we can emulate with variables.

Page 1 of 5 All times are UTC [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/