プレイ日記
ĦHarry Ramstrong
I tried to make a library, but I'm getting "Undefined variable" on B[], and "Type mismatch" on A[]. What gives? How can I use arrays on my library files? Either DIM or VAR keyword should work, but it doesn't in this case.
6そうだね
プレイ済み
返信[1]
親投稿
Cris cmart592
Try putting a instead of b, or make another DIM for b.
0そうだね
プレイ済み
返信[2]
親投稿
ĦHarry Ramstrong
dim b is in slot 0. Taking it out gives me Type mismatch on A. It's like Dim A doesn't exist even though it should be global.
0そうだね
プレイ済み
返信[3]
親投稿
Ed CPFace
I was having this exact problem. This is a screenshot of the library, yes? So you're including it from some other program file? I found that I had to use EXEC "PRG1:LIB" instead of USE "PRG1:LIB". This allows the library to define its local variables. They remain in memory, but they can only be accessed by the library's functions. That should solve your A array.
2そうだね
プレイ済み
返信[4]
親投稿
Ed CPFace
As for your B array, I'm guessing it was defined in the program file that's using this library. Unfortunately, your library can't "see" any variables that were defined outside of it. Either you must pass B into INIT as an argument and work with it there, or you must define B in your library and set up COMMON functions that allow other files to access it.
1そうだね
プレイ済み
返信[5]
親投稿
Ed CPFace
Here's a conversation where I got help on the subject. https://miiverse.nintendo.net/posts/AYMHAAACAAADVHkmXGmS3w And if you haven't already, you can look at my library for an example of how it works. Public key [Q3KKVPDM]
2そうだね
プレイ済み
返信[6]
親投稿
ĦHarry Ramstrong
Hi Ed. You got it perfect! Exec did the trick. Thanks. I was reading Raycast.lib, and it says USE 1, so I guess I was confused. Thanks for the help. Now to make my own library!
2そうだね
プレイ済み
返信[7]
親投稿
Cris cmart592
Library? Say what? Just wondering do you know how to change the sprites of the spooky Maze?
0そうだね
プレイ済み
返信[8]
親投稿
ĦHarry Ramstrong
Sorry, it's too complicated for me. I'd sooner do a lightweight raycaster of my own than using calc84's full-featured one.
0そうだね
プレイ済み
返信[9]
親投稿
Cris cmart592
Oooh cool!
0そうだね
プレイ済み