MVAR problem

Yossarian

First time out of the vault
I'm trying to learn how to use MVARs and this is what I have so far:
23rd.h
Code:
#ifndef 23rd_H
#define 23rd_H
// Map vars for 23rd.map Map.
//MAP_GLOBAL_VARS:
//GLOBAL                                        NUMBER
// All Map Vars need to start w/ MVAR_
#define MVAR_Serg_Left                          (0)
#endif // 23rd_H

23rd.gam
Code:
//MAP_GLOBAL_VARS:
MAP_GLOBAL_VARS:
//GLOBAL                                        NUMBER
// All Map Vars need to start w/ MVAR_
MVAR_Serg_Left                          :=0;    //      (0)

so I included it in my script like this
Code:
/* Include Files */
#include "..\headers\define.h"
#include "..\headers\23rd.h"
and tried to access it like this
Code:
set_map_var(MVAR_Serg_Left,1);
I get compiler error Undefined symbol MVAR_Serg_Left. I read in a previous post that you can use export and import to use map variables, but then someone said that it was not necessary. So has anyone gotten their map variables to work without using exp. imp. ? If so can you help me figure out what I'm doing wrong?
Thanks a lot for your help.
 
Hi Yossarian.
You have to include your 23rd.H in the map script as well. In order to have MVARs work the .H must be present in both the map and critter scripts. I found no mistakes in your .H and .GAM, so this should be the only trouble. As a side note in the original headers MVAR number zero always is MVAR_Town_Rep. I don't know if this is mandatory, or it simply is a convention. The whole thing should work just the same.
Cheers.
 
I get compiler error Undefined symbol MVAR_Serg_Left
That means simply that something is wrong with definition of this var in 23rd.h or you included this file wrong or something like that.
But i too do not see any code bugs sorry.


You have to include your 23rd.H in the map script as well. In order to have MVARs work the .H must be present in both the map and critter scripts.

errrrr, well this is not true. Map vars (from *gam files) have nothing to do with map script and to make map variable really work in game you need only put it in *gam file, nothing more, after that you can use it by number in script ( not by name we don't added this var to map.H)
 
Yeah I couldn't find out what the problem was, so Im guessing it was because my files had started with numbers (23rd.h, 23Serg.ssl, etc). I copied the code from all the script and header files to new ones that started with letters and they work fine. Ill try to confirm this latter , right now im trying to get one of the scripts to link to its .msg file. :x :x . I don't think ive gone one day without running into some problems.
 
I'm positive that the problem was in the name of the header and .gam file. Apparently they can't start with numbers. Sorry if you guys already knew this. Damn i really wanted to give the files street numbers. Oh well.
 
Back
Top