ToME: the Tales of Maj'Eyal

Everything about ToME
It is currently Wed Sep 26, 2018 12:56 am

All times are UTC




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Sat Mar 26, 2016 9:03 pm 
Offline
Wayist

Joined: Sat Mar 19, 2016 3:38 pm
Posts: 23
In this fragment, if you uncomment the commented out lines (as instructed to), the function becomes impossible to close with an "end".

I thought it was improper indenting of the if and elseif blocks, but I tried to give them proper indent and it's still impossible to close.

Code:
function _M:use(item)
    if not item then return end
    game:unregisterDialog(self)

    local act = item.action

    --if act == "use" then
        --self.actor:playerUseItem(self.object, self.item, self.inven, self.onuse)
        --self.onuse(self.inven, self.item, self.object, true)
    --else
    if act == "drop" then
        self.actor:doDrop(self.inven, self.item, function() self.onuse(self.inven, self.item, self.object, false) end)
    elseif act == "wear" then
        self.actor:doWear(self.inven, self.item, self.object)
        self.onuse(self.inven, self.item, self.object, false)
    elseif act == "takeoff" then
        self.actor:doTakeoff(self.inven, self.item, self.object)
        self.onuse(self.inven, self.item, self.object, false)
    end
end


Top
 Profile  
 
PostPosted: Sat Mar 26, 2016 10:11 pm 
Offline
Perspiring Physicist

Joined: Sun Sep 09, 2012 7:43 am
Posts: 5755
Did you merge the else and the if into an elseif?

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


Top
 Profile  
 
PostPosted: Sat Mar 26, 2016 10:53 pm 
Offline
Wayist

Joined: Sat Mar 19, 2016 3:38 pm
Posts: 23
Yay, it worked.

Felt weird that there was an else + if, but hey, what do I know? Evidently, very little. Thanks!


Top
 Profile  
 
PostPosted: Sun Mar 27, 2016 12:00 am 
Offline
Wayist

Joined: Sat Mar 19, 2016 3:38 pm
Posts: 23
Resolved, this thread can be closed.


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

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 guests


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