Sorry, forget it

Just starting out? Need help? Post your questions and find answers here.
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 julianbury.

Scrub it
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 Pupil.

shouldn't you use "mSin" and "mAsin" as first parameter to SetFunc_() procedure ?
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 tinman.

Shouldn't it be:

Procedure.f mSin(n.f)

If you want to be able to return something.


--
I used to be a nihilist but I don't believe in that any more.
(Win98first ed. + all updates, PB3.51, external editor)
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 Sebi.

Hello julianbury,

I havn't explained it enough.

The parameters and the result must be Strings!

Your Sin-Function should look like this:

Code: Select all

Global Result.s
Procedure mSin(n.s)
  Result=StrF( Sin( ValF( n ) ) )
  ProcedureReturn @Result
EndProcedure

SetFunc_("mSin",1,@mSin())
Then you can call the function with "mSin(number)"...

Sebi
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 julianbury.

Ah, I see.
Thank you, Sebi


Julian ^00^
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 julianbury.

Scrub it
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 Sebi.

Hello julianbury,

it don't work because you don't use the same procedures you added.

You add the procedure "mASin" to the parser but you call "ASin".

The name of the procedure you add must be the same as the name when you call the function. :)

When you use this Add_parser_functions()-procedure it works:

Code: Select all

Procedure Add_parser_functions()  SetFunc_("Sin"  ,1,@mSin())
  SetFunc_("ASin" ,1,@mASin())
  SetFunc_("Cos"  ,1,@mCos())
  SetFunc_("ACos" ,1,@mACos())
  SetFunc_("Tan"  ,1,@mTan())
  SetFunc_("ATan" ,1,@mATan())
  SetFunc_("Log"  ,1,@mLog())
  SetFunc_("Log10",1,@mLog10())
  SetFunc_("Sqr"  ,1,@mSqr())
  SetFunc_("Abs"  ,1,@mAbs())
  SetFunc_("Int"  ,1,@mInt())
EndProcedure
Everything else in your code is right.

Sebi
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 julianbury.

Hi Sebi :)

Users will not like that.
Must think some more ...
Aaaaah! My brain, it's too small!
Oooo, the thoughts are too BIG!

Julian ^00^
Post Reply