Raised This Month: $12 Target: $400
 3% 

Plugin-autoreload


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Timiditas
Senior Member
Join Date: Apr 2009
Old 10-13-2009 , 19:26   Plugin-autoreload
Reply With Quote #1

Thought I'd share this. Simple, trivial plugin but makes life easier while developing/debugging an SM plugin.

When the attached plugin is loaded, it creates a list of all files and timestamps in addons/sourcemod/plugins (ignoring if they are loaded or not) , excluding itself.
Every 2 seconds, it checks if one of the timestamps has changed and fires "sm plugins reload %s" on the respective plugin.
Attached Files
File Type: sp Get Plugin or Get Source (autoreload.sp - 2084 views - 2.2 KB)
__________________

Timiditas is offline
berni
SourceMod Plugin Approver
Join Date: May 2007
Location: Austria
Old 10-14-2009 , 04:30   Re: Plugin-autoreload
Reply With Quote #2

That's a neat idea
I could imagine making an extension for this, to replace the timer with something that watches the folder and reloads plugins instantly
That should become part of sourcemod then.
__________________
Why reinvent the wheel ? Download smlib with over 350 useful functions.

When people ask me "Plz" just because it's shorter than "Please" I feel perfectly justified to answer "No" because it's shorter than "Yes"
powered by Core i7 3770k | 32GB DDR3 1886Mhz | 2x Vertex4 SSD Raid0
berni is offline
Matheus28
Senior Member
Join Date: Aug 2009
Old 10-15-2009 , 10:49   Re: Plugin-autoreload
Reply With Quote #3

Nice work!
Thanks you.
Matheus28 is offline
DarthNinja
SourceMod Plugin Approver
Join Date: Mar 2009
Location: PreThinkHook()
Old 11-26-2009 , 15:02   Re: Plugin-autoreload
Reply With Quote #4

Wow, I wish I'd found this sooner
+rep
__________________
DarthNinja is offline
pvtschlag
Member
Join Date: Nov 2009
Old 11-26-2009 , 22:48   Re: Plugin-autoreload
Reply With Quote #5

I recently started with SourcePawn and quickly found it annoying to compile, upload, and reload when debugging. Your plugin looks useful, but since it seems I'm not the only person who finds the process tedious I would like to share a small batch file I put together that makes my life so much easier.

You can just drag a .sp file ontop of this batch file and it will do the rest. However, I have Notepad++ with SourcePawn highlighting setup to run it when I hit Ctrl + F7. This makes debugging/testing painless.

It even has a bit of error checking so it stops the process if the plugin fails to compile which lets you see the error messages returned by the SourcePawn compiler.

You can get the clircon tool that is used to reload the plugin from this thread.

Code:
REM USEAGE <thisfile>.bat "Path\to\plugin.sp"

@echo off

REM START OF CONFIG

REM This is the path to the directory that contains spcomp.exe
set spcomppath="C:\path\to\spcomp\"

REM This is the FTP Address to connect to 
set ftpaddr=127.0.0.1

REM This is the FTP User to login as
set ftpuser=ftpuser

REM This is the password for the FTP user
set ftppass=ftppass

REM This is the path on the plugin should be uploaded to on the FTP
set ftppath="/path/to/sourcemod/plugins/"

REM This is the path to the directory that contains clircon.exe
set clirconpath="C:\path\to\clircon"

REM This is the address to the server you want to reload the plugin on
set rconaddr=127.0.0.1

REM This is the port for the server
set rconport=27015

REM This is the RCON password to use for the server
set rconpass=rconpass

REM END OF CONFIG

REM Compile the plugin
cd %spcomppath%
spcomp %1

REM If the plugin failed to compile skip the rest of the script and go to the final pause
if not exist %~n1.smx goto end

REM Create a file with a list of FTP commands
echo user %ftpuser%> ftpcmd.dat
echo %ftppass%>> ftpcmd.dat
echo cd %ftppath%>> ftpcmd.dat
echo bin>> ftpcmd.dat
echo put %~n1.smx>> ftpcmd.dat
echo quit>> ftpcmd.dat

REM Connect to the FTP server and execute the saved commands
ftp -n -s:ftpcmd.dat %ftpaddr%

REM Cleanup temporary FTP command file
del ftpcmd.dat

REM Cleanup compiled version of plugin
del %~n1.smx

REM Execute rcon commands to reload the plugin
REM I don't use reload here because it will not work if the plugin is not already load
cd %clirconpath%
clircon -P"%rconpass%" -a%rconaddr% -p%rconport% sm plugins unload %~n1
clircon -P"%rconpass%" -a%rconaddr% -p%rconport% sm plugins load %~n1

:end
REM Pause to read output
pause
pvtschlag is offline
Dr. Greg House
Professional Troll,
Part-Time Asshole
Join Date: Jun 2010
Old 01-04-2014 , 16:30   Re: Plugin-autoreload
Reply With Quote #6

Quote:
Originally Posted by berni View Post
That's a neat idea
I could imagine making an extension for this, to replace the timer with something that watches the folder and reloads plugins instantly
That should become part of sourcemod then.
SM already does this onmapchange. Maybe you won't have to "reinvent the wheel" (get it? ) after all.
__________________
Santa or Satan?

Watch out when you're paying people for private requests! Most stuff already exists and you can hardly assess the quality of what you'll get, and if it's worth the money.

Last edited by Dr. Greg House; 01-04-2014 at 16:30.
Dr. Greg House is offline
Mitchell
~lick~
Join Date: Mar 2010
Old 01-04-2014 , 17:20   Re: Plugin-autoreload
Reply With Quote #7

Quote:
Originally Posted by Dr. Greg House View Post
SM already does this onmapchange. Maybe you won't have to "reinvent the wheel" (get it? ) after all.
This is a necropost, lol.
He is saying that when ever a plugin is edited and uploaded the extension will notice it and reload it instantly with out map change or putting in any commands.
Mitchell is offline
Dr. Greg House
Professional Troll,
Part-Time Asshole
Join Date: Jun 2010
Old 01-06-2014 , 22:38   Re: Plugin-autoreload
Reply With Quote #8

Quote:
Originally Posted by Mitchell View Post
This is a necropost, lol.[...]
Oh dammit I didn't notice. -.-
I'm sorry.
__________________
Santa or Satan?

Watch out when you're paying people for private requests! Most stuff already exists and you can hardly assess the quality of what you'll get, and if it's worth the money.
Dr. Greg House is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 09:59.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode