Author Topic: Include Issue?  (Read 2534 times)

0 Members and 1 Guest are viewing this topic.

Offline Decicus

  • Hero Member
  • *****
  • Posts: 552
  • Karma: 81
    • Alex Thomassen
Include Issue?
« on: September 06, 2013, 11:44:53 AM »
So here's the story: I was working on the scoreboard again, and I was attempting to add a specific part by removing it from the main file, making a new one, and doing the whole "include("filename.lua")" thing.

I made a file called "custom_ranks.lua", added an "include("custom_ranks.lua")" in the main "sb_row.lua" file and then tried to join, but it kicked me saying that the file didn't exist.

What I have done:
- Made sure that the filename/directory is correct. The filename + include + placement was correct, because the custom_ranks.lua file was inside the same folder as the sb_row.lua.
- Made sure everything was correct, then reloading the map using "changelevel".
- Did a full restart by doing "exit" in the server, then starting it back up.

My error is this:
Code: [Select]
Couldn't include file 'custom_ranks.lua' (File not found) (@gamemodes/terrortown/gamemode/vgui/sb_row.lua (line 7))
I have no clue why it's doing this, because I've double checked everything. And all of it seems to be correct. And that is the only error I'm getting. Any of you guys know of this problem?
Contact information:
E-mail: alex@thomassen.xyz.
You can also send a PM.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Include Issue?
« Reply #1 on: September 06, 2013, 12:27:46 PM »
Tried a AddCSLuaFile before the include anywhere?
It's possible your original file is known/on the server, and shared automatically.
Your additional file would need to be known by the server to include it on the client (even if you've already copied it to your client)

(This is my educated guessing. I've no experience with scoreboards/gamemodes)
« Last Edit: September 06, 2013, 12:34:46 PM by JamminR »
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline Decicus

  • Hero Member
  • *****
  • Posts: 552
  • Karma: 81
    • Alex Thomassen
Re: Include Issue?
« Reply #2 on: September 06, 2013, 12:43:18 PM »
So I tried adding a "AddCSLuaFile("custom_ranks.lua")" before the include. No luck. (same error)
I tried only having AddCSLuaFile, the scoreboard didn't have the rank section.
I also tried removing the include + AddCSLuaFile completely. Scoreboard didn't have the rank section.

Thanks for giving me suggestions, but none of them worked.
Contact information:
E-mail: alex@thomassen.xyz.
You can also send a PM.

Offline iSnipeu

  • Jr. Member
  • **
  • Posts: 83
  • Karma: 12
Re: Include Issue?
« Reply #3 on: September 07, 2013, 05:37:15 AM »
You only need to add AddCSLuaFile() to the top of the file you want sent, as calling it without an arg will add the current file.

Offline Decicus

  • Hero Member
  • *****
  • Posts: 552
  • Karma: 81
    • Alex Thomassen
Re: Include Issue?
« Reply #4 on: September 07, 2013, 06:30:39 AM »
I shouldn't need to use AddCSLuaFile. The only thing I'm doing is to try and move a specific part out of the main file, into another one and still make it possible for the main file to be able to load it from the other file. I'm pretty sure I shouldn't need to use AddCSLuaFile, because if it needs to be loaded clientside, it should already have been done.
Contact information:
E-mail: alex@thomassen.xyz.
You can also send a PM.

Offline iSnipeu

  • Jr. Member
  • **
  • Posts: 83
  • Karma: 12
Re: Include Issue?
« Reply #5 on: September 07, 2013, 07:10:37 AM »
I shouldn't need to use AddCSLuaFile. The only thing I'm doing is to try and move a specific part out of the main file, into another one and still make it possible for the main file to be able to load it from the other file. I'm pretty sure I shouldn't need to use AddCSLuaFile, because if it needs to be loaded clientside, it should already have been done.

It doesn't work like that, you need to tell the server to send the file to the client.

and you need to use AddCSLuaFile on the server, not the client.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Include Issue?
« Reply #6 on: September 07, 2013, 08:20:28 AM »
See? My educated guessing often times is based on poor recollection of fact.
:)
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline Decicus

  • Hero Member
  • *****
  • Posts: 552
  • Karma: 81
    • Alex Thomassen
Re: Include Issue?
« Reply #7 on: September 07, 2013, 08:42:53 AM »
Well, I tried that earlier (I just realized), but that didn't work :/
Contact information:
E-mail: alex@thomassen.xyz.
You can also send a PM.

Offline iSnipeu

  • Jr. Member
  • **
  • Posts: 83
  • Karma: 12
Re: Include Issue?
« Reply #8 on: September 07, 2013, 08:55:53 AM »
Remember that since you're not in the same file you want to add you'll need to put the name of it.
Also add something like print("File ran!") above the AddCSLuaFile to make sure the server file is being run.

Offline Decicus

  • Hero Member
  • *****
  • Posts: 552
  • Karma: 81
    • Alex Thomassen
Re: Include Issue?
« Reply #9 on: September 07, 2013, 09:21:46 AM »
I'm confused, do you mind explaining in a different way?
Contact information:
E-mail: alex@thomassen.xyz.
You can also send a PM.