Search found 964 matches

by Shield
Wed Mar 22, 2017 1:52 pm
Forum: Coding Questions
Topic: Defined
Replies: 8
Views: 1857

Re: Defined

Are you looking for CompilerError "my error"?
by Shield
Tue Mar 21, 2017 8:08 pm
Forum: Feature Requests and Wishlists
Topic: Structures with default values
Replies: 5
Views: 2425

Re: Structures with default values

I know this doesn't have the syntactic sugar, but you may be able to use this: Structure Car name.s speed.i EndStructure Global DefaultCar.Car DefaultCar\name = "DefaultCar" DefaultCar\speed = 100 Procedure DoCarStuff() Protected car.Car car = DefaultCar Debug car\name Debug car\speed EndP...
by Shield
Thu Mar 16, 2017 6:10 pm
Forum: Coding Questions
Topic: [No Bug]in 'Color = RGBA(Red, ...)', should use 'Color.q'
Replies: 10
Views: 3781

Re: in 'Result = Alpha(Color)', should use 'Result.q'

Alpha returns the value of the alpha channel only, so it's always between 0 and 255.
by Shield
Sun Mar 05, 2017 4:00 pm
Forum: Feature Requests and Wishlists
Topic: Forum login isn't protected (https)
Replies: 2
Views: 1677

Re: Forum login isn't protected (https)

There really isn't any excuse anymore for not using HTTPS on a site
taking user credentials. So +1.
by Shield
Sun Feb 19, 2017 6:22 am
Forum: Coding Questions
Topic: Network server uses 25% of CPU ?
Replies: 4
Views: 1296

Re: Network server uses 25% of CPU ?

Use Delay(). :wink:
skinkairewalker wrote:why it uses a lot of cpu ?
Because you're spending all your time in an endless loop.
Delay() passes on execution time to other processes.
by Shield
Tue Feb 14, 2017 7:02 am
Forum: Coding Questions
Topic: LUA 5.3 - how can i verify if condition function exists ?
Replies: 2
Views: 966

Re: LUA 5.3 - how can i verify if condition function exists

That might work:

Code: Select all

if Division~=nil then
    Division(10, 5)
end
by Shield
Mon Feb 13, 2017 6:46 am
Forum: Coding Questions
Topic: Help converting PB to C
Replies: 7
Views: 1584

Re: Help converting PB to C

No C code? :?:
chris319 wrote: Here is my attempt at converting it to C, but it isn't working correctly. I suspect PB is doing some type conversions which I'm not getting right in C.

Code: Select all

#define Kr 0.3333
unsigned char V, Y, Rd;
float Vtemp;
Vtemp = (float)(V) - 128;
Rd= Y+((unsigned char)(Vtemp/Kr));
by Shield
Mon Feb 13, 2017 4:21 am
Forum: Coding Questions
Topic: Help converting PB to C
Replies: 7
Views: 1584

Re: Help converting PB to C

Your C example without the casting clutter is:

Code: Select all

Rd= Y+(Vtemp/Kr);
by Shield
Mon Feb 13, 2017 3:20 am
Forum: Coding Questions
Topic: Help converting PB to C
Replies: 7
Views: 1584

Re: Help converting PB to C

Well, (Y + Vt) / #Kr is something different than Y + (Vt / #Kr),
which one is it?
by Shield
Tue Feb 07, 2017 8:25 am
Forum: Coding Questions
Topic: Cant account for exponential performance loss
Replies: 7
Views: 1572

Re: Cant account for exponential performance loss

Ask MS for more info about this wierd system :) Actually it's all documented. :) https://msdn.microsoft.com/en-us/library/windows/desktop/bb761389(v=vs.85).aspx TL;DR: An image list is not actually a list but a "sprite map" (i.e. one large image containing small images). So every time an ...
by Shield
Tue Feb 07, 2017 7:44 am
Forum: Coding Questions
Topic: Cant account for exponential performance loss
Replies: 7
Views: 1572

Re: Cant account for exponential performance loss

I can't run PB right now so I'm going on a long shot here and say that since you create different images, there is a lot more overhead with copying that data into the gadgets and keeping track of updates (though the increase seems a lot). Maybe you could try to see if it makes any difference to disa...
by Shield
Sat Feb 04, 2017 3:41 pm
Forum: Coding Questions
Topic: What is the maximum whole number a float can hold?
Replies: 6
Views: 1891

Re: What is the maximum whole number a float can hold?

Should be 2^53 :wink: (9'007'199'254'740'992)
by Shield
Sat Feb 04, 2017 3:03 pm
Forum: Coding Questions
Topic: What is the maximum whole number a float can hold?
Replies: 6
Views: 1891

Re: What is the maximum whole number a float can hold?

You could use double (.d) instead of float (.f) to get more precision. Remember that floating point types are not about accuracy, they are just approximations that are supposed to be fast and accurate *enough* for most computations. If you need accurate integers, use integer types (e.g. .q) or use a...
by Shield
Sat Feb 04, 2017 2:25 pm
Forum: Coding Questions
Topic: What is the maximum whole number a float can hold?
Replies: 6
Views: 1891

Re: What is the maximum whole number a float can hold?

Single precision (32 bit) floats use 23 bits for the mantissa so the largest integer number
they can accurately represent is 2^(23+1) = 16777216.
by Shield
Wed Feb 01, 2017 8:05 pm
Forum: Off Topic
Topic: Happy Birthday Fred!
Replies: 64
Views: 20255

Re: Happy Birthday Fred!

Well, that was only 307 days too late. Still counts! :mrgreen: