Lua problems... Don't bother to read.
Moderator: Coders of Rage
- MarauderIIC
- Respected Programmer
- Posts: 3406
- Joined: Sat Jul 10, 2004 3:05 pm
- Location: Maryland, USA
Re: Lua problems...
Use the debugger to step through?
I realized the moment I fell into the fissure that the book would not be destroyed as I had planned.
- PixelP
- Chaos Rift Regular
- Posts: 153
- Joined: Tue Oct 07, 2008 12:23 pm
- Programming Language of Choice: c/c++
- Location: sweden
- Contact:
Re: Lua problems...
The main loop in the engine?MarauderIIC wrote:Use the debugger to step through?
- MarauderIIC
- Respected Programmer
- Posts: 3406
- Joined: Sat Jul 10, 2004 3:05 pm
- Location: Maryland, USA
Re: Lua problems...
Yeah, since you said it's not working in the engine either.
I realized the moment I fell into the fissure that the book would not be destroyed as I had planned.
- Falco Girgis
- Elysian Shadows Team
- Posts: 10294
- Joined: Thu May 20, 2004 2:04 pm
- Current Project: Elysian Shadows
- Favorite Gaming Platforms: Dreamcast, SNES, NES
- Programming Language of Choice: C/++
- Location: Studio Vorbis, AL
- Contact:
Re: Lua problems...
I'm curious as to how exactly your map system works. Are you not actually reading in your maps and storing them in some sort of array? Are you actually parsing through the map file in-game?
- PixelP
- Chaos Rift Regular
- Posts: 153
- Joined: Tue Oct 07, 2008 12:23 pm
- Programming Language of Choice: c/c++
- Location: sweden
- Contact:
Re: Lua problems...
MarauderIIC wrote:Yeah, since you said it's not working in the engine either.
Code: Select all
void ToFile(char msg[40]) {
Debug << msg << std::endl;
Debug.flush();
}
if(y > 1) {
Log("start");
Map.close();
Log("end");
}
GyroVorbis wrote:I'm curious as to how exactly your map system works. Are you not actually reading in your maps and storing them in some sort of array? Are you actually parsing through the map file in-game?
Code: Select all
//globals.h
std::fstream Map;
char map_name[40];
//lua.h
int KillMap(lua_State* L) {
Map.close();
return 1;
}
int SetMap(lua_State* L) {
strcpy(map_name, lua_tostring(L, -1));
Map.open(map_name, std::fstream::in);
return 1;
}
//level.h
void LevelClass::MapTiles() {
//layer 1
for(int j=0;j<18;j++) {
for(int i=0;i<18;i++) {
Map >> LevelMap1[j][i];
}
}
//layer 2
for(int j=0;j<18;j++) {
for(int i=0;i<18;i++) {
Map >> LevelMap2[j][i];
}
}
//layer 3
for(int j=0;j<18;j++) {
for(int i=0;i<18;i++) {
Map >> LevelMap3[j][i];
}
}
}
- MarauderIIC
- Respected Programmer
- Posts: 3406
- Joined: Sat Jul 10, 2004 3:05 pm
- Location: Maryland, USA
Re: Lua problems...
Reading all this again, it looks like perhaps your coordinates aren't updating properly.
Evidenced by ytile == 1 working and player starts at 1, 1. But doesn't work when you change == to >. And the condition is hit, every frame, judging by "before/after includes" output.
Evidenced by ytile == 1 working and player starts at 1, 1. But doesn't work when you change == to >. And the condition is hit, every frame, judging by "before/after includes" output.
I realized the moment I fell into the fissure that the book would not be destroyed as I had planned.
- PixelP
- Chaos Rift Regular
- Posts: 153
- Joined: Tue Oct 07, 2008 12:23 pm
- Programming Language of Choice: c/c++
- Location: sweden
- Contact:
Re: Lua problems...
The coordinates do update properly.MarauderIIC wrote:Reading all this again, it looks like perhaps your coordinates aren't updating properly.
I can do like:
Code: Select all
if(ytile > 1) {
SetPlayerYX(5, 5);
}
- PixelP
- Chaos Rift Regular
- Posts: 153
- Joined: Tue Oct 07, 2008 12:23 pm
- Programming Language of Choice: c/c++
- Location: sweden
- Contact:
Re: Lua problems...
I won't need any more help with this... coz I'm going to lay my game structure in another way... thanks for all replys anyway.