Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

seronis

Where is a custom ACTION.fn called from?

Recommended Posts

seronis    130

Im looking into exactly how customizable the response messages from doing a custom action can be so that the player can get more info than merely 'i cant do that' depending on which condition of an action failed.  But im having issues tracing everything and I would prefer not to make bad assumptions about what the return values from a given ACTION.fn actually do.

 

Someone point me in the right direction or is this part called from the engine and not another script file?

Share this post


Link to post
Share on other sites
Malacath    123

Take a look at bufferedaction.lua

The function Do() is the part which will eventually call the ACTION.fn. I don't know what exactly you want to accomplish so I don't know what else to say  : P

Share this post


Link to post
Share on other sites
seronis    130

For my rabbit holes, im wanting the msg to specificaclly mention  "Ground is too hard here" or  "Maybe i should equip a shovel" as appropriate and not just  "I cant do that" which is too generic and doesnt actually tell the player WHY.  I just want the interface of the few mods im making to be intuitive.

 

greping for  "GetActionFailString"  only found where the function was defined in stringutil.lua and not where it was called from.  To me the return value from  action.fn seems to indicate whether the fail msg needs to be displayed so I was hoping to find where I could offer more detailed failure response by tracing it.

 

I just hadnt been able to.  Looking at buffered action now

Share this post


Link to post
Share on other sites
Malacath    123

Well, you can put the automatic equip of a shovel directly into the fn, before any return statement of course  ; )

And as for the string you can add

STRINGS.CHARACTER.GENERIC.ACTIONFAIL.WHATEVERYOURACTIONISCALLED = "The ground is to hard here."

Should do the trick.

Share this post


Link to post
Share on other sites
Heavenfall    185

The fail reason is passed from ACTION.testfn. For an example check out ACTION.SHAVE, shaver component, beard component and speech_wilson.lua for the custom fail reasons.

Share this post


Link to post
Share on other sites
seronis    130

Thanks guys.  I dont play as wilson hardly ever so forgot about the shave stuff.  Between the two advices I should be able to get it working

Share this post


Link to post
Share on other sites