ToME: the Tales of Maj'Eyal

Everything about ToME
It is currently Mon Oct 22, 2018 6:25 pm

All times are UTC




Post new topic Reply to topic  [ 7 posts ] 
Author Message
PostPosted: Tue Mar 22, 2016 7:49 pm 
Offline
Wayist

Joined: Sat Mar 19, 2016 3:38 pm
Posts: 23
When a long time ago I started modding Zap'M into PRIME, there were a LOT of shorthands used in code, it's just natural, but I had nobody to ask, since the original dev had long since lost interest in his game.

Even if this forum isn't terribly active, it seems that there are some people around willing to answer some questions. And there are a lot of single letter words I can't fathom what they mean.

What do all these stand for?

" _M " such as found when defining functions in Player.lua (as per the wiki). My guess is that it stands for whatever class you're defining a method for, so you can latter access it via class:method or self:method. Am I wrong?

" d " and " o " such as found in:

Code:
function _M:playerPickup()
   --if 2 or more objects, display a pickup dialog, otherwise just picks up - according to wiki
      if game.level.map:getObject(self.x, self.y, 2) then   
         local d d = self:showPickupFloor("Pickup", nil, function(o, item)
            self:pickupFloor(item, true)
            self.changed = true
            d:used()
         end)
      else
         self:pickupFloor(1, true)
         self:sortInven()
         self:useEnergy()
         
      self.changed = true
      end
   end
   


" t " such as found in the player init function:

Code:
function _M:init(t, no_default)
   t.display=t.display or '@'
   t.color_r=t.color_r or 230
   t.color_g=t.color_g or 230
   t.color_b=t.color_b or 230

   t.player = true
   t.type = t.type or "humanoid"
   t.subtype = t.subtype or "player"
   t.faction = t.faction or "players"

   t.lite = t.lite or 0

   mod.class.Actor.init(self, t, no_default)
   engine.interface.PlayerHotkeys.init(self, t)

   self.descriptor = {}
end


" tg " , such as found when defining a talent:
Code:
newTalent{
   name = "Acid Spray",
   type = {"role/combat", 1},
   points = 1,
   cooldown = 6,
   power = 2,
   range = 6,
   action = function(self, t)
      local tg = {type="ball", range=self:getTalentRange(t), radius=1, talent=t}
      local x, y = self:getTarget(tg)
      if not x or not y then return nil end
      self:project(tg, x, y, DamageType.ACID, 1 + self:getDex(), {type="acid"})
      return true
   end,
   info = function(self, t)
      return "Zshhhhhhhhh!"
   end,
}



To prove I'm trying to do my homework, I'll tell you that I just looked up what " _ " is used for in lua and apparently it's used when you want to ignore a variable.

Come on, lend me a hand, I'll add a shorthand meaning list to the module howto guides 8)


Top
 Profile  
 
PostPosted: Wed Mar 23, 2016 1:34 am 
Offline
Perspiring Physicist

Joined: Sun Sep 09, 2012 7:43 am
Posts: 5759
The tg stands for targeter.

I don't think that d, o, or t stands for anything.
Unless it is drop, object and thingy? :lol:

_________________
My feedback meter decays into coding. Give me feedback and I make mods.


Top
 Profile  
 
PostPosted: Wed Mar 23, 2016 3:51 am 
Offline
Wayist

Joined: Sat Mar 19, 2016 3:38 pm
Posts: 23
Hey, thanks for replying. That's at least one clarified :)

I assume that most of the single-letter words are local variables... but ones that see frequent enough use to make repeating them a chore.


Top
 Profile  
 
PostPosted: Wed Mar 23, 2016 5:06 pm 
Offline
Uruivellas

Joined: Fri May 24, 2013 4:27 pm
Posts: 717
"t" stands for "table". It's just a lua table with some parameters of an actor.
"o" is most definitely an "object", ie an equippable/holdable thing.
"d" in that case stands for "dialog", but it's not common at all.
"_M" is lua convention about current module, and TE4 implements classes using (slightly tweaked) modules.


Top
 Profile  
 
PostPosted: Thu Mar 24, 2016 12:42 am 
Offline
Spiderkin

Joined: Sat Feb 11, 2012 1:12 am
Posts: 543
When used in talent definitions/callbacks/hooks, t is often shorthand for Talent. Likewise, eff is commonly for temporary Effect.


Top
 Profile  
 
PostPosted: Thu Mar 24, 2016 7:02 am 
Offline
Sher'Tul Godslayer

Joined: Mon Feb 14, 2011 11:16 pm
Posts: 2263
'wtf' stands for 'where's that function?'

_________________
MADNESS rocks


Top
 Profile  
 
PostPosted: Sat Mar 26, 2016 12:14 pm 
Offline
Wayist

Joined: Sat Mar 19, 2016 3:38 pm
Posts: 23
jenx wrote:
'wtf' stands for 'where's that function?'


And, can you read this? " 7u7 " :lol:

But in all honesty, I did find another 3-letter weird word:

" fct "

And one of the few that is explained either in the reference or the wiki: " s " which usually stands for a drawing surface.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group