News:

Wondering if this will always be free?  See why free is better.

Main Menu

Code Removal in Mod instead of replace

Started by Burke ♞ Knight, August 29, 2014, 07:26:52 AM

Previous topic - Next topic

Burke ♞ Knight

Okay, I'm working on a new mod, and instead of replacing code, it will remove it.

In modification file, I know how to add before or after and do replace, but is there a way to remove only?
Or do I just do replace, and leave the add part blank?

Kindred

#1
In order to properly allow for UNINSTALL of the mod, I would suggest

replace (CODE)
with (//CODE REMOVED COMMENT)

that way you can properly target the spot for re-insertion of the code during an uninstall
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Herman's Mixen

its like manual uninstall, so you use replace backwards ...

search for your custom code and replace it with the original code from a original file ;)
Met vriendelijke groet, The Burglar!

 House Mixes | Mixcloud | Any Intelligent fool can make things bigger, more complex, and more violent.
It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Albert Einstein

Former Godfather of our dutch community ;)

Burke ♞ Knight

I decided to make it a switch, so used check in mod settings. However, if it is checked, it shows what want removed, and removes it if unchecked...
I need to figure out how to reverse that....LOL

if(!empty($modSettings['rai_mod']))
echo '
(', $attachment['size'], ($attachment['is_image'] ? ', ' . $attachment['real_width'] . 'x' . $attachment['real_height'] . ' - ' . $txt['attach_viewed'] : ' - ' . $txt['attach_downloaded']) . ' ' . $attachment['downloads'] . ' ' . $txt['attach_times'] . '.)


Like stated, I want it to remove when checked, and not when unchecked.

Arantor

You must ALWAYS leave something behind. It is always a replace. There is no possibility of doing a 'remove' because there is then no way for the package manager to do a replace to put it back again.

Burke ♞ Knight

I still can not figure out why I can not get it reversed to how it should be.
When box is unchecked it removes the code, when should not.
When box is unchecked, it does not remove the code, when it should.

Any help would be appreciated.

margarett

You said both times "is unchecked", I assume one of them should be checked :P

I'd say that you just switch if(!empty --> if(empty

;)
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Burke ♞ Knight

That did the trick. Thank you, my friend. :)

Advertisement: