A Roblox Community

A community of Robloxians who want to learn to script and build on Roblox Studio.
 
HomeFAQRegisterLog in
If you're a experienced coder make some tutorials! It would really help the site grow.
Make sure you read the rules(Which can be found by clicking here)
If you're a beginner at coding, try some tutorials.
We have many Moderators/Admins watching this site. Contact them with Questions.
Let us know what your favorite sport is. By clicking here to vote (Click here)
This site is becoming inactive. Lets make it active.
Log in
Username:
Password:
Log in automatically: 
:: I forgot my password
Top posters
blueymaddog
 
naknak
 
Supernapalm
 
m27frogy
 
slayer9365
 
myrco919
 
branefreez
 
ninga95
 
CloneTrooper787
 
raboy117
 
Top posting users this month
Latest topics
» Send me an Email
January 8th 2016, 10:14 am by naknak

» [v1.6.0.0] Lua Script Obfuscator [No Bytecode]
July 6th 2015, 7:38 pm by m27frogy

» New Site Possibly
July 6th 2015, 4:16 pm by m27frogy

» Ambassador!
April 15th 2015, 11:40 pm by naknak

» Boop - Tag
April 13th 2015, 9:46 pm by naknak

» Vip Class Script
April 13th 2015, 4:54 pm by naknak

» Who's active?!
April 13th 2015, 4:52 pm by naknak

» Where to go from here.
April 13th 2015, 4:51 pm by naknak

» Genesis Point
July 17th 2014, 7:04 pm by branefreez

» Reward System
July 17th 2014, 5:41 am by m27frogy

» Script Request
July 10th 2014, 11:43 am by naknak

» local scripts?
July 10th 2014, 11:39 am by naknak

» Project: Reconstruction [Died]
July 10th 2014, 11:36 am by naknak

» Hi. I am new here
April 26th 2014, 4:01 pm by altshiftkey

» What's your favorite sport?
January 1st 2014, 2:13 pm by m27frogy

» FlashLight Script
January 1st 2014, 2:11 pm by m27frogy

» Gun Making! [READ DESC]
January 1st 2014, 2:10 pm by m27frogy

» Hi, I am new here!
November 26th 2013, 3:33 pm by Keanu73

» Improve Coding
October 26th 2013, 1:12 pm by pook03

» Simple Button
September 1st 2013, 6:19 pm by branefreez


Share | 
 

 Roblox is stupid, so I'm posting a script here for anyone to fix.

View previous topic View next topic Go down 
AuthorMessage
Guest
Guest



PostSubject: Roblox is stupid, so I'm posting a script here for anyone to fix.   March 12th 2011, 12:51 am

You may have been lead here because of my post on Roblox, or you may just be checking this site. I don't care. Here is what's wrong:


THE FUNCTION:

Code:
local function runScript(msg)
if string.sub(msg, 1, 4):lower() == string.lower("run/") then
print(msg:sub(5) .. " return 1")
local str = loadstring(string.sub(msg, 5) .. " return 1")
getfenv(str).print = OutputPrint -- a function I made
local stat, err = coroutine.resume(coroutine.create(str))
print(stat, err)
repeat wait() until not stat or err == 1 -- I'm still experimenting with this part, but I can't test it until I get the loadstring stuff fixed
print(stat, err)
if err == 1 then
script.Parent.Text = "It worked :D"
wait(3)
script.Parent.Text = "Output GUI"
else
script.Parent.Text = tostring(err)
end
end
end

runScript([[run/print("Hello") wait(1) error("wut")]])

THE OUTPUT:

Fri Mar 11 23:43:13 2011 - [string "print("Hello") wait(1) error("wut") return ..."]:1: wut
Fri Mar 11 23:43:13 2011 - [string "print("Hello") wait(1) error("wut") return 1"], line 1 stack end

I've been trying to fix my SB, 'cause ever since I switched it from pcall to coroutines, it just didn't work. Obviously, the error is coming from the loadstring stuff, but I don't understand why, since coroutine.resume is supposed to run stuff in protected mode ._.

HALP.
Back to top Go down
blueymaddog
Administrator
Administrator
avatar

Posts : 1081
Join date : 2010-12-09
Age : 18

PostSubject: Re: Roblox is stupid, so I'm posting a script here for anyone to fix.   March 14th 2011, 5:46 am

I've modified part of it and it might work:

local function runScript(msg)
if string.sub(msg, 1, 4):lower() == string.lower("run/") then
print(msg:sub(5))
local stat, err = loadstring(string.sub(msg, 5))
print(stat, err)
if not err then
script.Parent.Text = "It worked :D"
wait(3)
script.Parent.Text = "Output GUI"
else
script.Parent.Text = err
end
end
end

runScript([[run/print("Hello") wait(1) error("wut")]])

_________________
blueymaddog
Administrator • Moderator • Expert Scripter
PM: blueymaddog
<+1 post. ujelly?>
Back to top Go down
blueymaddog
Administrator
Administrator
avatar

Posts : 1081
Join date : 2010-12-09
Age : 18

PostSubject: Re: Roblox is stupid, so I'm posting a script here for anyone to fix.   March 14th 2011, 5:48 am

and the error message that was in the output before was because you used the function 'error' to print 'wut' as an error message.

_________________
blueymaddog
Administrator • Moderator • Expert Scripter
PM: blueymaddog
<+1 post. ujelly?>
Back to top Go down
Guest
Guest



PostSubject: Re: Roblox is stupid, so I'm posting a script here for anyone to fix.   March 16th 2011, 5:30 pm

@Bluey: I'm using coroutines because they should run in protected mode (kinda like pcall). I highly doubt that your "solution" would work :o

But without this, my SB will never be fixed D:
Back to top Go down
naknak
Administrator
Administrator
avatar

Posts : 878
Join date : 2010-07-30

PostSubject: Re: Roblox is stupid, so I'm posting a script here for anyone to fix.   March 16th 2011, 9:03 pm

You couldn't just take all the code out of the function, adjust it to still work, and then run it to find out what line(s) was wrong? I would, but I don't have enough time right now.
Back to top Go down
blueymaddog
Administrator
Administrator
avatar

Posts : 1081
Join date : 2010-12-09
Age : 18

PostSubject: Re: Roblox is stupid, so I'm posting a script here for anyone to fix.   March 17th 2011, 6:42 am

I think your's works actually! noticed how you used the error() function instead of print()?

_________________
blueymaddog
Administrator • Moderator • Expert Scripter
PM: blueymaddog
<+1 post. ujelly?>
Back to top Go down
naknak
Administrator
Administrator
avatar

Posts : 878
Join date : 2010-07-30

PostSubject: Re: Roblox is stupid, so I'm posting a script here for anyone to fix.   March 17th 2011, 9:05 pm

Error is fun?
Back to top Go down
blueymaddog
Administrator
Administrator
avatar

Posts : 1081
Join date : 2010-12-09
Age : 18

PostSubject: Re: Roblox is stupid, so I'm posting a script here for anyone to fix.   March 18th 2011, 4:32 pm

I'm just changing 1 function:

local function runScript(msg)
if string.sub(msg, 1, 4):lower() == string.lower("run/") then
print(msg:sub(5) .. " return 1")
local str = loadstring(string.sub(msg, 5) .. " return 1")
getfenv(str).print = OutputPrint -- a function I made
local stat, err = coroutine.resume(coroutine.create(str))
print(stat, err)
repeat wait() until not stat or err == 1 -- I'm still experimenting with this part, but I can't test it until I get the loadstring stuff fixed
print(stat, err)
if err == 1 then
script.Parent.Text = "It worked :D"
wait(3)
script.Parent.Text = "Output GUI"
else
script.Parent.Text = tostring(err)
end
end
end

runScript([[run/print("Hello") wait(1) print("wut")]])

_________________
blueymaddog
Administrator • Moderator • Expert Scripter
PM: blueymaddog
<+1 post. ujelly?>
Back to top Go down
naknak
Administrator
Administrator
avatar

Posts : 878
Join date : 2010-07-30

PostSubject: Re: Roblox is stupid, so I'm posting a script here for anyone to fix.   March 19th 2011, 11:26 am

But error is fun D:
Back to top Go down
blueymaddog
Administrator
Administrator
avatar

Posts : 1081
Join date : 2010-12-09
Age : 18

PostSubject: Re: Roblox is stupid, so I'm posting a script here for anyone to fix.   March 20th 2011, 1:13 am

'[string "print("Hello") wait(1) error("wut") return ..."]:1: wut'
that is the output that is meant to to happen because of this: 'error("wut")'

_________________
blueymaddog
Administrator • Moderator • Expert Scripter
PM: blueymaddog
<+1 post. ujelly?>
Back to top Go down
Supernapalm
Expert Scripter
Expert Scripter


Posts : 393
Join date : 2011-01-17

PostSubject: Re: Roblox is stupid, so I'm posting a script here for anyone to fix.   March 20th 2011, 11:11 pm

hmmm. sigh* do strings in lua have to be that complicated?
Back to top Go down
http://hackthissite.org
naknak
Administrator
Administrator
avatar

Posts : 878
Join date : 2010-07-30

PostSubject: Re: Roblox is stupid, so I'm posting a script here for anyone to fix.   March 22nd 2011, 7:31 am

Yes, they do. For some reason, they do.
Back to top Go down
blueymaddog
Administrator
Administrator
avatar

Posts : 1081
Join date : 2010-12-09
Age : 18

PostSubject: Re: Roblox is stupid, so I'm posting a script here for anyone to fix.   March 25th 2011, 6:35 am

*rage* THE PROBLEM HAS NOTHING TO DO WITH STRINGS. if you look up the function error() on wiki it'll tell you that it makes error messages in the output.

_________________
blueymaddog
Administrator • Moderator • Expert Scripter
PM: blueymaddog
<+1 post. ujelly?>
Back to top Go down
Sponsored content




PostSubject: Re: Roblox is stupid, so I'm posting a script here for anyone to fix.   

Back to top Go down
 
Roblox is stupid, so I'm posting a script here for anyone to fix.
View previous topic View next topic Back to top 
Page 1 of 1
 Similar topics
-
» You where wrong! (Double Posting)
» a very stupid youtube troller
» Guys, DON'T PLAY ROBLOX!
» resident evil 6 is stupid as fack
» The Stupid Things That Make You Laugh Thread

Permissions in this forum:You cannot reply to topics in this forum
A Roblox Community :: Questions and Help :: Scripting-
Jump to: