Page 1 of 1

Help- Adding OnDraw hooks to party object

Posted: Sat Mar 29, 2014 11:15 am
by LocalFire
So I just played ORRR2 and I loved it, particularly the notebook in this case since I decided that my mod needs it (It has allot of scrolls) so I tried to add it and now theres a probelm with my init.lua that stops me from openning the editor, namely "} expected to close line blah (it's the last line), Can someone look at this and tell me what I'm doing wrong cause I suck at code

Code: Select all

cloneObject {
	name == "party",
	baseObject = "party",
	

onDamage = function (self, item)
        DefendScript.ItemChecker (self, item)
        RevengeScript.ItemChecker (self, item)
        WindyScript.ItemChecker (self, item)
 end,

onAttack = function(champion, weapon)
      return attackingWeaponScripts.specialWeaponAttacks(champion, weapon, skill) 
         
end,


onDrawGui = function(ctx)
		mdConversationList.onDraw(ctx)

	if ( nb_main_script ~= nil and nb_main_script.onDrawGui ~= nil ) then
		nb_main_script:onDrawGui(g);
	end,
	
	
	 onMove = function(party, direction)
	
	if ( nb_main_script ~= nil and nb_main_script.isNoteBookShowing() ) then
		return false;
	end,
	
onTurn = function(party, direction)
	
	if ( nb_main_script ~= nil and nb_main_script.isNoteBookShowing() ) then
		return false;
	end,
	

	 onRest = function(party)
	
	if ( nb_main_script ~= nil and nb_main_script.isNoteBookShowing() ) then
		return false;
	end,
	
 }
It should be noted that all the hooks not relating to the notebook work fine, its just the new ones that seem to messing things up. I'm also using the journal in this mod so its using the onDraw hook too.

Re: Help- Adding OnDraw hooks to party object

Posted: Sat Mar 29, 2014 11:31 am
by Dr.Disaster
Seems you missed the required "end" line to close the "if" statements inside the hook definitions. try this:

Code: Select all

cloneObject {
	name == "party",
	baseObject = "party",

onDamage = function (self, item)
        DefendScript.ItemChecker (self, item)
        RevengeScript.ItemChecker (self, item)
        WindyScript.ItemChecker (self, item)
end,

onAttack = function(champion, weapon)
        return attackingWeaponScripts.specialWeaponAttacks(champion, weapon, skill) 
end,

onDrawGui = function(ctx)
	mdConversationList.onDraw(ctx)
	if ( nb_main_script ~= nil and nb_main_script.onDrawGui ~= nil ) then
		nb_main_script:onDrawGui(g);
	end
end,	
	
onMove = function(party, direction)
	if ( nb_main_script ~= nil and nb_main_script.isNoteBookShowing() ) then
		return false;
	end
end,
	
onTurn = function(party, direction)
	if ( nb_main_script ~= nil and nb_main_script.isNoteBookShowing() ) then
		return false;
	end
end,	

onRest = function(party)
	if ( nb_main_script ~= nil and nb_main_script.isNoteBookShowing() ) then
		return false;
	end
end,
}

Re: Help- Adding OnDraw hooks to party object

Posted: Sun Mar 30, 2014 12:23 pm
by JKos
Could the problem be this line?

nb_main_script:onDrawGui(g);

There is no variable named g, so change it to:

nb_main_script:onDrawGui(ctx);

Re: Help- Adding OnDraw hooks to party object

Posted: Sun Mar 30, 2014 10:22 pm
by LocalFire
Thanks for both, it seems to a be a combination of these and its working now