[Implemented] What I really need...

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

[Implemented] What I really need...

Post by BackupUser »

Restored from previous forum. Originally posted by redacid.

...are some "Basic" commands and more:

"then": (if ... then ...)

"ElseIf": (if ...then... elseif...then...endif)

"false, true"

"Not" (while not eof()...)

"Int" (number.l=int(3.14))

"Null" (a$=NULL)

"Mod" (print 12 Mod 5)

"Pi, Sin, Cos, Tan, ASin, ACos, ATan, Sqr"

Also I "need" a different syntax of the line-command (line (x1,y1-x2,y2)).

Did I miss something?


Only Amiga makes it possible!
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by El_Choni.

My comments to your wishes:

"then": (if ... then ...) ; : works the same, why do you need "then"

"ElseIf": (if ...then... elseif...then...endif) ; yeah, it would be great

"false, true" ; #FALSE, #TRUE work the same

"Not" (while not eof()...) ; I agree

"Int" (number.l=int(3.14)) ; you don't need to use Int(), 3.14 is rounded when assigned to a long variable

"Null" (a$=NULL) ; a$="" works the same

"Mod" (print 12 Mod 5) ; you can use the MathExtras library available at Paul's site: IMod(12, 5)

"Pi, Sin, Cos, Tan, ASin, ACos, ATan, Sqr" ; Sin, Cos, Sqr and Tan are working, the other four are not. I think Pi should be a constant (#PI). Well, that's quite obvious...

Also I "need" a different syntax of the line-command (line (x1,y1-x2,y2)). ; no comment

Hope it helps. Bye,

El_Choni
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by PB.

> "then": (if ... then ...)

If a=0 : a=a+1 : EndIf is the same as If a=0 Then a=a+1.

> "ElseIf": (if ...then... elseif...then...endif)

Use Select and Case and Default to do it instead.

> "false, true"

Assign variables to these and use the variable names.

> "Not" (while not eof()...)

Fred said this is coming soon.

> "Null" (a$=NULL)

Why not just do this: a$="" (it saves typing 2 extra chars too!).

> "Mod" (print 12 Mod 5)
> "Pi, Sin, Cos, Tan, ASin, ACos, ATan, Sqr"

Some of these are in the Maths library at http://www.reelmediaproductions.com/pb/ .
For PI, assign a variable to 3.1415926535 and use it.

> I "need" a different syntax of the line-command (line (x1,y1-x2,y2)).

Write a procedure to re-do the syntax. What syntax do you need, exactly?


PB - Registered PureBasic Coder

Edited by - PB on 04 January 2002 21:52:37
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by redacid.

Hi. Thanks for your answers, but...

I know that I don`t really need "then". But it is a standard in all Basic-Compilers. And it`s easier to read and to write than "if a=2:a=a+1:elseif.

The same for "not,False,True,Mod,Null,Pi". I`d like to use them without assigning variables or constants.

"Int" is not really needed. Good idea to use a long-variable. But it`s still "Standard" (I know that there`s no real Standard-Basic).

The syntax of the line-command should be
line (x1,y1,x2,y2) or
line (x1,y1-x2,y2)

That`s common in all other Basic-compilers (e.g. Blitz Basic for Amiga and PC).


Why I need all this stuff? Because I also use Blitz Basic (Amiga and PC) and I don`t want to remember all those different syntaxes and commands (and bugs and "hidden features").

Only Amiga makes it possible!

Edited by - redacid on 05 January 2002 11:09:18
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Danilo.

>False,True,Pi

#FALSE and #TRUE are already
defined. You can make your
own Constant-Library with
the "/RESIDENT" command line
switch.

>"Int" is not really needed.
>Good idea to use a long-variable.

INTeger *is* LONG (32-Bit)

cya,
...Danilo

(registered PureBasic user)
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by PB.
The syntax of the line-command should be
line (x1,y1,x2,y2)
It's just simple maths to do this from the current syntax.
For example, let's say your line starts at 10,10 and ends at 50,50.
In PureBasic, the syntax is: line(10,10,40,40). So to do it your
way, just do like this: line(10,10,50-10,50-10). In other words,
just subtract the X2 and Y2 values from the X1 and Y1 values, and then
you'll get the syntax that you're wanting.

You could write a small procedure to do it automatically.

PB - Registered PureBasic Coder

Edited by - PB on 05 January 2002 21:04:11
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by redacid.

PB: thanks. Maybe I can get around with it...

regards,
Redacid
---
Only Amiga makes it possible!
Post Reply