need help with inputting a text field... 
	 
	
		| Author | 
		Message | 
	 
		 
		liam438
 
 
 
    
		 | 
		
		
			
				  Posted: Tue Mar 19, 2019 9:35 am    Post subject: need help with inputting a text field...  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				i get the error message "deferred subroutine has not been resolved" 
 
also its the file called gave ver 3.1 its the newest version im working on.
 
 
this is the part with the text field.
 
 
%buttons%//////////////////////////////////////////////////////////////////////////////////////
 
proc textrun (text : string)
 
    input := GUI.GetText (commandpromp)
 
    cmdrun := true
 
end textrun
 
process button1
 
    var draw : int := GUI.CreateButtonFull (558, 350, 50, "Inventory", Invwind, 50, "h", true)
 
    commandpromp := GUI.CreateTextFieldFull (3, 14, 465, "", textrun, GUI.INDENT, 0, 0)
 
    GUI.Refresh
 
    loop
 
        exit when GUI.ProcessEvent
 
    end loop
 
    GUI.Refresh
 
end button1
		
	
  
          
							 
	
	
		
	 
	
		|  Description: | 
		
			
		 | 
		  Download | 
	 
	
		|  Filename: | 
		 game - ver 2.5.zip | 
	 
	
		|  Filesize: | 
		 239.77 KB | 
	 
	
		|  Downloaded: | 
		 654 Time(s) | 
	 
	 
	 
		
 | 
			 
			
				 | 
			 
		  | 
	 
	 
		 | 
		
		 | 
	 
	  
		  | 
	 
		 
		Sponsor Sponsor 
		 
  
		 | 
		
 | 
	 
	 
		  | 
	 
				 
		liam438
 
 
 
    
		 | 
		
		
			
				  Posted: Fri Mar 22, 2019 12:38 pm    Post subject: RE:need help with inputting a text field...  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				| ok so i have been looking and it seems the problem revolves around the deferred subroutine has not being resolved. i really need help on this.
		
 | 
			 
			
				 | 
			 
		  | 
	 
	 
		 | 
		
		 | 
	 
	  
		  | 
	 
				 
		Insectoid
 
  
 
    
		 | 
		
		
			
				  Posted: Tue Mar 26, 2019 3:15 pm    Post subject: RE:need help with inputting a text field...  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				| I didn't download the file, but do you have any forward declared functions or procedures that you didn't write bodies for?
		
 | 
			 
			
				 | 
			 
		  | 
	 
	 
		 | 
		
		 | 
	 
	  
		  | 
	 
				 
		liam438
 
 
 
    
		 | 
		
		
			
				  Posted: Thu Mar 28, 2019 11:28 am    Post subject: Re: RE:need help with inputting a text field...  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				Insectoid @ Tue Mar 26, 2019 3:15 pm wrote: I didn't download the file, but do you have any forward declared functions or procedures that you didn't write bodies for? 
 
 
i only have 2 forward procedures. and they both have body's. one of them is used as a procedure for a button tho.
		
 | 
			 
			
				 | 
			 
		  | 
	 
	 
		 | 
		
		 | 
	 
	  
		  | 
	 
				 
		liam438
 
 
 
    
		 | 
		
		
			
				  Posted: Thu Mar 28, 2019 11:39 am    Post subject: Re: need help with inputting a text field...  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				This is part of a widget module that opens when the error happens.
 
 
% Window must already be set up
 
    procedure HandleKeystroke (window : int)
 
        var ch := getchar
 
 
        % Check if a menu shortcut
 
        var menubar : ^MenuBarClass := GetMenuBarForWindow (window)
 
 
        % Check menus
 
        if menubar not= nil then
 
            if menubar -> ConsiderKeystroke (ch) then
 
                % Was a menu shortcut.
 
                return
 
            end if
 
        end if
 
 
        % Check widgets
 
        var widget : ^GenericWidgetBodyClass := WidgetGlobals.firstWidget
 
        loop
 
            exit when widget = nil
 
            if widget -> GetWindow = window and
 
                    objectclass (widget) >= GenericActiveWidgetClass and
 
GenericActiveWidgetClass (widget).ConsiderKeystroke (ch) <-this is the part that has the error, the error is-> Process "button1" : Deferred subroutine has not been resolved.
 
                    then
 
                % Was a widget shortcut.
 
                return
 
            end if
 
            widget := widget -> GetNext
 
        end loop
 
 
        % Check user keystroke handler
 
        if keyEventHandler not= DefaultKeyEventHandler then
 
            keyEventHandler (ch)
 
        end if
 
    end HandleKeystroke
		
 | 
			 
			
				 | 
			 
		  | 
	 
	 
		 | 
		
		 | 
	 
	  
		  | 
	 
				 
		Insectoid
 
  
 
    
		 | 
		
		
			
				  Posted: Thu Mar 28, 2019 5:21 pm    Post subject: RE:need help with inputting a text field...  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				| Can you move the body closer to the top of the code, or remove the forward declaration entirely? I suspect that Turing doesn't see your body declaration for whatever reason. Could be a typo, could be something else.
		
 | 
			 
			
				 | 
			 
		  | 
	 
	 
		 | 
		
		 | 
	 
	  
		  | 
	 
				 
		liam438
 
 
 
    
		 | 
		
		
			
				  Posted: Wed Apr 03, 2019 12:08 pm    Post subject: Re: need help with inputting a text field...  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				this is the entire program to make it easy for you guys.
 
	  | Turing: | 	 		  
import GUI
 var bal  : int := 0
var shopon  : boolean := false
type Items  :
    record
        Name  : string
        Desc  : string
        Healing  : int
        Damage  : int
        Has  : boolean
        Amount  : int
        Block  : int
    end record
const size  : int := 25   % The buttons size.
const border  : int := 3
const Buttonx  : int := 20
const Buttony  : int := 340
%////Var////%
var button1y, button2y, button3y, button4y, button5y, button6y, button7y, button8y, button9y, button10y  : int := 0
var button1x, button2x, button3x, button4x, button5x, button6x, button7x, button8x, button9x, button10x  : int := 0
var winID1, winID2, starButton, mapleButton, starPic, mapleLeafPic, picID, picID1, picID2, picID3, picID4, picID5, picID6, picID7, picID8, picID9, space, wsb, ssb, isb, dsb  : int
var shb, mhb, lhb, wshb, ishb, dshb, statfont, commandpromp  : int
var winopen, combat, turn, cmdrun  : boolean := false
var enemyhp, enemy  : int
var count  : int := 1
var damage  : int := 5
var boxID  : int := GUI.CreateTextBox (0,  40,  470,  360)
var equiped  : string := "fists"
var shieldequiped, enemyname  : string := ""
var start, name, nametest, stop, input, input2  : string
var health  : int := 70
var item1, item2, item3, item4, item5, place, villagesub, cavesub, forestsub, defence  : int := 0
var move, move2, move3  : int := 3
var commands  : array 1 ..  5 of string
commands  (1) := "buy"
commands  (2) := "sell"
commands  (3) := "attack"
commands  (4) := "equip"
commands  (5) := "use"
%////////items////////%
var woodsword  : Items
 
woodsword.Name  := "Wooden Sword"
woodsword.Desc  := "Does 10 Damage"
woodsword.Damage  := 10
woodsword.Has  := false
woodsword.Amount  := 0
var stonesword  : Items
 
stonesword.Name  := "Stone Sword"
stonesword.Desc  := "Does 40 Damage"
stonesword.Damage  := 40
stonesword.Has  := false
stonesword.Amount  := 0
var ironsword  : Items
 
ironsword.Name  := "Iron Sword"
ironsword.Desc  := "Does 70 Damage"
ironsword.Damage  := 70
ironsword.Has  := false
ironsword.Amount  := 0
var diamondsword  : Items
 
diamondsword.Name  := "Diamond Sword"
diamondsword.Desc  := "Does 100 Damage"
diamondsword.Damage  := 100
diamondsword.Has  := false
diamondsword.Amount  := 0
var smallheal  : Items
 
smallheal.Name  := "Small Health Potion"
smallheal.Desc  := "Heals 10 Damage"
smallheal.Healing  := 10
smallheal.Has  := false
smallheal.Amount  := 0
var medheal  : Items
 
medheal.Name  := "Medium Health Potion"
medheal.Desc  := "Heals 40 Damage"
medheal.Healing  := 40
medheal.Has  := false
medheal.Amount  := 0
var largeheal  : Items
 
largeheal.Name  := "Large Health Potion"
largeheal.Desc  := "Heals 70 Damage"
largeheal.Healing  := 70
largeheal.Has  := false
largeheal.Amount  := 0
var woodshield  : Items
 
woodshield.Name  := "Wooden Shield"
woodshield.Desc  := "Gives 20 Defence"
woodshield.Block  := 20
woodshield.Has  := false
woodshield.Amount  := 0
var ironshield  : Items
 
ironshield.Name  := "Iron Shield"
ironshield.Desc  := "Gives 35 Defence"
ironshield.Block  := 35
ironshield.Has  := false
ironshield.Amount  := 0
var diamondshield  : Items
 
diamondshield.Name  := "Diamond Shield"
diamondshield.Desc  := "Gives 50 Defence"
diamondshield.Block  := 50
diamondshield.Has  := false
diamondshield.Amount  := 0
forward proc Invwind  ()
forward proc WindClose  ()
statfont  := Font.New ("sans serif:18:bold")
%//////////Create the button pictures////////%
% The star.
Draw.Star (border, border, border + size, border + size,  black)
Draw.Star (border +  1, border +  1, border + size -  1, border + size -  1,  black)
Draw.FillStar (border +  2, border +  2, border + size -  2, border + size -  2,  brightred)
starPic  := Pic.New (0,  0,  2 * border + size,  2 * border + size )
% The mapleleaf.
Draw.FillBox (border, border, border + size, border + size,  white)
Draw.MapleLeaf (border, border, border + size, border + size,  black)
Draw.MapleLeaf (border +  1, border +  1, border + size -  1, border + size -  1,  black)
Draw.FillMapleLeaf (border +  2, border +  2, border + size -  2, border + size -  2,  brightred)
mapleLeafPic  := Pic.New (0,  0,  2 * border + size,  2 * border + size )
Draw.Cls
%////////Creat window//////%
picID  := Pic.FileNew ("woodensword_icon32.jpg")
picID1  := Pic.FileNew ("stonesword_icon32.jpg")
picID2  := Pic.FileNew ("ironsword_icon32.jpg")
picID3  := Pic.FileNew ("diamondsword_icon32.jpg")
picID4  := Pic.FileNew ("potion_red.jpg")
picID5  := Pic.FileNew ("potion_yellow.jpg")
picID6  := Pic.FileNew ("potion_xp.jpg")
picID7  := Pic.FileNew ("woodshield.jpg")
picID8  := Pic.FileNew ("ironshield.jpg")
picID9  := Pic.FileNew ("diamondshield.jpg")
picID  := Pic.Scale (picID,  2 * border + size,  2 * border + size )
picID1  := Pic.Scale (picID1,  2 * border + size,  2 * border + size )
picID2  := Pic.Scale (picID2,  2 * border + size,  2 * border + size )
picID3  := Pic.Scale (picID3,  2 * border + size,  2 * border + size )
picID4  := Pic.Scale (picID4,  2 * border + size,  2 * border + size )
picID5  := Pic.Scale (picID5,  2 * border + size,  2 * border + size )
picID6  := Pic.Scale (picID6,  2 * border + size,  2 * border + size )
picID7  := Pic.Scale (picID7,  2 * border + size,  2 * border + size )
picID8  := Pic.Scale (picID8,  2 * border + size,  2 * border + size )
picID9  := Pic.Scale (picID9,  2 * border + size,  2 * border + size )
Pic.SetTransparentColor (picID,  white)
Pic.SetTransparentColor (picID1,  white)
Pic.SetTransparentColor (picID2,  white)
Pic.SetTransparentColor (picID3,  white)
Pic.SetTransparentColor (picID4,  white)
Pic.SetTransparentColor (picID5,  white)
Pic.SetTransparentColor (picID6,  white)
Pic.SetTransparentColor (picID7,  white)
Pic.SetTransparentColor (picID8,  white)
Pic.SetTransparentColor (picID9,  white)
%/////////////////Proc/////////////%
%//////////////////////////////////%
%itemhas%
procedure itemif  (var Amount  : int,  var Has  : boolean)
    if Amount >  0 then
        Has  := true
    elsif Amount  = 0 then
        Has  := false
    elsif Amount <  0 then
        Amount  := 0
    end if
end itemif
 %invname%
proc inventory  (itemhas  : boolean, itemname  : string, itemnum  : int)
    if count  = 4 or count  = 7 or count  = 10 and itemhas  = true then
        if itemhas  = true then
            GUI.AddText (boxID, itemname )
            GUI.AddText (boxID,  " (")
            GUI.AddText (boxID,  intstr (itemnum ))
            GUI.AddLine (boxID,  ")")
        else
            GUI.AddLine (boxID,  " ")
        end if
    else
        if itemhas  = true then
            GUI.AddText (boxID, itemname )
            GUI.AddText (boxID,  " (")
            GUI.AddText (boxID,  intstr (itemnum ))
            GUI.AddLine (boxID,  ")")
        end if
    end if
    count  := count +  1
end inventory
 proc invrun
 
    inventory  (woodsword.Has, woodsword.Name, woodsword.Amount )
    inventory  (stonesword.Has, stonesword.Name, stonesword.Amount )
    inventory  (ironsword.Has, ironsword.Name, ironsword.Amount )
    inventory  (diamondsword.Has, diamondsword.Name, diamondsword.Amount )
    inventory  (smallheal.Has, smallheal.Name, smallheal.Amount )
    inventory  (medheal.Has, medheal.Name, medheal.Amount )
    inventory  (largeheal.Has, largeheal.Name, largeheal.Amount )
    inventory  (woodshield.Has, woodshield.Name, woodshield.Amount )
    inventory  (ironshield.Has, ironshield.Name, ironshield.Amount )
    inventory  (diamondshield.Has, diamondshield.Name, diamondshield.Amount )
end invrun
 %enemy%/////////////////////////////////////////////////////////////////////////////////////////////////////
proc fariy
 
    enemyhp  := 60
    GUI.AddLine (boxID,  "a fariy blocks your path")
    combat  := true
    enemyname  := "fariy"
    loop
        turn  := false
        loop
            exit when turn  = true
        end loop
        exit when enemyhp <=  0
        if enemyhp <  20 then
            GUI.AddLine (boxID,  "the fairy uses a heal spell")
            enemyhp  := enemyhp +  20
        else
            GUI.AddLine (boxID,  "the fairy attacks")
            health  := health -  abs (30 - defence )
        end if
    end loop
end fariy
 proc cow
 
    enemyhp  := 150
    GUI.AddLine (boxID,  "a cow blocks your path")
    combat  := true
    enemyname  := "cow"
    loop
        turn  := false
        loop
            exit when turn  = true
        end loop
        exit when enemyhp <=  0
    end loop
end cow
 proc goblin
 
    enemyhp  := 100
    GUI.AddLine (boxID,  "a goblin blocks your path")
    combat  := true
    enemyname  := "goblin"
    loop
        turn  := false
        loop
            exit when turn  = true
        end loop
        exit when enemyhp <=  0
    end loop
end goblin
 proc enemyrand
     randint (enemy,  1,  3)
    if enemy  = 1 then
        fariy
     elsif enemy  = 2 then
        cow
     elsif enemy  = 3 then
        goblin
     else
        GUI.AddLine (boxID,  "what?")
    end if
end enemyrand
 %equipped%
proc equiprun  (var Amount  : int,  var Name  : string,  var Block  : int)
    Window.Select (- 1)
    if Name  = diamondsword.Name  or Name  = ironsword.Name  or Name  = stonesword.Name  or Name  = woodsword.Name  and Amount >=  1 then
        GUI.AddText (boxID,  "You equiped ")
        GUI.AddLine (boxID, Name )
        equiped  := Name
 
        damage  := Block
     elsif Amount >=  1 then
        GUI.AddText (boxID,  "You equiped ")
        GUI.AddLine (boxID, Name )
        shieldequiped  := Name
 
        defence  := Block
     else
        GUI.AddLine (boxID,  "You dont have that item")
    end if
    WindClose
 
    Invwind
 end equiprun
 proc equipdiamond
 
    equiprun  (diamondsword.Amount, diamondsword.Name, diamondsword.Damage )
end equipdiamond
 proc equipiron
 
    equiprun  (ironsword.Amount, ironsword.Name, ironsword.Damage )
end equipiron
 proc equipstone
 
    equiprun  (stonesword.Amount, stonesword.Name, stonesword.Damage )
end equipstone
 proc equipwood
 
    equiprun  (woodsword.Amount, woodsword.Name, woodsword.Damage )
end equipwood
 proc equipwoodsh
 
    equiprun  (woodshield.Amount, woodshield.Name, woodshield.Block )
end equipwoodsh
 proc equipironsh
 
    equiprun  (ironshield.Amount, ironshield.Name, ironshield.Block )
end equipironsh
 proc equipdiamondsh
 
    equiprun  (diamondshield.Amount, diamondshield.Name, diamondshield.Block )
end equipdiamondsh
 %healing%
proc healing  (var Amount, Healing  : int)
    Window.Select (- 1)
    if Amount >=  1 then
        for hp  : 1 .. Healing
             exit when health  = 100
            health  := health +  1
        end for
        Amount  := Amount -  1
        GUI.AddText (boxID,  "you are now at ")
        GUI.AddText (boxID,  intstr (health ))
        GUI.AddLine (boxID,  "% health")
    else
        GUI.AddLine (boxID,  "you dont have that item")
    end if
    WindClose
 
    Invwind
 end healing
 proc largehealing
 
    healing  (largeheal.Amount, largeheal.Healing )
end largehealing
 proc medhealing
 
    healing  (medheal.Amount, medheal.Healing )
end medhealing
 proc smallhealing
 
    healing  (smallheal.Amount, smallheal.Healing )
end smallhealing
 %shop%
proc shop
     GUI.AddLine (boxID,  "you enter the shop")
    GUI.AddLine (boxID,  "Shop Keep: welcome weary traveller to my shop")
    randint (item1,  500,  1000)
    randint (item2,  450,  750)
    randint (item3,  100,  250)
    randint (item4,  200,  250)
    randint (item5,  250,  300)
    GUI.AddLine (boxID,  "======== SHOP ========")
    GUI.AddText (boxID, diamondsword.Name )
    GUI.AddText (boxID,  " ")
    GUI.AddLine (boxID,  intstr (item1 ))
    GUI.AddText (boxID, diamondshield.Name )
    GUI.AddText (boxID,  " ")
    GUI.AddLine (boxID,  intstr (item2 ))
    GUI.AddText (boxID, largeheal.Name )
    GUI.AddText (boxID,  " ")
    GUI.AddLine (boxID,  intstr (item3 ))
    GUI.AddText (boxID, ironshield.Name )
    GUI.AddText (boxID,  " ")
    GUI.AddLine (boxID,  intstr (item4 ))
    GUI.AddText (boxID, ironsword.Name )
    GUI.AddText (boxID,  " ")
    GUI.AddLine (boxID,  intstr (item5 ))
    GUI.AddLine (boxID,  "======================")
end shop
 body proc WindClose
     GUI.CloseWindow (winID1 )
    winopen  := false
end WindClose
 body proc Invwind
 
    winID1  := Window.Open ("nobuttonbar;position:top;right")
    Window.Select (winID1 )
    space  := Buttonx
     if woodsword.Has  = true then
        button1x  := space
 
        button1y  := Buttony
         if equiped  = woodsword.Name  then
            drawfillbox (button1x -  4, Buttony -  4, button1x +  40, Buttony +  40,  green)
        end if
        wsb  := GUI.CreatePictureButton (button1x, Buttony, picID, equipwood )
        Draw.Text (intstr (woodsword.Amount ), button1x -  10, Buttony -  10, defFontID,  black)
        space  := space +  50
    end if
    if stonesword.Has  = true then
        button2x  := space
 
        button2y  := Buttony
         if equiped  = stonesword.Name  then
            drawfillbox (button2x -  4, Buttony -  4, button2x +  40, Buttony +  40,  green)
        end if
        ssb  := GUI.CreatePictureButton (button2x, Buttony, picID1, equipstone )
        Draw.Text (intstr (stonesword.Amount ), button2x -  10, Buttony -  10, defFontID,  black)
        space  := space +  50
    end if
    if ironsword.Has  = true then
        button3x  := space
 
        button3y  := Buttony
         if equiped  = ironsword.Name  then
            drawfillbox (button3x -  4, Buttony -  4, button3x +  40, Buttony +  40,  green)
        end if
        isb  := GUI.CreatePictureButton (button3x, Buttony, picID2, equipiron )
        Draw.Text (intstr (ironsword.Amount ), button3x -  10, Buttony -  10, defFontID,  black)
        space  := space +  50
    end if
    if diamondsword.Has  = true then
        button4x  := space
 
        button4y  := Buttony
         if equiped  = diamondsword.Name  then
            drawfillbox (button4x -  4, Buttony -  4, button4x +  40, Buttony +  40,  green)
        end if
        dsb  := GUI.CreatePictureButton (button4x, Buttony, picID3, equipdiamond )
        Draw.Text (intstr (diamondsword.Amount ), button4x -  10, Buttony -  10, defFontID,  black)
        space  := space +  50
    end if
    if smallheal.Has  = true then
        button5x  := space
 
        button5y  := Buttony
 
        shb  := GUI.CreatePictureButton (button5x, Buttony, picID4, smallhealing )
        Draw.Text (intstr (smallheal.Amount ), button5x -  10, Buttony -  10, defFontID,  black)
        space  := space +  50
    end if
    if medheal.Has  = true then
        button6x  := space
 
        button6y  := Buttony
 
        mhb  := GUI.CreatePictureButton (button6x, Buttony, picID5, medhealing )
        Draw.Text (intstr (medheal.Amount ), button6x -  10, Buttony -  10, defFontID,  black)
        space  := space +  50
    end if
    if largeheal.Has  = true then
        button7x  := space
 
        button7y  := Buttony
 
        lhb  := GUI.CreatePictureButton (button7x, Buttony, picID6, largehealing )
        Draw.Text (intstr (largeheal.Amount ), button7x -  10, Buttony -  10, defFontID,  black)
        space  := space +  50
    end if
    if woodshield.Has  = true then
        button8x  := space
 
        button8y  := Buttony
         if shieldequiped  = woodshield.Name  then
            drawfillbox (button8x -  4, Buttony -  4, button8x +  40, Buttony +  40,  blue)
        end if
        wshb  := GUI.CreatePictureButton (button8x, Buttony, picID7, equipwoodsh )
        Draw.Text (intstr (woodshield.Amount ), button8x -  10, Buttony -  10, defFontID,  black)
        space  := space +  50
    end if
    if ironshield.Has  = true then
        button9x  := space
 
        button9y  := Buttony
         if shieldequiped  = ironshield.Name  then
            drawfillbox (button9x -  4, Buttony -  4, button9x +  40, Buttony +  40,  blue)
        end if
        ishb  := GUI.CreatePictureButton (button9x, Buttony, picID8, equipironsh )
        Draw.Text (intstr (ironshield.Amount ), button9x -  10, Buttony -  10, defFontID,  black)
        space  := space +  50
    end if
    if diamondshield.Has  = true then
        button10x  := space
 
        button10y  := Buttony
         if shieldequiped  = diamondshield.Name  then
            drawfillbox (button10x -  4, Buttony -  4, button10x +  40, Buttony +  40,  blue)
        end if
        dshb  := GUI.CreatePictureButton (button10x, Buttony, picID9, equipdiamondsh )
        Draw.Text (intstr (diamondshield.Amount ), button10x -  10, Buttony -  10, defFontID,  black)
        space  := space +  50
    end if
    Font.Draw ("Player Damage:", 10,  15, statfont,  brightred)
    Font.Draw (intstr (damage ), 190,  15, statfont,  black)
    Font.Draw ("Player Defence:", 10,  38, statfont,  brightblue)
    Font.Draw (intstr (defence ), 190,  38, statfont,  black)
    if winopen  = true then
        GUI.CloseWindow (winID1 )
    end if
    var quitBtn  : int := GUI.CreateButton (230,  10,  0,  "Quit", WindClose )
    winopen  := true
end Invwind
 %/////////Process/////////%
%/////////////////////////%
process item
     loop
        itemif  (woodsword.Amount, woodsword.Has )
        itemif  (stonesword.Amount, stonesword.Has )
        itemif  (ironsword.Amount, ironsword.Has )
        itemif  (diamondsword.Amount, diamondsword.Has )
        itemif  (smallheal.Amount, smallheal.Has )
        itemif  (medheal.Amount, medheal.Has )
        itemif  (largeheal.Amount, largeheal.Has )
        itemif  (woodshield.Amount, woodshield.Has )
        itemif  (ironshield.Amount, ironshield.Has )
        itemif  (diamondshield.Amount, diamondshield.Has )
    end loop
end item
 %death%
process death
     loop
        drawfillbox (480 + health  * 2,  10,  680,  30,  black)
        drawfillbox (480,  10,  479 + health  * 2,  30,  brightred)
        drawfillbox (480,  31,  680,  80,  white)
        if health <=  0 then
            exit
        end if
    end loop
    Text.Cls
    GUI.AddLine (boxID,  "you died")
end death
 %buttons%//////////////////////////////////////////////////////////////////////////////////////
proc textrun  (text  : string)
    input  := GUI.GetText (commandpromp )
    cmdrun  := true
end textrun
 process button1
     var draw  : int := GUI.CreateButtonFull (558,  350,  50,  "Inventory", Invwind,  50,  "h", true)
    commandpromp  := GUI.CreateTextFieldFull  (3,  14,  465,  "", textrun, GUI.INDENT,  0,  0)
    GUI.Refresh
    loop
        exit when GUI.ProcessEvent
    end loop
    GUI.Refresh
end button1
 %commands%
process commandspro
     loop
        loop
            cmdrun  := false
            loop
                exit when cmdrun  = true
            end loop
            cmdrun  := false
            if input  = "help" then
                GUI.AddLine (boxID,  "////Commands////")
                GUI.AddLine (boxID,  "for items with a space in their name put _ instead")
                GUI.AddLine (boxID,  "example med_heal")
                GUI.AddLine (boxID,  "help - opens the help menu")
                GUI.AddLine (boxID,  "equip show - shows what you have equiped")
                GUI.AddLine (boxID,  "equip <item> equipes an item")
                GUI.AddLine (boxID,  "use <item> use an item")
            elsif input  = "debug" then
                fork button1
 
                woodsword.Amount  := 1
                stonesword.Amount  := 1
                ironsword.Amount  := 1
                diamondsword.Amount  := 1
                smallheal.Amount  := 1
                medheal.Amount  := 1
                largeheal.Amount  := 1
                woodshield.Amount  := 1
                ironshield.Amount  := 1
                diamondshield.Amount  := 1
            elsif input  = commands  (3) and combat  = true then
                GUI.AddText (boxID,  "you hit the ")
                GUI.AddText (boxID, enemyname )
                GUI.AddText (boxID,  " with your ")
                GUI.AddText (boxID, equiped )
                GUI.AddText (boxID,  " doing ")
                GUI.AddText (boxID,  intstr (damage ))
                GUI.AddText (boxID,  "damage")
                enemyhp  := enemyhp - damage
 
                turn  := true
            elsif input  = commands  (3) and combat  = false then
                GUI.AddLine (boxID,  "you are not in combat")
            elsif input  = commands  (1) or input  = commands  (2) or input  = commands  (4) or input  = commands  (5) then
                exit
            elsif move  = 1 then
                case input  of
                    label "Yes",  "yes",  "y",  "Y" :
                        move2  := 1
                    label "No",  "no",  "n",  "N" :
                        move2  := 2
                    label :
                        GUI.AddLine (boxID,  "Invalid Command")
                end case
            elsif move  = 2 then
                case input  of
                    label "Right",  "right",  "R",  "r" :
                        move3  := 2
                    label "Left",  "left",  "l",  "L" :
                        move3  := 1
                    label :
                        GUI.AddLine (boxID,  "Invalid Command")
                end case
            else
                GUI.AddLine (boxID,  "Invalid Command")
            end if
        end loop
        cmdrun  := false
        loop
            exit when cmdrun  = true
        end loop
        cmdrun  := false
        if input  = commands  (7) and input2  = "wooden_sword" then
            equiprun  (woodsword.Amount, woodsword.Name, woodsword.Damage )
        elsif input  = commands  (7) and input2  = "stone_sword" then
            equiprun  (stonesword.Amount, stonesword.Name, stonesword.Damage )
        elsif input  = commands  (7) and input2  = "iron_sword" then
            equiprun  (ironsword.Amount, ironsword.Name, ironsword.Damage )
        elsif input  = commands  (7) and input2  = "diamond_sword" then
            equiprun  (diamondsword.Amount, diamondsword.Name, diamondsword.Damage )
        elsif input  = commands  (7) and input2  = "show" then
            case equiped  of
                label "Wooden Sword",  "Stone Sword",  "Iron Sword",  "Diamond Sword" :
                    GUI.AddLine (boxID, equiped )
                label :
                    GUI.AddLine (boxID,  "You do not have anything equiped")
            end case
        elsif input  = commands  (8) then
            case input2  of
                label "large_heal",  "Large_Heal" :
                    healing  (largeheal.Amount, largeheal.Healing )
                label "med_heal",  "Med_Heal" :
                    healing  (medheal.Amount, medheal.Healing )
                label "small_heal",  "Small_Heal" :
                    healing  (smallheal.Amount, smallheal.Healing )
            end case
        else
            GUI.AddLine (boxID,  "Invalad Input")
        end if
    end loop
end commandspro
 fork item
 %//////Game start//////%
GUI.AddLine (boxID,  "Welcome to a game i made")
GUI.AddLine (boxID,  "Would you like to play?")
GUI.AddLine (boxID,  "yes/no")
loop
    get start
     exit when start  = "yes"
    if start  = "no" then
        Text.Cls
        loop
            GUI.AddLine (boxID,  "Do you want to quit?")
            locate (24,  1)
            get stop
             if stop  = "yes" then
                quit
            elsif stop  = "no" then
                Text.Cls
                GUI.AddLine (boxID,  "Do you want to play")
                GUI.AddLine (boxID,  "Yes/No")
                exit
            else
                GUI.AddLine (boxID,  "Invalid Input")
            end if
        end loop
    elsif start  = "debug" then
        fork button1
 
        woodsword.Amount  := 1
        stonesword.Amount  := 1
        ironsword.Amount  := 1
        diamondsword.Amount  := 1
        smallheal.Amount  := 1
        medheal.Amount  := 1
        largeheal.Amount  := 1
        woodshield.Amount  := 1
        ironshield.Amount  := 1
        diamondshield.Amount  := 1
    else
        GUI.AddLine (boxID,  "Invalid Input")
    end if
end loop
Text.Cls
loop
    GUI.AddLine (boxID,  "What is your name?")
    locate (24,  1)
    get name
     Text.Cls
    loop
        GUI.AddText (boxID,  "You picked ")
        GUI.AddText (boxID, name )
        GUI.AddLine (boxID,  " is that correct? yes/no")
        locate (24,  1)
        get nametest
         exit when nametest  = "no" or nametest  = "yes"
        GUI.AddLine (boxID,  "Inalid Input")
    end loop
    exit when nametest  = "yes"
end loop
Text.Cls
GUI.AddText (boxID,  "Liam: ok ")
GUI.AddText (boxID, name )
GUI.AddLine (boxID,  " Time to learn to fight")
locate (24,  1)
Input.Pause
GUI.AddLine (boxID,  "Liam: This is your health")
fork death
 locate (24,  1)
Input.Pause
GUI.AddLine (boxID,  "Liam: Dont let it get to low")
locate (24,  1)
Input.Pause
GUI.AddLine (boxID,  "Liam: I have given you some basic items to help you on your journey")
locate (24,  1)
woodsword.Amount  := 1
smallheal.Amount  := 4
woodshield.Amount  := 5
medheal.Amount  := 2
Input.Pause
GUI.AddLine (boxID,  "Liam: The items are in your inventory")
fork button1
 GUI.AddLine (boxID,  "Liam: For help type the command help")
%///Buttons///%
%//Starting place//%
locate (24,  1)
Input.Pause
GUI.AddLine (boxID,  "You appear in a grassy medow")
locate (24,  1)
Input.Pause
GUI.AddLine (boxID,  "Infront of you are two paths")
locate (24,  1)
Input.Pause
GUI.AddLine (boxID,  "To your left is a village, to your right is a cave")
locate (24,  1)
Input.Pause
GUI.AddLine (boxID,  "Wich path do you take? left or right?")
%//commands//%
%move = 1 is yes or no, move = 2 is left or right, move = 3 nutral%
%move2 = 1 yes, move2 = 2 no, move2 = 3 netural%
%move3 = 1 left, move3 = 2 right, move3 = 3 neutral%
move  := 2
fork commandspro
 %/////Places/////%
%cave%/////////////////////////////
proc cave
     GUI.AddLine (boxID,  "you found a cave")
    GUI.AddLine (boxID,  "enter?")
    GUI.AddLine (boxID,  "yes/no")
    move  := 1
    move2  := 3
    loop
        exit when move2  = 1 or move2  = 2
    end loop
    if move2  = 2 then
        GUI.AddLine (boxID,  "you go past the cave and continue on your way")
        move2  := 3
        move  := 3
        return
    elsif move2  = 1 then
        move2  := 3
        move  := 3
        GUI.AddLine (boxID,  "you enter the cave and look around")
        enemyrand
         loop
            exit when combat  = false
        end loop
        randint (cavesub,  1,  3)
        if cavesub  = 1 then
            GUI.AddLine (boxID,  "entering the cave you find a diamond guarded by a bosscow")
            GUI.AddLine (boxID,  "fight it? yes/no?")
            move  := 1
            loop
                exit when move2  = 1 or move2  = 2
            end loop
            if move2  = 1 then
                move2  := 3
                move  := 3
                GUI.AddLine (boxID,  "bosscow here")
                return
            elsif move2  = 2 then
                move2  := 3
                move  := 3
                GUI.AddLine (boxID,  "you value you life more than that diamond. you leave the cave and continue on your way")
                return
            end if
        elsif cavesub  = 2 then
            GUI.AddLine (boxID,  "gold")
            return
        elsif cavesub  = 3 then
            GUI.AddLine (boxID,  "lava")
            return
        end if
    end if
end cave
 %village%///////////////////////////////////////
proc village
     GUI.AddLine (boxID,  "you found a village")
    GUI.AddLine (boxID,  "enter?")
    GUI.AddLine (boxID,  "yes/no")
    move  := 1
    move2  := 3
    loop
        exit when move2  = 1 or move2  = 2
    end loop
    if move2  = 2 then
        GUI.AddLine (boxID,  "you go past the village and continue on your way")
        move2  := 3
        move  := 3
        return
    elsif move2  = 1 then
        move2  := 3
        move  := 3
        GUI.AddLine (boxID,  "you enter the village and look around")
        randint (villagesub,  1,  3)
        if villagesub  = 1 then
            GUI.AddLine (boxID,  "entering the village you find a shop")
            GUI.AddLine (boxID,  "go in? yes/no?")
            move  := 1
            loop
                exit when move2  = 1 or move2  = 2
            end loop
            if move2  = 1 then
                move2  := 3
                move  := 3
                shop
             elsif move2  = 2 then
                move2  := 3
                move  := 3
                GUI.AddLine (boxID,  "you leave the village and continue on your way")
                return
            end if
        elsif villagesub  = 2 then
            GUI.AddLine (boxID,  "entering the village you find a bar")
            GUI.AddLine (boxID,  "buy healing potions at the bar?")
            move  := 1
            loop
                exit when move2  = 1 or move2  = 2
            end loop
            if move2  = 1 then
                move2  := 3
                move  := 3
                GUI.AddLine (boxID,  "test bar yes")
                return
            elsif move2  = 2 then
                move2  := 3
                move  := 3
                GUI.AddLine (boxID,  "test bar no")
                GUI.AddLine (boxID,  "you leave the village and continue on your way")
                return
            end if
            return
        elsif villagesub  = 3 then
            GUI.AddLine (boxID,  "entering the village you find an inn")
            GUI.AddLine (boxID,  "resotre your health at the inn?")
            GUI.AddLine (boxID,  "costs 50 coins")
            move  := 1
            loop
                exit when move2  = 1 or move2  = 2
            end loop
            if move2  = 1 and bal >=  50 then
                move2  := 3
                move  := 3
                bal  := bal -  50
                health  := 100
                GUI.AddLine (boxID,  "your health has been restored")
                return
            elsif move2  = 2 then
                move2  := 3
                move  := 3
                GUI.AddLine (boxID,  "you leave the village and continue on your way")
                return
            elsif move2  = 1 and bal <  50 then
                GUI.AddLine (boxID,  "you do not have enough coins for that")
                return
            end if
        else
            GUI.AddLine (boxID,  "whaaaa")
        end if
    end if
end village
 %forest%////////////////////////////////////////
proc woods
     GUI.AddLine (boxID,  "you found a forest")
    GUI.AddLine (boxID,  "enter?")
    GUI.AddLine (boxID,  "yes/no")
    move  := 1
    move2  := 3
    loop
        exit when move2  = 1 or move2  = 2
    end loop
end woods
 %///Scripted places///%
loop
    exit when move3  = 1 or move3  = 2
end loop
move  := 3
if move3  = 1 then
    move  := 3
    move3  := 3
    village
 elsif move3  = 2 then
    move  := 3
    move3  := 3
    cave
 else
    GUI.AddLine (boxID,  "whoooot?")
end if
%//place randomizer//%
proc placerand
     loop
        Window.Update (- 1)
        randint (place,  1,  3)
        GUI.AddLine (boxID,  "")
        if place  = 1 then
            cave
         elsif place  = 2 then
            village
         elsif place  = 3 then
            woods
         else
            GUI.AddLine (boxID,  "what?")
        end if
    end loop
end placerand
 
placerand
   | 	  
		
 | 
			 
			
				 | 
			 
		  | 
	 
	 
		 | 
		
		 | 
	 
	  
		  | 
	 
				 
		Insectoid
 
  
 
    
		 | 
		
		
			
				  Posted: Wed Apr 03, 2019 4:52 pm    Post subject: RE:need help with inputting a text field...  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				It's tough to say exactly what's going on. It's possible that Gui buttons do not support deferred action procedures. It could be a bug in Turing. Gui buttons don't follow the same rules as the rest of Turing (well they do, but they don't). They do weird black magic, and you're usually better off, in my opinion, creating your own buttons with draw commands and Mouse.Where(). 
 
 
It's also unusual to need to forward declared procedures. Usually, you can restructure the program to not require it, and you're better off that way.
 
 
Finally, your liberal application of processes is going to bite you in the ass. Processes do funny things, the most annoying being they tend to cause random crashes and bugs that can't be reproduced and can't be diagnosed or fixed. Trust me, processes are bad news 99% of the time.
 
 
I don't use any of these features in my own code, as a rule. They're too unpredictable, and unnecessary.
		
 | 
			 
			
				 | 
			 
		  | 
	 
	 
		 | 
		
		 | 
	 
	  
		  | 
	 
		 
		Sponsor Sponsor 
		 
  
		 | 
		
 | 
	 
	 
		  | 
	 
				 
		 | 
	 
 
	
	
	 
	
	 |