generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Problem script

Previous Thread :: Next Thread 
xFortunato is not online. xFortunato
Joined: 25 Nov 2010
Total Posts: 865
07 Oct 2011 02:02 PM
if script.Parent.localdir.Value*22.5*math.pi/180 - game.Workspace.Vars.wdir.Value*22.5*math.pi/180 <= (56.25*math.pi/180) or script.Parent.localdir.Value*22.5*math.pi/180 - game.Workspace.Vars.wdir.Value*22.5*math.pi/180 >= (-56.25*math.pi/180) then
print 'working'
end

localdir.Value and wdir.Value are both integers, 0 to 15

This script is supposed to determine whether or not localdir is within 56.25 degrees of wdir, but it is just printing 'working' all the time

(I would use a .magnitude instead of the two <= and >= comparisons, but it isn't accepting number values in the magnitude method)
Report Abuse
xFortunato is not online. xFortunato
Joined: 25 Nov 2010
Total Posts: 865
07 Oct 2011 02:19 PM
To complex for the forums?
Report Abuse
1WOOF1 is not online. 1WOOF1
Joined: 03 May 2009
Total Posts: 20682
07 Oct 2011 02:20 PM
[ Content Deleted ]
Report Abuse
xFortunato is not online. xFortunato
Joined: 25 Nov 2010
Total Posts: 865
07 Oct 2011 02:26 PM
Never mind I figured out a better way to do this
Report Abuse
xFortunato is not online. xFortunato
Joined: 25 Nov 2010
Total Posts: 865
07 Oct 2011 02:30 PM
Nope that's a lie the new way won't work. Original question?
Report Abuse
xFortunato is not online. xFortunato
Joined: 25 Nov 2010
Total Posts: 865
07 Oct 2011 02:54 PM
Let me try to rephrase if this is too much...
I have two integers, that can be anywhere from 0 to 15

Now, I need to find out if these two numbers are within 3 numbers of each other
Example: if a=8 and b=6, then yes their magnitude is less than or equal to 3

However, 15 is one number away from 0. This is why I need to convert them to radians
Report Abuse
myrco1001 is not online. myrco1001
Joined: 17 Sep 2010
Total Posts: 2574
07 Oct 2011 03:11 PM
You need spaces, so like:

Value * 28

-♂ MYRCO♂-
Scripter, music obsessed, atheist and dutch. What else?
Report Abuse
xFortunato is not online. xFortunato
Joined: 25 Nov 2010
Total Posts: 865
07 Oct 2011 03:30 PM
The spaces aren't the problem.


I found out a solution from a chat room online though.

There's an operator called mod, or % that can be used in situations like these, if anyone is interested
Report Abuse
myrco1001 is not online. myrco1001
Joined: 17 Sep 2010
Total Posts: 2574
07 Oct 2011 03:42 PM
I didn't even read the full post anyways.
And % is module yes, it works like this:

function %(x, y)
if x - y < 0 then return 0 end
repeat
x = x - y
until x - y < y
return x
end

-♂ MYRCO♂-
Scripter, music obsessed, atheist and dutch. What else?
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image