PDA

View Full Version : Help with tutorial chapter 7



laice
04-23-2011, 05:17 AM
Hi, I'm new to Novashell and somewhat new to Lua and I've been going through the tutorials on the site.

I had a bit of trouble with chapter 6, and even though my code matched the source line for line I had a lot of problems. Since replacing my scripts with the tutorial scripts didn't fix anything, I figured I had messed up some small detail in the visual interface, and wanting to continue I resumed with the source provided in chapter 7.

I downloaded the "chapter 6 completed" source file and made a new world for it, as well as installing the crayon animation into it's specified directory. Then I entered the very first line of code that is added from the tutorial (bolded):



function OnInit() //run upon initialization
this:SetVisualProfile("top_crayon/top_crayon.xml", "top_crayon");
this:GetBrainManager():Add("StandardBase","");
//hint to the path-finding system that it can ignore this while computing paths if it needs to
this:SetIsCreature(true);
end


This gave me two errors

The first:
-1:worlds/DragonEggs/script/player.lua:6: attempt to call method 'setVisualProfile' (a nil value)

The second:
Must add a base brain before state Idle can be set.

The second error repeats continuously.

This has me baffled because everything is stock provided by the tutorial, and as I've just started learning Lua I don't know enough to debug this on my own. I looked through the forums and couldn't find anything.

Otherwise, I really like the interface compared to other 2D game engines and would like to learn more, but I seem to have hit a roadblock.

Seth
04-23-2011, 10:30 AM
Hi laice,

Check your player.lua script carefully.

I'll bet you dollars to dragons that you have:


this:setVisualProfile("top_crayon/top_crayon.xml", "top_crayon");

instead of:

this:SetVisualProfile("top_crayon/top_crayon.xml", "top_crayon");

See the s? Yeah, the functions are all case sensitive. That cryptic error means it couldn't locate the function.