|
| 13 Sep 2015 05:46 PM |
I've been scripting for quite a while, and I would like a scripting challenge. Make them medium/hard, and no GUI control please.
>print(9+10) 21 |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 13 Sep 2015 05:47 PM |
Make it so when I do:
x = 5 y = 10 print(x + y)
I get 100, without replacing the print function. |
|
|
| Report Abuse |
|
|
IoIiderp
|
  |
| Joined: 05 Feb 2012 |
| Total Posts: 8613 |
|
|
| 13 Sep 2015 05:48 PM |
nope = print print = nope(21) |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 13 Sep 2015 05:49 PM |
| That wouldn't work, and I said 'without replacing the print function' |
|
|
| Report Abuse |
|
|
IoIiderp
|
  |
| Joined: 05 Feb 2012 |
| Total Posts: 8613 |
|
|
| 13 Sep 2015 05:51 PM |
Why wouldn't it work? And nothing said about that in the original post, but maybe there is. I seem to turn blind at 0:51 AM |
|
|
| Report Abuse |
|
|
|
| 13 Sep 2015 05:53 PM |
x = 99 y = 1 print(x + y)
You never said we cant replace the values :P |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 13 Sep 2015 05:53 PM |
Oh wait, you're talking about the original post, not my challenge. I think that's just his signature (playing a dumb joke).
Also it wouldn't work because you would print(21) once and the print function would now be nil |
|
|
| Report Abuse |
|
|
IoIiderp
|
  |
| Joined: 05 Feb 2012 |
| Total Posts: 8613 |
|
|
| 13 Sep 2015 06:02 PM |
k.
But I copied the print function nope = print print = 123
nope(print)
Pretty sure that's gonna return a function. |
|
|
| Report Abuse |
|
|
IoIiderp
|
  |
| Joined: 05 Feb 2012 |
| Total Posts: 8613 |
|
| |
|
|
| 13 Sep 2015 06:02 PM |
How about making a mount that you could ride while the tool is selected (also changing the player's speed)?
I do need the script x.x :
http://www.roblox.com/Forum/ShowPost.aspx?PostID=173994118
~MightyDantheman |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 13 Sep 2015 06:03 PM |
You didn't 'copy' it but regardless, you still are missing the point. 'without replacing the print function' I meant you can't replace the global print variable, it's impossible to literally replace the print function from Lua anyways. |
|
|
| Report Abuse |
|
|
IoIiderp
|
  |
| Joined: 05 Feb 2012 |
| Total Posts: 8613 |
|
| |
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 13 Sep 2015 06:08 PM |
I'll just reword my challenge:
x = 5 y = 10 print(x + y)
Must print 100. You can not alter any of those 3 lines or add anything in between them. You also can not replace the global print variable or declare a local print variable. The output of '100' must result from the print on line 3 of the unalterable block. |
|
|
| Report Abuse |
|
|
|
| 13 Sep 2015 06:12 PM |
"x+y" = 100
Is that cheating? x.x I can't think of any other way to do that without editing.
~MightyDantheman |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 13 Sep 2015 06:15 PM |
| You can add lines above the variable declarations, you just can't edit those 3 lines and they all have to be in that order (no adding stuff in between) |
|
|
| Report Abuse |
|
|
|
| 13 Sep 2015 08:34 PM |
@cntkillme
x = 5 y = 10 print(x + y + 85) |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 13 Sep 2015 08:35 PM |
"can't edit those 3 lines" Do you know what edit means? |
|
|
| Report Abuse |
|
|
|
| 13 Sep 2015 08:41 PM |
x = 5 y = 10
y = y + 85
print(x + y) |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 13 Sep 2015 08:42 PM |
"You can not alter any of those 3 lines or add anything in between them." Do you people read? |
|
|
| Report Abuse |
|
|
TexasOreo
|
  |
| Joined: 08 Apr 2014 |
| Total Posts: 25 |
|
|
| 13 Sep 2015 08:53 PM |
local mt = { __newindex = function(t, k, v) rawset(t, k, 50) end } setfenv(1, setmetatable({print = print}, mt))
x = 5 y = 10 print(x + y) |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 13 Sep 2015 08:53 PM |
| The challenge was for OP but you win. |
|
|
| Report Abuse |
|
|
62GB
|
  |
| Joined: 03 Oct 2011 |
| Total Posts: 4157 |
|
|
| 13 Sep 2015 08:59 PM |
| I'm sure the OP would have been able to figure that out. |
|
|
| Report Abuse |
|
|
Voidacity
|
  |
| Joined: 05 Nov 2009 |
| Total Posts: 15759 |
|
|
| 13 Sep 2015 09:24 PM |
Let's make it more challenging. Exactly same rules as cntkillme stated but now the variables are local. Should work on both rbx.lua and Lua 5.1.
local x = 5 local y = 10 print(x + y) |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
| |
|