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
 

Is there anything wrong with this script?

Previous Thread :: Next Thread 
SilverArgentum is not online. SilverArgentum
Joined: 01 Nov 2011
Total Posts: 1162
22 Jul 2014 06:21 PM
this function uses parameters that are saved as intvalues. This function sorts the intvalues from lowest to greatest (if there is a more convenient way of doing this, go ahead and post :3)

function char_table(aa, bb)
if aa.Value > bb.Value then -- error (aa is a nil value)
f = aa
d = bb
elseif aa.Value > bb.Value then
f = bb
d = aa
else
n = math.random(1, 2)
if n == 1 then
f = aa
d = bb
else
f = bb
d = aa
end
end
end
Report Abuse
SilverArgentum is not online. SilverArgentum
Joined: 01 Nov 2011
Total Posts: 1162
22 Jul 2014 06:23 PM
NUUUU I WANTED TO DO DAH ;3 NOT DAH :3...

(this post is secretly a bump)
Report Abuse
UncleTaz is not online. UncleTaz
Joined: 19 Aug 2009
Total Posts: 12795
22 Jul 2014 06:24 PM
Of course something is wrong with it.

It doesn't work...
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
22 Jul 2014 06:24 PM
function char_table(aa, bb)
f = aa.Value > bb.Value and aa or (bb.value > aa.Value and b or (math.random() < 0.5 and aa or bb))
d = f == aa and bb or aa
end

Not tested but it worked out in my head lol
Report Abuse
SilverArgentum is not online. SilverArgentum
Joined: 01 Nov 2011
Total Posts: 1162
22 Jul 2014 06:25 PM
k thx. Is there a way to use optional parameters in a function?
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
22 Jul 2014 06:28 PM
Yeah.

function test(reqA, reqB, optA, optB) --req = required, opt = optional
optA = optA or "Default for optA";
optB = optB or "Default for optB";
print(reqA, reqB, optA, optB);
end

test("Say", "Something");
--Output: Say Something Default for optA Default for optB
test("Say", "Something", "Else");
--Output: Say Something Else Default for optB
test("Say", "Something", nil, "Okay");
--Output: Say Something Default for optA Okay
Report Abuse
SilverArgentum is not online. SilverArgentum
Joined: 01 Nov 2011
Total Posts: 1162
22 Jul 2014 06:32 PM
k thx
Report Abuse
SilverArgentum is not online. SilverArgentum
Joined: 01 Nov 2011
Total Posts: 1162
22 Jul 2014 06:35 PM
Error message for your script, second line:

attempt to index 'aa' (a nil value)
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
22 Jul 2014 06:37 PM
Make sure when you input the arguments, aa and bb are IntValue objects
Report Abuse
UncleTaz is not online. UncleTaz
Joined: 19 Aug 2009
Total Posts: 12795
22 Jul 2014 06:38 PM
I don't see how that would be an error when he didn't include AA in none of the parameters...
Report Abuse
UncleTaz is not online. UncleTaz
Joined: 19 Aug 2009
Total Posts: 12795
22 Jul 2014 06:39 PM
The error was problem on your side of the table
Report Abuse
SilverArgentum is not online. SilverArgentum
Joined: 01 Nov 2011
Total Posts: 1162
22 Jul 2014 06:39 PM
Would it injure the script if I put this in a gui inside of the playergui, then called for an intvalue inside a model inside the playergui?
Report Abuse
SilverArgentum is not online. SilverArgentum
Joined: 01 Nov 2011
Total Posts: 1162
22 Jul 2014 06:40 PM
@UncleTaz I agree, I'm trying to figure out what the problem is.
Report Abuse
UncleTaz is not online. UncleTaz
Joined: 19 Aug 2009
Total Posts: 12795
22 Jul 2014 06:41 PM
As long as all the descendants are within something local to the player, then everything should work
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
22 Jul 2014 06:42 PM
I don't get what's so hard to understand?
You just call it like:
char_table(intValueObject, intValueObject);
Report Abuse
SilverArgentum is not online. SilverArgentum
Joined: 01 Nov 2011
Total Posts: 1162
22 Jul 2014 06:44 PM
What about this?


function read_y(g, p, j)
char_table(g, p)
f1 = f
d1 = d
char_table(f1d, j)
f1d = f
f2d = d
char_table(f2d, d1)
f2d = f -- Raike
f3d = d
end
Report Abuse
SilverArgentum is not online. SilverArgentum
Joined: 01 Nov 2011
Total Posts: 1162
22 Jul 2014 06:48 PM
what starts with a b and ends with a p?

hint: B-mp
Report Abuse
128GB is not online. 128GB
Joined: 17 Apr 2014
Total Posts: 8056
22 Jul 2014 07:04 PM
Is it blimp?
bedlamp?
bethump?
blowlamp?
buckjump?
blackdamp?
Report Abuse
SilverArgentum is not online. SilverArgentum
Joined: 01 Nov 2011
Total Posts: 1162
22 Jul 2014 07:50 PM
Bump was the word. Though I could accept blimp.
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