Page 1 of 1

First Post

Posted: Wed Jun 25, 2003 6:48 pm
by dbellis
sup all hows it going first of nice Language realy usefull but how about 2 additions or maybe they are already in the works.

Memblocks
unles i missed sommet again
a gadget that alowys you to have a 3d scene in an app so world editers can be made just a thought any ways my first program and im stuck LOL
have a look at this code and tell me wot i need to add.


wot i want it to do is when the password is entered and enter is clicked for it 2 check the password and either give the right MsgBox or the rong one if the pass dont match here is my code so far.

Code: Select all


;- Window Constants
;
#MyWindow  = 0

;- Gadget Constants
;
#MyStringGadget  = 0
#MyTextGadget  = 1
#MyButton_Enter  = 2
#MyButton_Quit  = 3
pass$  = "abc"


;- gaget code settings
If OpenWindow(#MyWindow, 366, 297, 395, 173, #PB_Window_SystemMenu  | #PB_Window_SizeGadget  | #PB_Window_TitleBar , "Crack Me No 1")
  If CreateGadgetList(WindowID())
    StringGadget(#MyStringGadget,  60, 70, 280, 30, "", #PB_String_Password)
    TextGadget(#MyTextGadget,  60, 20, 280, 50, "                        Please Enter Your Password")
    ButtonGadget(#MyButton_Enter,  100, 100, 100, 30, "Enter")
    ButtonGadget(#MyButton_Quit,  200, 100, 100, 30, "Quit")
  EndIf
EndIf


;the test pass routeen
Repeat
  	If GetGadgetText(0)=pass$
  		MessageRequester("Well Done",  "Correct" , 0)
Else
  		MessageRequester("Bad Luck",  "Incorrect", 0)
  	EndIf
Until EventID = #PB_EventCloseWindow


; ExecutableFormat=Windows
; CursorPosition=38
; FirstLine=1
; EOF
any help is apreciated im a n00b to PB but not 2 basic.


dbellis

Re: First Post

Posted: Wed Jun 25, 2003 7:58 pm
by Num3
dbellis wrote:Memblocks
unles i missed sommet again
dbellis
You mean memory block right? :?


In PB to allocate a memory block use:
AllocateMemory(#Memory, Size, Flags)

(for more help, press F1 on the editor) :!:
a gadget that alowys you to have a 3d scene in an app so world editers can be made just a thought any ways my first program and im stuck LOL
The 3D engine is far from complete at this point, I guees more important things have to be made before this type of gadgets... :D

For more examples on purebasic check this site:
http://www.purearea.net/pb/CodeArchiv/CodeArchiv.html

Posted: Wed Jun 25, 2003 10:30 pm
by Saboteur
You have to manage the events in the loop...

Code: Select all

;- Window Constants 
; 
#MyWindow = 0

;- Gadget Constants 
; 
#MyStringGadget  = 0
#MyTextGadget  = 1
#MyButton_Enter  = 2
#MyButton_Quit  = 3
pass$  = "abc" 


;- gaget code settings 
If OpenWindow(#MyWindow, 366, 297, 395, 173, #PB_Window_SystemMenu  | #PB_Window_SizeGadget  | #PB_Window_TitleBar , "Crack Me No 1") 
  If CreateGadgetList(WindowID()) 
    StringGadget(#MyStringGadget,  60, 70, 280, 30, "", #PB_String_Password) 
    TextGadget(#MyTextGadget,  60, 20, 280, 50, "                        Please Enter Your Password") 
    ButtonGadget(#MyButton_Enter,  100, 100, 100, 30, "Enter") 
    ButtonGadget(#MyButton_Quit,  200, 100, 100, 30, "Quit") 
  EndIf 
EndIf 


;the test pass routeen 
Repeat 
  EventID=WaitWindowEvent()
  
  Select EventID
    Case #PB_Event_Gadget
      If EventGadgetID()=#MyButton_Enter
        If GetGadgetText(0)=pass$ 
          MessageRequester("Well Done",  "Correct" , 0) 
        Else 
          MessageRequester("Bad Luck",  "Incorrect", 0) 
        EndIf
      EndIf
      If EventGadgetID()=#MyButton_Quit
        Quit=1
      EndIf
  EndSelect
Until EventID = #PB_EventCloseWindow Or Quit=1

Posted: Wed Jun 25, 2003 11:33 pm
by dbellis
ahh ty so i wasnt to far out not 2 bad for my first day with PB