I need to do something like this:
Code: Select all
function onLoop()
level_code == string.match(world.levelFileName, "%D+%d+")
end
I need to be able to access the level's filename, but there's not a world.levelFilename value, and I can't locate the memory address for it.
I need to do something like this: Code: Select all function onLoop() | ||
Well there is the "Level"-Class (only for the overworld), which hasn't been documented yet but is already free to use:
https://github.com/Wohlhabend-Networks/LunaDLL/blob/master/LunaDll/LuaMain/LunaLuaMain.cpp#L667 So you could do: Code: Select all function onLoop()I know this is currently more a hack than a good way. I will implement more for the level object, if I find more time in the next couple weeks. (School has started again :/) ▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬ Signature.start() ▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬
▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬ Signature.end() ▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬ | ||
So, using this method I will have to do this:
Code: Select all if(theLevelToCompare == firstLevel)thenfor each level? This doesn't really save time for me. The idea is to use as little code as possible, so I can just grab the information from the level filename. Also, this seems complicated when I could just go through the level name: Code: Select all if(world.levelTitle) thenWhat I'm trying to do is run this, when the level name format is something like "mi2-Mushroom Road.lvl": Code: Select all function onLoop()This would set level_code to mi2. Then I would get the data I needed using the level_code variable: Code: Select all if saveData:get(level_code .. "-dc-1") == 1 thenBut there's no rush for me to get this done. I'll just wait until you've implemented something like that. ![]() | ||
So with the new version you should now have access to the level filename.
But I did change some fields in the Level class: "Level.levelTitle" --> "Level.title" and it is now of type string instead of a VBStr object. ▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬ Signature.start() ▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬
▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬ Signature.end() ▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬ | ||
Does that mean that this will work now:
Code: Select all function onLoop()Or do I need to do something else? | ||
Code: Select all local levelTitle = world.levelTitle(would recommend to write an own function for this. ▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬ Signature.start() ▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬
▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬ Signature.end() ▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬ | ||
The code won't work. I probably just screwed it up when I made some changes:
Code: Select all function getLevelCode()It returns this error: I removed the "local" from "levelTitle" because it is used to check if the function needs to be run in onLoop. This keeps it from running on every loop. | ||
Nope, it was my fault:
Code: Select all levelTitle = world.levelTitleto Code: Select all levelTitle = world.levelTitle.str▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬ Signature.start() ▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬
▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬ Signature.end() ▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬ | ||
Who is online (over the past 5 minutes)Users browsing this forum: 1 guest | ||