Team Spartan Cookies & Milk Forums
  • Issue Tracker
  • Donations
  • Search
  • Member List
  • Help

Register

Team Spartan Cookies & Milk Forums Garry's Mod Starfall v
« Previous 1 … 14 15 16 17 18 Next »
Chip status function
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Threaded Mode
Chip status function
13-02-2015, 05:48 PM,
#1
LocInt Offline
Long gone
****
Posts: 489
Threads: 91
Joined: Aug 2014
Chip status function
Hey,

It would be really nice to get some info of the crashed starfall chip. Like Chip:getStatus() to see if the chip is still alive. Would be also really cool to restart the chip somehow.

тѕсм.Person8880 hovers the nerf bat over Tetryon damage
Website Find
Reply
13-02-2015, 07:02 PM,
#2
Person8880 Offline
gpj.ecafllorT
*******
Posts: 2,407
Threads: 45
Joined: Sep 2013
RE: Chip status function
This is working around quota exceeding/chip errors, which is not a good thing.

If your chip doesn't error, you never need this. Tongue
Find
Reply
14-02-2015, 09:43 AM,
#3
dalolorn Offline
Deep Space 12 CO
***
Posts: 61
Threads: 10
Joined: Aug 2014
RE: Chip status function
(13-02-2015, 07:02 PM)Person8880 Wrote: This is working around quota exceeding/chip errors, which is not a good thing.

If your chip doesn't error, you never need this. Tongue

Normally, I would agree.

But... last time I was on the server, my chips (E2, not Starfall, but... the point is the same) would occasionally get kicked way past the quota for no apparent reason. If I remember correctly, I wasn't the only one experiencing issues - and there was no discernable pattern to the malfunctions to suggest a major error in my code.

It's not a very pleasant thing for what is essentially the heart of the ship to break down, leaving you with no way of reacting to your environment - especially when you can't even REACH your chips to fix it. Having the option of SOMEHOW rebooting the system without having to walk up to it with a toolgun would be very useful.

Boldly going where people have gone before... into galaxies! Wink
Find
Reply
14-02-2015, 10:20 AM,
#4
Person8880 Offline
gpj.ecafllorT
*******
Posts: 2,407
Threads: 45
Joined: Sep 2013
RE: Chip status function
At the end of the day, that's still a problem with your code, not the quota or anything else. Errors should be fixed, not ignored or avoided. Even if you can't see a reason immediately, there obviously is one or it wouldn't be exceeding.

It's better to spend time debugging and fixing than working round it.
Find
Reply
14-02-2015, 10:37 AM,
#5
LocInt Offline
Long gone
****
Posts: 489
Threads: 91
Joined: Aug 2014
RE: Chip status function
(13-02-2015, 07:02 PM)Person8880 Wrote: This is working around quota exceeding/chip errors, which is not a good thing.

If your chip doesn't error, you never need this. Tongue

Well it's just annoying if my chip errors and im not instantly there to fix it. Im planning on backup chip but it would require to get data from the mainchip. I could do that according to the cpuUsage/opsUsage but it would be really cool to be able to reupload the chip using command from another chip. We are human we always make errors.

тѕсм.Person8880 hovers the nerf bat over Tetryon damage
Website Find
Reply
14-02-2015, 12:01 PM,
#6
Person8880 Offline
gpj.ecafllorT
*******
Posts: 2,407
Threads: 45
Joined: Sep 2013
RE: Chip status function
Of course you can't be 100% error free. But having something that allows essentially brushing off errors and ignoring them is still not a good thing.

People would always just restart their stuff and think "meh I'll fix it someday" rather than actually fixing it and having more stable code. Sometimes it can be annoying for something to error and you're not nearby, yes, but for me that's more motivation to fix it so I don't have to worry about it again.

I should note, that for non-quota related errors you can error handle in your code without it crashing. Look at pcall() and xpcall(), also traceback() to help in debugging if you need it.
Find
Reply
14-02-2015, 01:15 PM,
#7
LocInt Offline
Long gone
****
Posts: 489
Threads: 91
Joined: Aug 2014
RE: Chip status function
(14-02-2015, 12:01 PM)Person8880 Wrote: Of course you can't be 100% error free. But having something that allows essentially brushing off errors and ignoring them is still not a good thing.

People would always just restart their stuff and think "meh I'll fix it someday" rather than actually fixing it and having more stable code. Sometimes it can be annoying for something to error and you're not nearby, yes, but for me that's more motivation to fix it so I don't have to worry about it again.

I should note, that for non-quota related errors you can error handle in your code without it crashing. Look at pcall() and xpcall(), also traceback() to help in debugging if you need it.

So if I run all my functions using pcall is it like using try catch? It returns error on fail but does not stop running the ship?

тѕсм.Person8880 hovers the nerf bat over Tetryon damage
Website Find
Reply
14-02-2015, 01:35 PM,
#8
Person8880 Offline
gpj.ecafllorT
*******
Posts: 2,407
Threads: 45
Joined: Sep 2013
RE: Chip status function
(14-02-2015, 01:15 PM)LocInt Wrote:
(14-02-2015, 12:01 PM)Person8880 Wrote: Of course you can't be 100% error free. But having something that allows essentially brushing off errors and ignoring them is still not a good thing.

People would always just restart their stuff and think "meh I'll fix it someday" rather than actually fixing it and having more stable code. Sometimes it can be annoying for something to error and you're not nearby, yes, but for me that's more motivation to fix it so I don't have to worry about it again.

I should note, that for non-quota related errors you can error handle in your code without it crashing. Look at pcall() and xpcall(), also traceback() to help in debugging if you need it.

So if I run all my functions using pcall is it like using try catch? It returns error on fail but does not stop running the ship?
xpcall is the closest to "try-catch". You can't catch quota errors though.

Both pcall and xpcall return true, function return values on success or false, error message on failure. xpcall has the added advantage of running a callback when the error occurs so you can get an accurate stack trace with traceback() at that point.

Either way, they will not stop the chip if they encounter a non-quota error, yes. That doesn't mean that wrapping the whole thing in pcall is what you should do though (unless you have no shame and want unmaintainable code!)
Find
Reply
14-02-2015, 02:15 PM,
#9
LocInt Offline
Long gone
****
Posts: 489
Threads: 91
Joined: Aug 2014
RE: Chip status function
(14-02-2015, 01:35 PM)Person8880 Wrote:
(14-02-2015, 01:15 PM)LocInt Wrote:
(14-02-2015, 12:01 PM)Person8880 Wrote: Of course you can't be 100% error free. But having something that allows essentially brushing off errors and ignoring them is still not a good thing.

People would always just restart their stuff and think "meh I'll fix it someday" rather than actually fixing it and having more stable code. Sometimes it can be annoying for something to error and you're not nearby, yes, but for me that's more motivation to fix it so I don't have to worry about it again.

I should note, that for non-quota related errors you can error handle in your code without it crashing. Look at pcall() and xpcall(), also traceback() to help in debugging if you need it.

So if I run all my functions using pcall is it like using try catch? It returns error on fail but does not stop running the ship?
xpcall is the closest to "try-catch". You can't catch quota errors though.

Both pcall and xpcall return true, function return values on success or false, error message on failure. xpcall has the added advantage of running a callback when the error occurs so you can get an accurate stack trace with traceback() at that point.

Either way, they will not stop the chip if they encounter a non-quota error, yes. That doesn't mean that wrapping the whole thing in pcall is what you should do though (unless you have no shame and want unmaintainable code!)

Yay now I can run my chip even if it crashes and not fix the error. Big GrinD

тѕсм.Person8880 hovers the nerf bat over Tetryon damage
Website Find
Reply
15-02-2015, 09:08 AM,
#10
dalolorn Offline
Deep Space 12 CO
***
Posts: 61
Threads: 10
Joined: Aug 2014
RE: Chip status function
(14-02-2015, 10:20 AM)Person8880 Wrote: At the end of the day, that's still a problem with your code, not the quota or anything else. Errors should be fixed, not ignored or avoided. Even if you can't see a reason immediately, there obviously is one or it wouldn't be exceeding.

It's better to spend time debugging and fixing than working round it.

At the end of the day, there is nothing for me to debug. There is no reproduction method - it can run solidly for hours, or it can blow up in my face during the first fifteen minutes, and I still won't have any data to analyze.

I could read, double-read and triple-read every line of my code and I probably wouldn't be any closer to figuring out what's wrong - if it's really my code that's doing it.

Boldly going where people have gone before... into galaxies! Wink
Find
Reply
« Next Oldest | Next Newest »


  • View a Printable Version
Forum Jump:


Users browsing this thread:
Contact UsTeam Spartan Cookies & MilkReturn to TopLite (Archive) ModeMark all forums readRSS Syndication

Powered By MyBB, © 2002-2026 MyBB Group.