|
| 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 |
|
|
|
| 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
|
  |
| 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
|
  |
| 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 |
|
|
|
| 22 Jul 2014 06:25 PM |
| k thx. Is there a way to use optional parameters in a function? |
|
|
| Report Abuse |
|
|
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 |
|
|
| |
|
|
| 22 Jul 2014 06:35 PM |
Error message for your script, second line:
attempt to index 'aa' (a nil value) |
|
|
| Report Abuse |
|
|
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
|
  |
| 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
|
  |
| 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 |
|
|
|
| 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 |
|
|
|
| 22 Jul 2014 06:40 PM |
| @UncleTaz I agree, I'm trying to figure out what the problem is. |
|
|
| Report Abuse |
|
|
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
|
  |
| 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 |
|
|
|
| 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 |
|
|
|
| 22 Jul 2014 06:48 PM |
what starts with a b and ends with a p?
hint: B-mp |
|
|
| Report Abuse |
|
|
128GB
|
  |
| Joined: 17 Apr 2014 |
| Total Posts: 8056 |
|
|
| 22 Jul 2014 07:04 PM |
Is it blimp? bedlamp? bethump? blowlamp? buckjump? blackdamp? |
|
|
| Report Abuse |
|
|
|
| 22 Jul 2014 07:50 PM |
| Bump was the word. Though I could accept blimp. |
|
|
| Report Abuse |
|
|