I got an error when a script cloned a model from Storage
#1
[Image: 34fjxy1.png]
Reply
#2
Can you post your code?
Reply
#3
Unfortunately not -- it was a fatal error and wiped out my script.

It was something along the lines of

[lua]
table1 = {}
stuff = game.Storage:getChildren()
for q = 1, #stuff do
if stuff[q]:isA("Model") then
table.insert(table1, stuff[q])
end end

function PickItem()
local item = table1[math.random(1, #table1)]
return item
end

while true do
sleep(10)
local players = game.Players:getChildren()
if #players > 0 then
local item = PickItem():clone()
item.Parent = game.World
sleep(100)
item:remove()
end end
[/lua]

There were a few other little bits -- messages and a sort of clock -- but I think that's the skeleton of the script.
Reply
#4
Remember to always use gameConfusedcheduleTask(). That could be causing your problem.
Reply
#5
I'll try and see if that works.
Sad I didn't even run the script and this happened.

error Wrote:java.lang.NegativeArraySizeException
org.jbox2d.dynamics.Island.a(Island.java:118)
org.jbox2d.dynamics.PhysicsWorld.a(PhysicsWorld.java:573)
net.buildism.t.r(World.java:723)
net.buildism.af.h(Game.java:217)
net.buildism.f.p(Main.java:685)
net.buildism.MainApplet.run(MainApplet.java:209)
java.lang.Thread.run(Unknown Source)
Reply
#6
(07-23-2011, 12:53 PM)Qwertygiy Wrote: I'll try and see if that works.
Sad I didn't even run the script and this happened.

error Wrote:java.lang.NegativeArraySizeException
org.jbox2d.dynamics.Island.a(Island.java:118)
org.jbox2d.dynamics.PhysicsWorld.a(PhysicsWorld.java:573)
net.buildism.t.r(World.java:723)
net.buildism.af.h(Game.java:217)
net.buildism.f.p(Main.java:685)
net.buildism.MainApplet.run(MainApplet.java:209)
java.lang.Thread.run(Unknown Source)

Can you send me the game file? Never seen that one before...
Reply
#7
Alright, I'll go back into Build and rebuild the script and then save it.
Reply
#8
(07-23-2011, 01:48 PM)Qwertygiy Wrote: Alright, I'll go back into Build and rebuild the script and then save it.

Did the save button in the new error message work?
Reply
#9
I didn't bother clicking it; it crashed before the script could run so I figured it wouldn't be worth it when I have the script pretty much written down here and the main World saved online.
Here's the game, with the script written the way it was when that last error happened.


Attached Files
.buildism   ErrorSolving.buildism (Size: 13.2 KB / Downloads: 8)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)