"../" Paths not working! HUGE PROBLEM!

Paths with “…/” -extension to read files from the addons folder doesn’t work anymore.

This is a huge problem, because the ToyBox folder is located in the Addons folder.

I can’t load sounds without “…/” at the beginning of a path if they are located in the addons folder. This especially goes for the toybox users…

I noticed it on these two functions:
file.Read() with “…/” path – doesn’t work.
CreateSound() with “…/” path – doesn’t work.

Is there a way around this? (If there isn’t: Garry needs to fix this one.)

[lua]file.Read(“addons/toybox/somefile.txt”, true)[/lua]

D: I find it more comfortable with “…/” hmm…

[editline]21st October 2011[/editline]

btw
file.Read(“addons/toybox/somefile.txt”, true) – tested, doesn’t work.

Tested like this:
RunString(file.Read(“addons/lua/autorun/client/SomeLuaFile.lua”, true))

So, Garry needs to fix that “…/”, obviously.

You do realize that the file somefile.txt has to exist, right? And why on earth are you using RunString on that?

The second parameter to the file functions will let you use the garrysmod directory as the base directory. So “obviously” this is how it is meant to be used.

Because I made a lua reload function, without RunString it doesn’t reload.

but k, and how to use it in CreateSound()?

[editline]21st October 2011[/editline]

Because I made a lua reload function, without RunString it doesn’t reload.

but k, and how to use it in CreateSound()?

[editline]21st October 2011[/editline]

or Emitsound

[editline]21st October 2011[/editline]

or Emitsound

[editline]21st October 2011[/editline]

Doesn’t work on EmitSound() and CreateSound() as the second parameter is already in use, obviously.
Damn, need to fix my CreateSound() and EmitSounds() now… but how?

Noticed: “…/” only doesn’t work on clientside, which is a problem for my rain, thunder and snow entitiy.

Works for everyone else so it’s obviously you. i just tested it with a text file also i’m pretty sure you can’t read .lua files…

You can’t read .lua files. And even then, file.Read only works inside the data folder.

EDIT: I think.

Wtf? I can read lua files, otherwise I couldn’t make a reload clientside *.lua script.

That is why I had to make RunString()
RunString(file.Read("…/lua/autorun/client/SomeLuaFile.lua"))
like this I could reload lua files, but now it isn’t working anymore.

JUST WHAT IS NOT WORKING IS “…/” CLIENTSIDE ON CREATESOUND() AND EMITSOUND() and that’s what I need. Not for a fucking *.txt file.

[editline]22nd October 2011[/editline]

Here is my old fully simple lua reload script:



concommand.Add( "cl_lua_reload", function()
	print("///////////////////////////////")
	print("// Client LUA files Reloading...")
	for _,lua in pairs(file.Find("../lua/autorun/client/*.lua")) do
		RunString(file.Read("../lua/autorun/client/".. lua))
		print("//  autorun/client/".. lua .."!")
	end
	print("// Finished Reloading.")
	print("///////////////////////////////")
end)


Why are you trying to play files outside the sounds folder?

I am not trying to play sound files outside the sounds folder, I am trying to play them inside the addons folder with “…/” extension like this:



            self.Rain_loop = CreateSound( plyer, "../sound/4n_sounds/weather/rain_loop.wav" )


[editline]22nd October 2011[/editline]

btw that is clientside.

[lua]concommand.Add( “cl_lua_reload”, function()
print("///////////////////////////////")
print("// Client LUA files Reloading…")
for _,lua in pairs(file.FindInLua(“autorun/client/*.lua”)) do
RunString(file.Read(“lua/autorun/client/”…lua,true) or “print(“empty file”)”)
print("// autorun/client/"…lua…"!")
end
print("// Finished Reloading.")
print("///////////////////////////////")
end)[/lua]

I already fixed that problem.

Now I need to find a way to fix
CreateSound() and EmitSound() on clientside. (if the sound should be played INside the addons folder)

[editline]22nd October 2011[/editline]

Seems that you finally get it that ON CLIENTSIDE it is impossible now to CreateSound() and EmitSound() OUT OF the ADDONS Folder., huh?

[editline]22nd October 2011[/editline]

I am the worst person on earth. I looked up on the folder
self.Rain_loop = CreateSound( plyer, “…/sound/4n_sounds/weather/rain_loop.wav” )
and there was no rain_loop.wav WTF
I use to have all my toybox entities on my PC and code them outside the toybox, the snow_loop and earthquake sounds are there, but where is the rain_loop? wtf… naah going to test it with snow_loop.wav

[editline]22nd October 2011[/editline]

nope doesn’t work

Post in the niggles thread if you want garry to have a look and fix it.

Done! http://www.facepunch.com/threads/1089190?p=32907390&viewfull=1#post32907390

Um if your trying to do a sound in an addons folder, put the sound file in a folder called sound inside the addons folder. As for trying to read outside the data file you have to pass a boolean arguement file.Read('path.txt", true)

I am not dumb. lol I already fixed it. It’s just that I uses both ways:
“…/” and without “…/”
So how couldn’t I notice it myself? lol