Jump to content

Script Error using Random scripts


R.E.Z.
 Share

Recommended Posts

Hello,

 

I do reffer to the following random files:

 

http://www.leadwerks.com/werkspace/files/download/420-random-output-scripts/

 

When I do use f.e. the random4.lua script,

I get the following Script Error:

 

attempt to index global 'os' (a nil value)

Line 2

 

math.randomseed(os.time())

 

Might anyone know help to this problem?

That would be great smile.png

 

C.U. R.E.Z.

Leadwerks Standart Edition RTS Creator

Link to comment
Share on other sites

Maybe Josh removed os object? Just comment out that line to see if you can get things working. That line just makes sure you get a random output. Without it, you'll get the same one each time, but for testing just comment it out to make sure it works. Then we can work on how to get that working again.

Link to comment
Share on other sites

Hello,

 

@ Rick: Now I commented this line out:

 

--math.randomseed(os.time())

 

I do receive no Script Error anymore ... but ... ALL 4 sounds are played simultaneously. No random effect.

What object or (variable?) could be randomed to substitude a 'os-object' to make it work?

 

Does anyone might new help?

 

C.U. R.E.Z.

Leadwerks Standart Edition RTS Creator

Link to comment
Share on other sites

By default, Lua games run from the editor are now run in sandbox mode. This disables potentially dangerous libraries like the os library. There's a checkbox in the Options dialog you can use to disable sandboxing.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Hello,

 

thank You for Your Help smile.pngsmile.pngsmile.png

 

With the change "Time:Millisecs()" the script runns with sandbox.lua enabled.

Keeping the script in original style "os.time()" the script runns when sandbox.lua disabled.

But ... In both cases the 4 sounds are played simultaneously.

 

I am sorry, cant load up a screen of my flowgraph. (Do not own Webspace)

 

Might anyone knew help?

That would be nice smile.png

 

C.U. R.E.Z.

Leadwerks Standart Edition RTS Creator

Link to comment
Share on other sites

I think that collision output is firing every frame which would make sense as to why it seems like all 4 are playing. It's probably playing constantly while you are inside the collision and on top of each other making it sound horrible right?

 

Look in my sig for the wiki link and use the Lua section and look for the collision trigger script there. This one has an OnEnter and OnLeave that you can use to make it trigger once per collision.

  • Upvote 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...