Page 1 of 1

user scripts

Posted: Sun Feb 20, 2011 12:49 pm
by Dakota
ok i have been trying to make a custom user script for the past week but i can't get it to work (or even munge fully) how would i make one i am working with the one in the example thing for the 1.3 patch. i read both of the documents about it and still have no idea how to use or make one. i want it for my dedicated server for cp locking.
here is my moddification so far of the user_script_1
Hidden/Spoiler:
print("user_script_1: Entered")

--attempt to take control of (or listen to the calls of) the ScriptPostLoad function
if ScriptPostLoad then
print("user_script_1: Taking control of ScriptPostLoad()...")

--check for possible loading errors
if us1_ScriptPostLoad then
print("user_script_1: Warning: Someone else is using our us1_ScriptPostLoad variable!")
print("user_script_1: Exited")
return
end

--backup the current ScriptPostLoad function
us1_ScriptPostLoad = ScriptPostLoad

--this is our new ScriptPostLoad function
ScriptPostLoad = function()
print("user_script_1: ScriptPostLoad(): Entered")

--only do these changes when in SP
ScriptCB_GetAmHost()
ScriptCB_InMultiplayer()
ff_rebuildFakeConsoleList()

end

--make sure to forward the method call to the real ScriptPostLoad, so the game can function normally
us1_ScriptPostLoad()
print("user_script_1: ScriptPostLoad(): Exited")
end

print("user_script_1: Have control of ScriptPostLoad()")
else
print("user_script_1: Warning: No ScriptPostLoad() to take over")
print("user_script_1: Exited")
return
end

print("user_script_1: Exited")
plase help me (wow maybe i should have added an extra please...)

[munge log]
Hidden/Spoiler:
C:\BF2_ModTools\ToolsFL\Bin\luac.exe: ..\..\shell\scripts\user_script_1.lua:33: <eof> expected near `else'
ERROR[scriptmunge scripts\user_script_1.lua]:Could not read input file.ERROR[scriptmunge scripts\user_script_1.lua]:Could not read input file. [continuing]
2 Errors 0 Warnings

ERROR[levelpack shell.req]:Expecting bracket, but none was found.
File : munged\pc\user_script_1.script.req(1)...

ucft <--
ERROR[levelpack shell.req]:Expecting bracket, but none was found.
File : munged\pc\user_script_1.script.req(1)...

ucft <--

2 Errors 0 Warnings
i just checked the all you need to know thread i didn't find anything...

does anyone know...

Re: user scripts

Posted: Sun Feb 20, 2011 8:57 pm
by 501st_commander

Code: Select all

print("user_script_1: Entered")

--attempt to take control of (or listen to the calls of) the ScriptPostLoad function
if ScriptPostLoad then
	print("user_script_1: Taking control of ScriptPostLoad()...")

	--check for possible loading errors
	if us1_ScriptPostLoad then
		print("user_script_1: Warning: Someone else is using our us1_ScriptPostLoad variable!")
		print("user_script_1: Exited")
		return
	end

	--backup the current ScriptPostLoad function
	us1_ScriptPostLoad = ScriptPostLoad

	--this is our new ScriptPostLoad function
	ScriptPostLoad = function()
		print("user_script_1: ScriptPostLoad(): Entered")

		--only do these changes when in SP
		ScriptCB_GetAmHost()
		ScriptCB_InMultiplayer()
		ff_rebuildFakeConsoleList()

	end

	--make sure to forward the method call to the real ScriptPostLoad, so the game can function normally
	us1_ScriptPostLoad()
	print("user_script_1: ScriptPostLoad(): Exited")
end <------Why?--------------------------------------------------------------------------

	print("user_script_1: Have control of ScriptPostLoad()")
else <---- because, this else doesnt have a parent if-----------------------------------------
	print("user_script_1: Warning: No ScriptPostLoad() to take over")
	print("user_script_1: Exited")
	return
end

print("user_script_1: Exited")



Re: user scripts

Posted: Sun Feb 20, 2011 8:59 pm
by Dakota
i'll test and munge right now. THANK YOU SO MUCH i have had this topic out about a month, it is good to get a reply :D :D :D
Hidden/Spoiler:
oh wait that wasn't the fixed thing it is one telling me how to fix. well still thanks for helping and replying i will get to fixing

Re: user scripts

Posted: Sun Feb 20, 2011 9:02 pm
by 501st_commander
Your welcome.

Next time, look the code and use common logic :D

i need to get my luaeditor done......

Re: user scripts

Posted: Sun Mar 13, 2011 10:15 pm
by Dakota
501st_commander wrote:Your welcome.

Next time, look the code and use common logic :D

i need to get my luaeditor done......
(i never tryed making one of these before and got no clue how...)
well time to test

(i hope that lua editor you are making gets finished soon and is susscessfull i really need it...)


EDIT: ok new problem the script still won't work (i probably did something wrong i need an example of what the script should look like)

here is my munge log and script

munge log
Hidden/Spoiler:
ERROR[levelpack shell.req]:Could not open ..\common\munged\pc\core.files for input. DOS reports:
No such file or directory
ERROR[levelpack shell.req]:Could not open ..\common\munged\pc\core.files for input. DOS reports:
No such file or directory
[continuing]
2 Errors 0 Warnings

ERROR[levelpack MOD.req]:Could not open ..\..\common\munged\pc\core.files for input. DOS reports:
No such file or directory
ERROR[levelpack MOD.req]:Could not open ..\..\common\munged\pc\core.files for input. DOS reports:
No such file or directory
[continuing]
2 Errors 0 Warnings

ERROR[levelpack MOD.req]:Could not open ..\..\common\munged\pc\core.files for input. DOS reports:
No such file or directory
ERROR[levelpack MOD.req]:Could not open ..\..\common\munged\pc\core.files for input. DOS reports:
No such file or directory
[continuing]
2 Errors 0 Warnings
Script
Hidden/Spoiler:
print("user_script_1: Entered")

--attempt to take control of (or listen to the calls of) the ScriptPostLoad function
if ScriptPostLoad then
print("user_script_1: Taking control of ScriptPostLoad()...")

--check for possible loading errors
if us1_ScriptPostLoad then
print("user_script_1: Warning: Someone else is using our us1_ScriptPostLoad variable!")
print("user_script_1: Exited")
return
end

--backup the current ScriptPostLoad function
us1_ScriptPostLoad = ScriptPostLoad

--this is our new ScriptPostLoad function
ScriptPostLoad = function()
print("user_script_1: ScriptPostLoad(): Entered")

--only do these changes when in SP
ScriptCB_GetAmHost()
ScriptCB_InMultiplayer()
ff_rebuildFakeConsoleList()

end

--make sure to forward the method call to the real ScriptPostLoad, so the game can function normally
us1_ScriptPostLoad()
print("user_script_1: ScriptPostLoad(): Exited")

print("user_script_1: Have control of ScriptPostLoad()")
print("user_script_1: Warning: No ScriptPostLoad() to take over")
print("user_script_1: Exited")
return
end

print("user_script_1: Exited")
(once again i think i need a step by step tutorial, i am good at odfs but i fail horribly in scripting)

can someone please help its been awhile...

been about a month, i know, but i still really need some help with this.