Page 3 of 5 First 12345 Last
  1. #21

    .
    thx @celestian.
    1) so essentially, to show an image in-post, you have to host image somewhere else then include link, instead of uploading image into post. correct?

    2) regarding how to get that failed / save text into the interface.... i kept (re)reading and was really not quite getting how it could happen.
    is someone planning to do an extension, or do i have to do some code hacking in certain file(s)?

    this would be for pfrpg(1) btw
    -----
    roll dice. it builds character.

  2. #22
    celestian's Avatar
    Join Date
    Jan 2017
    Location
    DFW, Texas
    Posts
    2,612
    Quote Originally Posted by tahl_liadon View Post

    .
    thx @celestian.
    1) so essentially, to show an image in-post, you have to host image somewhere else then include link, instead of uploading image into post. correct?

    2) regarding how to get that failed / save text into the interface.... i kept (re)reading and was really not quite getting how it could happen.
    is someone planning to do an extension, or do i have to do some code hacking in certain file(s)?

    this would be for pfrpg(1) btw

    Correct, I use imgur.com and a screen snipping tool called ShareX (windows) that uploads directly to it. I just snip, it puts the url in copy buffer and I paste it in.

    For PF it would depend on where they manage saves. I don't know much about PF as I said but I think it's layered on 3.5e ruleset and the location is the same there. Depending on how it displays all you'd need to do is tweak the text to your liking. You'd want to check that "rOrigin" exists and if it does then you can assume it's a save because someone forced them. Otherwise you probably want to leave the text alone.

    Code:
    function applySave(rSource, rOrigin, rAction, sUser)
    	local msgShort = {font = "msgfont"};
    	local msgLong = {font = "msgfont"};
    	
    	msgShort.text = "Save";
    	msgLong.text = "Save [" .. rAction.nTotal ..  "]";
    	if rAction.nTarget then
    		msgLong.text = msgLong.text .. "[vs. DC " .. rAction.nTarget .. "]";
    	end
    	msgShort.text = msgShort.text .. " ->";
    	msgLong.text = msgLong.text .. " ->";
    	if rSource then
    		msgShort.text = msgShort.text .. " [for " .. ActorManager.getDisplayName(rSource) .. "]";
    		msgLong.text = msgLong.text .. " [for " .. ActorManager.getDisplayName(rSource) .. "]";
    	end
    	if rOrigin then
    		msgShort.text = msgShort.text .. " [vs " .. ActorManager.getDisplayName(rOrigin) .. "]";
    		msgLong.text = msgLong.text .. " [vs " .. ActorManager.getDisplayName(rOrigin) .. "]";
    	end
    	
    	msgShort.icon = "roll_cast";
    		
    	local sAttack = "";
    	local bHalfMatch = false;
    	if rAction.sSaveDesc then
    		sAttack = rAction.sSaveDesc:match("%[SAVE VS[^]]*%] ([^[]+)") or "";
    		bHalfMatch = (rAction.sSaveDesc:match("%[HALF ON SAVE%]") ~= nil);
    	end
    	rAction.sResult = "";
    	
    	if rAction.sSaveResult == "autosuccess" or rAction.sSaveResult == "success" then
    		if rAction.sSaveResult == "autosuccess" then
    			msgLong.text = msgLong.text .. " [AUTOMATIC SUCCESS]";
    		else
    			msgLong.text = msgLong.text .. " [SUCCESS]";
    		end
    		
    		if rSource then
    			local bHalfDamage = bHalfMatch;
    			local bAvoidDamage = false;
    			if bHalfDamage then
    				local sSave = rAction.sDesc:match("%[SAVE%] (%w+)");
    				if sSave then
    					sSave = sSave:lower();
    				end
    				if sSave == "reflex" then
    					if EffectManager35E.hasEffectCondition(rSource, "Improved Evasion") then 
    						bAvoidDamage = true;
    						msgLong.text = msgLong.text .. " [IMPROVED EVASION]";
    					elseif EffectManager35E.hasEffectCondition(rSource, "Evasion") then
    						bAvoidDamage = true;
    						msgLong.text = msgLong.text .. " [EVASION]";
    					end
    				end
    			end
    			
    			if bAvoidDamage then
    				rAction.sResult = "none";
    				rAction.bRemoveOnMiss = false;
    			elseif bHalfDamage then
    				rAction.sResult = "half_success";
    				rAction.bRemoveOnMiss = false;
    			end
    			
    			if rOrigin and rAction.bRemoveOnMiss then
    				TargetingManager.removeTarget(ActorManager.getCTNodeName(rOrigin), ActorManager.getCTNodeName(rSource));
    			end
    		end
    	else
    		if rAction.sSaveResult == "autofailure" then
    			msgLong.text = msgLong.text .. " [AUTOMATIC FAILURE]";
    		else
    			msgLong.text = msgLong.text .. " [FAILURE]";
    		end
    
    		if rSource then
    			local bHalfDamage = false;
    			if bHalfMatch then
    				local sSave = rAction.sDesc:match("%[SAVE%] (%w+)");
    				if sSave then
    					sSave = sSave:lower();
    				end
    				if sSave == "reflex" then
    					if EffectManager35E.hasEffectCondition(rSource, "Improved Evasion") then
    						bHalfDamage = true;
    						msgLong.text = msgLong.text .. " [IMPROVED EVASION]";
    					end
    				end
    			end
    			
    			if bHalfDamage then
    				rAction.sResult = "half_failure";
    			end
    		end
    	end
    	
    	ActionsManager.outputResult(rAction.bSecret, rSource, rOrigin, msgLong, msgShort);
    	
    	if rSource and rOrigin then
    		ActionDamage.setDamageState(rOrigin, rSource, StringManager.trim(sAttack), rAction.sResult);
    	end
    end
    ---
    Coding the Official AD&D Ruleset
    Documentation for AD&D 2E ruleset.
    My Twitch Channel for AD&D and FG related streams (See schedule for live days)
    My YouTube for FG related Tutorials and AD&D Actual Plays
    Custom Maps (I2, S4, T1-4, Barrowmaze,Lost City of Barakus)

  3. #23
    Kelrugem's Avatar
    Join Date
    Sep 2018
    Location
    Geneva, Switzerland, and Lyon, France
    Posts
    1,268
    Quote Originally Posted by tahl_liadon View Post

    .
    thx @celestian.
    1) so essentially, to show an image in-post, you have to host image somewhere else then include link, instead of uploading image into post. correct?

    2) regarding how to get that failed / save text into the interface.... i kept (re)reading and was really not quite getting how it could happen.
    is someone planning to do an extension, or do i have to do some code hacking in certain file(s)?

    this would be for pfrpg(1) btw
    It is fairly easy as Celestian outlined But beware, since I know you use my extensions, this will surely be incompatible with my extension, so you may have to open my extension and change that there rather than writing an own extension When you tell me which extension you use, then I can change it for you, too but I do not intend to change it in general, would just be for you then, because my mind is already used to think in the perspective of the person who saves such that the chat and the save overlays (as here https://www.fantasygrounds.com/forum...ea-from-Ken-L) , just in case you did not know about that ) already make sense for me; also it would take me now too much time to change the overlays, too, to respect the other perspective

  4. #24
    celestian's Avatar
    Join Date
    Jan 2017
    Location
    DFW, Texas
    Posts
    2,612
    Quote Originally Posted by Kelrugem View Post
    It is fairly easy as Celestian outlined But beware, since I know you use my extensions, this will surely be incompatible with my extension, so you may have to open my extension and change that there rather than writing an own extension When you tell me which extension you use, then I can change it for you, too but I do not intend to change it in general, would just be for you then, because my mind is already used to think in the perspective of the person who saves such that the chat and the save overlays (as here https://www.fantasygrounds.com/forum...ea-from-Ken-L) , just in case you did not know about that ) already make sense for me; also it would take me now too much time to change the overlays, too, to respect the other perspective
    If it so happens your extension doesn't directly change "applySave(rSource, rOrigin, rAction, sUser)" then he should be ok so long as they just replace that function.

    If you do then, well ignore me
    ---
    Coding the Official AD&D Ruleset
    Documentation for AD&D 2E ruleset.
    My Twitch Channel for AD&D and FG related streams (See schedule for live days)
    My YouTube for FG related Tutorials and AD&D Actual Plays
    Custom Maps (I2, S4, T1-4, Barrowmaze,Lost City of Barakus)

  5. #25
    Kelrugem's Avatar
    Join Date
    Sep 2018
    Location
    Geneva, Switzerland, and Lyon, France
    Posts
    1,268
    Quote Originally Posted by celestian View Post
    If it so happens your extension doesn't directly change "applySave(rSource, rOrigin, rAction, sUser)" then he should be ok so long as they just replace that function.

    If you do then, well ignore me
    Sadly, every extension of my extensions, which changes manager_action_save, surely also changes this function; but otherwise good idea to just overwrite this one function

  6. #26
    celestian's Avatar
    Join Date
    Jan 2017
    Location
    DFW, Texas
    Posts
    2,612
    Quote Originally Posted by Kelrugem View Post
    Sadly, every extension of my extensions, which changes manager_action_save, surely also changes this function; but otherwise good idea to just overwrite this one function
    To make sure we're talking about the same thing... while you might be overriding manager_action_save if you're not directly altering the function I mentioned he could do a narrow override of just that and not break your work using his own custom global script and changing it via

    Code:
    function onInit()
      ActionSave.applySave = applySaveCustom;
    end
    
    
    function applySaveCustom(rSource, rOrigin, rAction, sUser)
    ... etc...
    end
    So, unless you're altering the save text output/icons they could. I do similar things so that I can reduce my "backport" work from 5e by just replacing a single function and leaving all the rest.

    Sorry if I'm preaching to the choir here but this was something that I didn't learn for a while and it's been extremely useful.
    ---
    Coding the Official AD&D Ruleset
    Documentation for AD&D 2E ruleset.
    My Twitch Channel for AD&D and FG related streams (See schedule for live days)
    My YouTube for FG related Tutorials and AD&D Actual Plays
    Custom Maps (I2, S4, T1-4, Barrowmaze,Lost City of Barakus)

  7. #27
    Kelrugem's Avatar
    Join Date
    Sep 2018
    Location
    Geneva, Switzerland, and Lyon, France
    Posts
    1,268
    Quote Originally Posted by celestian View Post
    To make sure we're talking about the same thing... while you might be overriding manager_action_save if you're not directly altering the function I mentioned he could do a narrow override of just that and not break your work using his own custom global script and changing it via

    Code:
    function onInit()
      ActionSave.applySave = applySaveCustom;
    end
    
    
    function applySaveCustom(rSource, rOrigin, rAction, sUser)
    ... etc...
    end
    So, unless you're altering the save text output/icons they could. I do similar things so that I can reduce my "backport" work from 5e by just replacing a single function and leaving all the rest.

    Sorry if I'm preaching to the choir here but this was something that I didn't learn for a while and it's been extremely useful.
    Thanks, and yes, I understood I am doing such approaches from time to time, too, when I think about that (most of the time I forget that ) What I meant before, is that I indeed overwrite the function applySave, too (because evasion is coded there, too, in 3.5/PF1 and I improved that code to make these effects a bit more versatile )
    Last edited by Kelrugem; March 30th, 2020 at 00:07.

  8. #28
    Kelrugem's Avatar
    Join Date
    Sep 2018
    Location
    Geneva, Switzerland, and Lyon, France
    Posts
    1,268
    But, moreover, in that special situation an overwrite of the function would not work when I remember Moon Wizard's instruction with respect to that (even when I would not overwrite it) The reason for this is that applySave gets called in the script manager_action_save.lua, too (e.g. in handleApplySave by the line applySave(rSource, rOrigin, rAction)), and the approach with using onInit etc. as you did, literally overwrites ActionSave.applySave but not applySave such that internal calls of this function would still use the original function Thence, one can only replace functions in that way when there are no internal calls of this function (but maybe when the internal call is also via ActionSave.applySave instead of just via applySave?)

    Moon Wizard, please correct me when I remember this wrongly

  9. #29
    damned's Avatar
    Join Date
    Mar 2011
    Location
    Australia
    Posts
    21,169
    Blog Entries
    1
    please note I use inline images all the time and i use them from images i upload in the post, as in, not uploaded externally.

    MoreCore - Generic Ruleset
    --- Projects ---
    Extensions | Tutorials | MoreCore | MoreCore Themes | Call of Cthulhu | Maelstrom | FG Con

  10. #30
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Newcastle, UK (for a bit)
    Posts
    26,034
    For inline images, upload the attachment as usual. Then temporarily add a link to it to the post (click on the right side of the attachment button and select the attachment name). This will give you an attachment link with the attachment number.


    Then add the following to your post, replacing XXXXX with the attachment number you got from the link. Replace the curly brackets around the first IMG to square brackets [IMG] - I had to change these to allow the forum to display the data:

    Code:
     {IMG}https://www.fantasygrounds.com/forums/attachment.php?attachmentid=XXXXX[/IMG]
    Then delete the temporary link you added - this was just to give you the attachment number. It's a little bit of extra work, but it means that the attachment is kept on the FG forums and I don't need to worry about it being elsewhere. There may be other methods, but this is what I use.
    FG Con 16 Fantasy Grounds Online RPG Convention - Postponed New date To Be Confirmed.
    Register at www.fg-con.com for all the latest info.

    Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Log in

Log in