1. Type_check failure, game_name is {}

Thanks Brian for the reply to my message 'Making UDT's using Sequence?'
I cutout then rewrote the code like in the reply message. 
BUT, when I run it, the following message pops up

Reva.exw:38
Type_check failure, game_name is {}

--> see ex.err

I figured that game_name must of loaded as "" instead of "NAVGAP #19" and the
problem is either in the open("filename", "r") or the use of the get()
command?
                      
                       fn = open( "gamestat.dat", "r" )  
                       or 
                       get_game = get(fn)

 
------------------------------ HERE IS THE CODE
-----------------------------------

include Win32Lib.ew
        without warning

constant x = 1, race = 2, trn  = 3, rst  = 4, name = 5, last = 6

sequence get_game, game
                   game = {0,{0,0,0,0,0,0,0,0,0,0,0},"","","",0}
integer fn

fn = open( "gamestat.dat", "r" )     
   get_game = get(fn)
   if get_game[1] = GET_SUCCESS then
      game = get_game[2]
   end if
close(fn)

integer game_name
        game_name = game[name]
constant
Win = create( Window, "REVA", 0, 0, 0, 300, 200, 0 ),
game_menu  = create( Menu, "&Games", Win, 0, 0, 0, 0, 0 ),
menu_game1 = create( MenuItem, game_name, game_menu, 0,0,0,0,0 )

WinMain(Win, Normal)

new topic     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu