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 » Scripters
Home Search
 

Re: challenge (expert scripters)

Previous Thread :: Next Thread 
cheatmaster18 is not online. cheatmaster18
Joined: 29 Oct 2010
Total Posts: 1871
08 Aug 2012 06:31 AM
challenge (expert scripters):
create a function that will work on this:

_G.graph.Start = -10
_G.graph.End = 10
_G.graph.Step = 1
_G.graph.custom_vars = {}
for x,y,i in _G.graph:f("x*-x") do
print(i,x,y)
end

Info:
Start is where the graph starts
End is where the graph ends
Step is how it counts
custom_vars is custom defineded variables in the formula
f is the function that generates the points to the graph
it have to return three values x, y and the index
index always starts at 1
the function have to check for formula error before it generates the graph points and return error if found

Now it is up to you to find the correct working function to it, the it there and I will check if it is correct

Good luck!
Report Abuse
ArceusInator is not online. ArceusInator
Joined: 10 Oct 2009
Total Posts: 30553
08 Aug 2012 06:39 AM
The challenge is to make the graph count by ones and subtract ten from the end result?

I don't think you've explained this correctly...
Report Abuse
cheatmaster18 is not online. cheatmaster18
Joined: 29 Oct 2010
Total Posts: 1871
08 Aug 2012 06:46 AM
You have to make this function to transform for example the string "x*-x" into a graph function
_G.graph:f("x*-x")

on this "x*-x" when x is equal 2 then, y is equal -4
Report Abuse
su8 is not online. su8
Joined: 06 Mar 2009
Total Posts: 6334
08 Aug 2012 06:49 AM
i dont think you know the meaning of calling functions with :
Report Abuse
cheatmaster18 is not online. cheatmaster18
Joined: 29 Oct 2010
Total Posts: 1871
08 Aug 2012 06:52 AM
I know what it meaning I have created function before I created this challenge my function works.
Report Abuse
ArceusInator is not online. ArceusInator
Joined: 10 Oct 2009
Total Posts: 30553
08 Aug 2012 07:23 AM
I got this and it works

function _G.graph.f(v)
_G.graph.runs = 0

return assert(loadstring([[
if _G.graph.runs < _G.graph.End - _G.graph.Start then
_G.graph.runs = _G.graph.runs + 1
x = _G.graph.Start + (_G.graph.Step * _G.graph.runs)

y = ]] .. v .. [[

return x,y,_G.graph.runs
end]]))
end

But wtf is custom_vars even supposed to mean
Report Abuse
cheatmaster18 is not online. cheatmaster18
Joined: 29 Oct 2010
Total Posts: 1871
08 Aug 2012 07:40 AM
the script is very correct exept of one thing and it is G.graph.Step, when I adds the number 2, doubles the end result and that is not correct and you are missing _G.graph.custom_vars.

_G.graph.custom_vars is to add custom-defined variables into the function

example on use is:
_G.graph.custom_vars = {v=3,w="x+x^2"}

for x,y,i in _G.graph:f("v/w*x")
print(i,x,y)
end
Report Abuse
ArceusInator is not online. ArceusInator
Joined: 10 Oct 2009
Total Posts: 30553
08 Aug 2012 07:56 AM
function _G.graph.f(v)
_G.graph.runs = 0

_G.cvar = {}

for var,val in pairs(_G.graph.custom_vars) do
assert(loadstring("_G.cvar." .. var .. " = " .. val))()
end

return assert(loadstring([[
if _G.graph.Start + (_G.graph.Step * (_G.graph.runs-1)) < _G.graph.End then
_G.graph.runs = _G.graph.runs + 1

x = _G.graph.Start + (_G.graph.Step * (_G.graph.runs-1))

y = ]] .. v .. [[

return x,y,_G.graph.runs
end]]))
end


Am I doing it right?
Report Abuse
cheatmaster18 is not online. cheatmaster18
Joined: 29 Oct 2010
Total Posts: 1871
08 Aug 2012 08:06 AM
got an error when using _G.graph.custom_vars, message:
[string "_G.cvar.w = x*x^2"]:1: attempt to perform arithmetic on global 'x' (a nil value)
and another:
[string "if _G.graph.Start + (_G.graph.Step * (_G.gr..."]:6: attempt to perform arithmetic on global 'v' (a nil value)

custom_vars is still useless.
Report Abuse
ArceusInator is not online. ArceusInator
Joined: 10 Oct 2009
Total Posts: 30553
08 Aug 2012 08:11 AM
When you just tested it, you were making w rely on x, but in the example you gave me you had x relying on w. I have to assign either x or w first, and the first one can't rely on the second one. So which one is relying on which?
Report Abuse
cheatmaster18 is not online. cheatmaster18
Joined: 29 Oct 2010
Total Posts: 1871
08 Aug 2012 08:15 AM
you have to define x before the other variables so they can use it
Report Abuse
ArceusInator is not online. ArceusInator
Joined: 10 Oct 2009
Total Posts: 30553
08 Aug 2012 08:26 AM
I've lost interest in the challenge as I seem to be the only competitor and I don't see any compensation for the lost time.

I leave you to your endeavor, gentlemen. Or gentleman, as it is.
Report Abuse
ninjaknight101 is not online. ninjaknight101
Joined: 04 Apr 2011
Total Posts: 1281
08 Aug 2012 08:56 AM
It feels as if he's changing the rules, and personally I don't understand what he wants us to do...
Report Abuse
cheatmaster18 is not online. cheatmaster18
Joined: 29 Oct 2010
Total Posts: 1871
08 Aug 2012 09:11 AM
I am not changing the rules I am trying to say it in other ways to do it easier to understand, but it looks like I failed.

And this is about to create a working script that will wroks with the script I added at the start, by reading the info.
Report Abuse
cheatmaster18 is not online. cheatmaster18
Joined: 29 Oct 2010
Total Posts: 1871
08 Aug 2012 09:11 AM
*works
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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