Can't #import library

Archive of the old editing forum
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
Locked
fiendohell
Posts: 35
Joined: Thu Aug 07, 2008 2:05 pm

Can't #import library

Post by fiendohell »

I can't access library scripts using #import. I have the compiled library between start and end lumps and I have it referenced in LOADACS.

This is how I have my files setup:
mapset.acs (library)

Code: Select all

#library "mapset"
#include "zcommon.acs"
......
BEHAVIOR

Code: Select all

#import "mapset"
#include "zcommon.acs"
...
LOADACS

Code: Select all

MAPSET
...
When I go to compile the behavior lump in doom builder, an error saying that map set was not found. I can't figure out what I'm doing wrong.
User avatar
Demolisher
Posts: 1749
Joined: Mon Aug 11, 2008 12:59 pm
Graphics Processor: nVidia with Vulkan support
Location: Winchester, VA
Contact:

Re: Can't #import library

Post by Demolisher »

try using

Code: Select all

#import "mapset.acs"
User avatar
XutaWoo
Posts: 4005
Joined: Sat Dec 30, 2006 4:25 pm
Location: beautiful hills of those who are friends
Contact:

Re: Can't #import library

Post by XutaWoo »

Wait, why are you trying to import MAPSET...if it's already being loaded by LOADACS?

LOADACS will automatically add the scripts in the ACS file without them needing to be #imported.
fiendohell
Posts: 35
Joined: Thu Aug 07, 2008 2:05 pm

Re: Can't #import library

Post by fiendohell »

MAPSET is a compiled file, so don't I have to use #import?
XutaWoo wrote:Wait, why are you trying to import MAPSET...if it's already being loaded by LOADACS?

LOADACS will automatically add the scripts in the ACS file without them needing to be #imported.
If i take out the import statement, it doesn't recognize any of my library defined variables or scripts.
User avatar
randi
Site Admin
Posts: 7749
Joined: Wed Jul 09, 2003 10:30 pm
Contact:

Re: Can't #import library

Post by randi »

fiendohell wrote:MAPSET is a compiled file, so don't I have to use #import?
MAPSET is compiled, yes, but you import the original source file, not the compiled file. This lets ACC find out what you have in there.
fiendohell wrote:If i take out the import statement, it doesn't recognize any of my library defined variables or scripts.
If you don't need this library to be accessible from every map, including ones that you did not import it from, then you don't need to list it in LOADACS.
User avatar
Salad Viking
Posts: 752
Joined: Tue Apr 20, 2010 8:58 pm
Location: In high orbit

Re: Can't #import library

Post by Salad Viking »

fiendohell wrote:MAPSET is a compiled file, so don't I have to use #import?
XutaWoo wrote: Wait, why are you trying to import MAPSET...if it's already being loaded by LOADACS?

LOADACS will automatically add the scripts in the ACS file without them needing to be #imported.
If i take out the import statement, it doesn't recognize any of my library defined variables or scripts.
LOADACS automatically loads an acs file whenever a map is started. It's used for mods that are playable on any mapset. A library, on the other hand, is an acs file that other acs files can reference.

It looks like you're doing it right, but you do need to add the ".acs" extension to your import statement. As for why it's not working, are you trying to compile in Doom Builder? That doesn't seem to work for me, so try compiling your SCRIPTS files in SLumpEd. That works fine for me.
User avatar
randi
Site Admin
Posts: 7749
Joined: Wed Jul 09, 2003 10:30 pm
Contact:

Re: Can't #import library

Post by randi »

Salad Viking wrote:As for why it's not working, are you trying to compile in Doom Builder? That doesn't seem to work for me
Providing the proper path to the library's source file should be enough.
fiendohell
Posts: 35
Joined: Thu Aug 07, 2008 2:05 pm

Re: Can't #import library

Post by fiendohell »

Ah, I see the error of my ways. I was under the impression that ACC could somehow read compiled files or something.

So in SLumpED, I put the MAPSET.acs (the library file) in my wad, compiled that, and used LOADACS lump to reference it like I did before since all the maps in the game need to initialize from it. In SCRIPTS.acs, I used #import "mapset.acs" and was able to compile it just fine now that ACC could read MAPSET.acs.
randy wrote:
Salad Viking wrote:As for why it's not working, are you trying to compile in Doom Builder? That doesn't seem to work for me
Providing the proper path to the library's source file should be enough.
This is correct. I could only compile from doom builder using the full directory path to an external acs file.
User avatar
CodeImp
Posts: 456
Joined: Sun Dec 28, 2003 7:40 pm
Location: Netherlands
Contact:

Re: Can't #import library

Post by CodeImp »

Place the ACS file in the directory where your WAD is and it should work without path, or use a path relative to your WAD location.
User avatar
Salad Viking
Posts: 752
Joined: Tue Apr 20, 2010 8:58 pm
Location: In high orbit

Re: Can't #import library

Post by Salad Viking »

CodeImp wrote:Place the ACS file in the directory where your WAD is and it should work without path, or use a path relative to your WAD location.
This works well (thank you!), but why can't Doom Builder compile when the library is in the wad already? As I previously stated, this works without fault in SLumpEd.
User avatar
CodeImp
Posts: 456
Joined: Sun Dec 28, 2003 7:40 pm
Location: Netherlands
Contact:

Re: Can't #import library

Post by CodeImp »

Because when you compile your script, it is not compiled from within your WAD, but as a separate file. I would have to seriously modify the ACC compiler to make it work with WADs and separate files mixed.
Locked

Return to “Editing (Archive)”