Problème avec For… Next Step!!!

Archive.
Mytic
Messages : 466
Inscription : mer. 25/juil./2007 0:13

Problème avec For… Next Step!!!

Message par Mytic »

Ben… je viens de remarquer que PureBasic ne gérait pas les virgules après step !!!
Je vous explique avec un code (c’est plus représentatif)

Code sans problème :

Code : Tout sélectionner

For i = 0 To 10 Step 1
Debug i
Next i
Code avec problème :

Code : Tout sélectionner

For i = 0 To 10 Step 0.5
Debug i
Next i 
En plus si vous arrêtez le code l’IDE Bug !!
:?
Pascal Vernie
Messages : 127
Inscription : mar. 15/mars/2005 16:37

Message par Pascal Vernie »

Pour résoudre ce problème je fais :
a.d = 1
Repeat
debug a
a + 0.5
until a > 10
Amitiés
Pascal
Fanator
Messages : 20
Inscription : jeu. 19/avr./2007 8:14

Message par Fanator »

Bonjour à tous.

@mytic

Je crois que la boucle for...next n'accepte que des integer
On peut faire aussi avec While...Wend :

Code : Tout sélectionner

i.f=0
While i<=10
  Debug i
  i+0.5
Wend

Fanator
tmyke
Messages : 1554
Inscription : lun. 24/juil./2006 6:44
Localisation : vosges (France) 47°54'39.06"N 6°20'06.39"E

Message par tmyke »

Si tu met un pas de 0.5, cela veux donc dire que tu
cherche a faire travailler la variable de ta boucle
en float.

Ton code serait donc plutot comme suit:

Code : Tout sélectionner

For i.f = 0 To 10 Step 0.5
Debug i
Next i
seulement, quand tu ecris cela, le comilateur renvoi
"An integer assignment is expected after 'For'"

en d'autre termes, seul des variables et constantes entière
peuvent etre employées pour les boucle For.Next avec PB.
Tu peux contourner par le biais d'un code comme proposé
par Pascal Vernie

;)

[EDIT] oups, double post avec Fanator
Force et sagesse...
Avatar de l’utilisateur
Flype
Messages : 2431
Inscription : jeu. 29/janv./2004 0:26
Localisation : Nantes

Message par Flype »

Fanator a écrit :Je crois que la boucle for...next n'accepte que des integer
je confirme, c'est une demande récurrente d'ailleurs.

l'équipe purebasic a fait le choix de ne gérer que des entiers dans les boucle For/Next pour des raisons de vitesse d'exécution.
Image
Mytic
Messages : 466
Inscription : mer. 25/juil./2007 0:13

Message par Mytic »

C’est vraiment dommage que Fred ne passe plus, y’a tellement de choses a arrangé en PureBasic , ce langage à vraiment un potentiel énorme , et mérite lui aussi d’avoir des détailles même minimes , car c’est avec les petits détailles qu’on s’attache à un langage plus qu’un autre.
En plus l’aide est vraiment le mini de mini minimum en pure , il devait au moins nous dire que le For…Next…step n’accepté que les nombres entiers réels.
J’ai abandonné plusieurs programmes de fractal en croyant que l’erreur venait de moi, mais s’était à cause Step.
:cry:
Avatar de l’utilisateur
Flype
Messages : 2431
Inscription : jeu. 29/janv./2004 0:26
Localisation : Nantes

Message par Flype »

ok, fred ne passe plus trop sur le forum FR mais il est suffisamment actif sur le forum officiel. je le comprends, il a son taf, le developpement de purebasic, le suivi des bugs ( sur le vrai thread dédié : http://www.purebasic.fr/english/viewforum.php?f=4 ).
je sais ce que c'est de devoir être présent sur plusieurs fronts, et au bout d'un moment ce n'est plus possible, ou alors une fois de temps en temps.

et puis il ne faut pas se décourager, une fois le langage purebasic en tête (ce qui est plutot rapide par rapport à d'autres langages), on ne bloque plus sur ce genre de problème.

par contre, effectivement, cette information devrait être dans la doc.
Image
Mytic
Messages : 466
Inscription : mer. 25/juil./2007 0:13

Message par Mytic »

J’espère que les anglais sont tombés sur les même Bugs que nous :?
Avatar de l’utilisateur
Crystal Noir
Messages : 891
Inscription : mar. 27/janv./2004 10:07

Message par Crystal Noir »

on doit sentir le gaz pour qu'il passe plus :D
Avatar de l’utilisateur
Flype
Messages : 2431
Inscription : jeu. 29/janv./2004 0:26
Localisation : Nantes

Message par Flype »

le bug de For/Next avec des float n'est pas un bug, c'est un choix technique, faut pas confondre. Après, mauvais choix ou pas c'est une autre histoire.

et la collection de bugs du forum officiel (anglais) est beaucoup plus étoffés qu'ici, c'est pourquoi il est mieux suivi qu'ici.

d'ailleurs, lorsqu'un bug est avéré ici (quand on tombe tous d'accord sur le fait que c'est probablement un bug), il est généralement recopié dans la section bug anglaise.

purebasic vit bien je te rassure. il évolue bien.
il est comme le bon vin, il se bonifie avec le temps, faut juste être patient.
Image
Mytic
Messages : 466
Inscription : mer. 25/juil./2007 0:13

Message par Mytic »

Une question au passage ! La nouvelle version sera compatible vista ?
Avatar de l’utilisateur
Crystal Noir
Messages : 891
Inscription : mar. 27/janv./2004 10:07

Message par Crystal Noir »

j'pense qu'il vaudrait mieux sinon ca va pas le faire :D
Avatar de l’utilisateur
Flype
Messages : 2431
Inscription : jeu. 29/janv./2004 0:26
Localisation : Nantes

Message par Flype »

oui la version 4.10 sera compatible avec vista.

cf. le fichier readme de la v4.10 beta 2 téléchargeable depuis environ deux mois.

-------------------------------------------------------------------------------
PureBasic v4.10 beta 2
-------------------------------------------------------------------------------

Information:
------------

This beta is for testing purpose only. Never assume it to be stable
or even working. But, we provide it to public beta testing as we don't
found bugs anymore and want to be sure to have a correct product before
release it. Be free to test it with all your program and reports
any problem to the bug report section, with 'Beta - ' in the title.

We strongly suggest to makes a whole copy of the 'PureBasic' folder
and install this beta on it, to keep a working distribution. You have
to install this beta over a regular PureBasic 4.02.

This beta requires the registered version of PureBasic.


News:
-----

- Tons of bugs fixed

Vista compatibility:
--------------------

- The PureBasic package is fully compatible with UAC
- All tools except the setup and SmartUpdate work also for limited users
- Vista is added to OSVersion()

Note: The Sprite&Screen packages still work with DX7, which means that it is a bit slow
on Vista and OpenWindowedScreen() will disable the glass skin. The work to update all this
to DX9 is in progress, but it will not be finished for 4.10.
This will be done in the 4.20 release.

Libraries:
----------
- added TruncateFile() for file lib
- added #PB_OS_Windows_Vista and #PB_OS_Windows_Server_2008 for OSVersion()

- added brand new XML library
- added brand new Drag & Drop library
- changed the module replayer with 'ModPlug' so it can be used in any applications

- added scintilla library (dll version):
InitScintilla(DllFile$) - load the scintilla dll
ScintillaGadget(#Gadget, x, y, Width, Height, Flags, Callback)
ScintillaSendMessage(#Gadget, Message, Param1, Param2)

Callback format:
Procedure ScintillaCallBack(EditorWindow.l, EditorGadget.l, *scinotify.SCNotification, lParam.l)
EndProcedure


- added: Lots of new Stuff for the WebGadget
SetGadgetItemText(#Web, #PB_Web_HtmlCode, Code$) - stream new code into the gadget
GetGadgetItemText(#Web, #PB_Web_HtmlCode) - get all code inside the gadget
GetGadgetItemText(#Web, #PB_Web_PageTitle) - get title string for the currently displayed page
GetGadgetItemText(#Web, #PB_Web_StatusMessage) - get the current message for the browser statusbar
GetGadgetItemText(#Web, #PB_Web_SelectedText) - get all currently selected text

New EventType() values for the WebGadget
#PB_EventType_TitleChange ; page title changed
#PB_EventType_StatusChange ; statusbar message changed
#PB_EventType_PopupWindow ; a popup was blocked (only if popups are blocked)
#PB_EventType_DownloadStart ; loading a page started
#PB_EventType_DownloadProgress ; loading progress changed (see Progress, ProgressMax below)
#PB_EventType_DownloadEnd ; loading finished (or aborted)
#PB_EventType_PopupMenu ; the popup menu is requested (only if the IE menu is blocked)

For Get/SetGadgetAttribute():
#PB_Web_BlockPopups ; block popup windows
#PB_Web_BlockPopupMenu ; block IE menu (the above event is fired to allow a custom menu)
#PB_Web_NavigationCallback ; set a callback to trace (and prevent) navigation (See example)
#PB_Web_Progress ; at a DownloadProgress event, get the downloaded data (readonly) may be 0 if unknown
#PB_Web_ProgressMax ; at a DownloadProgress event, get the total size (readonly) may be 0 if unknown
#PB_Web_Busy ; check if the Gadget is busy loading/rendering (readonly)
#PB_Web_ScrollX ; get/set the X scroll position
#PB_Web_ScrollY ; get/set the Y scroll position


IDE changes:
------------

Important changes:
- For Vista compatibility nothing is written in the PureBasic dir anymore
- The temporary exe is placed in the Windows temp dir
- The Preferences location was moved to %App Data%\PureBasic\ for all preferences
NOTE: This cann still be changed with the /P, /A, /T commandline switches to specify different
locations for the preferences files.
- New commandline switch /PORTABLE which puts all preferences in the PureBasic dir (as before),
and disables the creation of the .pb extension for USB sticks and such.


Compiler Options:
- added new tab with settings for Compile/Run:
- the debugger type can be chosen for an individual program
- the current directory for executing the program can be chosen
- the temporary exe can be created in the source directory
- external tools can be enabled on a per-program basis (if the option is enabled in the tools config)

- added tab for compiler constants:
- special editor constants for build counting
- custom constants can be defined, even by using environment variables

- improved "Run" command by keeping all compiled sources ready
- added ADMIN and USER mode for Vista (to request admin priviledges or disable virtualisation)

- new pipe based IDE->Compiler communication. (documented in the Library SDK)


Coloring:
- improved color management: (individual color settings can be disabled)
- new colors to hilight matching/mismatching braces
- optional color for procedure backgrounds
- New color for "custom keywords" to color Preprocessor/Macro packages

AutoComplete:
- The shortcut to insert a word can now be customized (Shortcut options)
NOTE: The default is now TAB, so if you are used to the ENTER key, just change it back
- various improvements of the autocomplete handling

Misc:
- The font & color for the Toolspanel can be disabled
- A custom font for the Debug Output window can be specified
Image
Mytic
Messages : 466
Inscription : mer. 25/juil./2007 0:13

Message par Mytic »

Merci <Flype> pour l'info :D
Répondre