Dethlovesme Posted May 1, 2023 Share Posted May 1, 2023 ok I am working on a mod with chat gpt4 as an experiment and need someone with some knowledge on the matter. specifically I am building a mod that will regenerate the volcano biome, I want to know if someone can provide feedback that i can feed to chat gpt to help steer it in the correct direction. here is the code block this code is meant to add a command into the game that will regenerate the volcano biome in shipwrecked, Can someone help me figure out what i need to to say to this language model to steer it in the right direction. The last error i got from this code was 'c_regenvolcano() isnt a defined variable. to be clear this is just the modmain.lua file. the modinfo.lua file is working properly -- Define function to regenerate volcano local function RegenVolcano() local world = TheWorld local map = TheWorld.Map local ocean_spawner = TheWorld.components.ocean_spawner -- Create a coroutine local co = coroutine.create(function() -- Disable world generation saving to prevent save file corruption if TheNet:IsDedicated() then TheNet:Announce("Disabling world saving for regeneration process.") world.ismastersim:SetPersistentString("world", "false") end -- Yield the coroutine for 2 seconds coroutine.yield(2) -- Regenerate volcano biome for _, node in ipairs(map:GetNodesWithTag("volcano")) do map:ResetTileAtPoint(node.x, 0, node.y) end for _, node in ipairs(map:GetNodesWithTag("volcanoonwater")) do map:ResetTileAtPoint(node.x, 0, node.y) end -- Yield the coroutine for 3 seconds coroutine.yield(3) -- Respawn ocean resources ocean_spawner:RegenerateResources() -- Yield the coroutine for 3 seconds coroutine.yield(3) -- Enable world generation saving if TheNet:IsDedicated() then world.ismastersim:SetPersistentString("world", "true") TheNet:Announce("World saving enabled. Regeneration complete.") else TheNet:Announce("Regeneration complete.") end end) -- Start the coroutine with a task that resumes it every frame TheWorld:DoPeriodicTask(0, function() local status, delay = coroutine.resume(co) -- Resume the coroutine and get its status and delay if not status then -- If the coroutine has an error, print it print(coroutine.status(co)) print(delay) elseif delay then -- If the coroutine has a delay, pause the task until the delay is over TheWorld:PushEvent("pauseperiodictask", {taskid = co}) TheWorld:DoTaskInTime(delay, function() TheWorld:PushEvent("resumeperiodictask", {taskid = co}) end) elseif coroutine.status(co) == "dead" then -- If the coroutine is done, cancel the task TheWorld:PushEvent("cancelperiodictask", {taskid = co}) end end) end -- Add the console command _G.c_regenvolcano = RegenVolcano the language model has been going in circles about the way to declare the variable in the file and everytime it gives me an edit if it doesnt straight up crash then the console gives me the error variable not defined Link to comment Share on other sites More sharing options...
Rickzzs Posted May 1, 2023 Share Posted May 1, 2023 This task is too complicated for gpt model. Either break it down or just try another task, to delete the volcano save. If you don't know how correct the code is, gpt neither. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.
Please be aware that the content of this thread may be outdated and no longer applicable.