Thanks for trying to implement my vision in PB, @SMaag. Im having trouble understanding all of it because both pointers and PB's Maps are not instinctive to me. You commented some, but not enough. :lol:
But your comment about my idea resembling RPN compelled me to look that up on Wikipedia, and ...
Search found 13 matches
- Thu Dec 25, 2025 2:54 am
- Forum: Coding Questions
- Topic: Is it possible to use array cell contents as variable names
- Replies: 9
- Views: 571
- Wed Dec 24, 2025 1:58 pm
- Forum: Coding Questions
- Topic: Is it possible to use array cell contents as variable names
- Replies: 9
- Views: 571
Re: Is it possible to use array cell contents as variable names
Instead of creating hundreds of variables, you can also work with structures and index.
Here is an example with an array and a map as an index.
...
You understand my intention more closely, but i oversimplified the problem. Instead of passing by value, or passing by reference, i am trying to ...
- Wed Dec 24, 2025 4:13 am
- Forum: Coding Questions
- Topic: Is it possible to use array cell contents as variable names
- Replies: 9
- Views: 571
Is it possible to use array cell contents as variable names
Let's use a simple one cell array. I need to check the variable whose name is in the cell. For example, the string in the cell is "mileage" , which is also a variable name. Whatever variable name is in the cell is the one I need to get the value for.
Is it possible for PB to to get or set the value ...
Is it possible for PB to to get or set the value ...
- Sat Oct 04, 2025 3:46 pm
- Forum: Coding Questions
- Topic: Problems with list in a procedure - need help
- Replies: 13
- Views: 1297
Re: Problems with list in a procedure - need help
QUESTIONS:
1. Enumerations have to be declared before using their variable in a structure? Can you not set their values after?
2. This was very helpful, esp. in the use of PushListPosition and PopListPosition. I will be searching many lists in my routines and im sure i'll be using those a lot.
3 ...
1. Enumerations have to be declared before using their variable in a structure? Can you not set their values after?
2. This was very helpful, esp. in the use of PushListPosition and PopListPosition. I will be searching many lists in my routines and im sure i'll be using those a lot.
3 ...
- Thu Oct 02, 2025 3:59 pm
- Forum: Coding Questions
- Topic: Problems with list in a procedure - need help
- Replies: 13
- Views: 1297
Re: Problems with list in a procedure - need help
Dang you guys are more than helpful!
Im gonna look over all this code and learn as much as i can. PureBasic is not my first language so im having a hard time with even simple things.
Thanx guys!
Im gonna look over all this code and learn as much as i can. PureBasic is not my first language so im having a hard time with even simple things.
Thanx guys!
- Thu Oct 02, 2025 8:35 am
- Forum: Coding Questions
- Topic: Problems with list in a procedure - need help
- Replies: 13
- Views: 1297
Re: Problems with list in a procedure - need help
Im not understanding the question or the need for global declaration. Im using the same syntax as in the help manual.
Newlist creates the list construct, and im using a Structure as its elements.
....
Ok i went back to the manual and it does say (in the NewList page, nowhere else, and "global ...
Newlist creates the list construct, and im using a Structure as its elements.
....
Ok i went back to the manual and it does say (in the NewList page, nowhere else, and "global ...
- Thu Oct 02, 2025 4:46 am
- Forum: Coding Questions
- Topic: Problems with list in a procedure - need help
- Replies: 13
- Views: 1297
Problems with list in a procedure - need help
The following code will be some of the first lines in a program before the main routine begins. I am setting up my lists, enumerations, and called procedures. I ran a syntax check to make sure that im doing this right:
; Compartments for the SNB:
structure SNbits
SNID.q
SNbitflags.a
SNptr.q ...
; Compartments for the SNB:
structure SNbits
SNID.q
SNbitflags.a
SNptr.q ...
- Tue Sep 30, 2025 10:15 am
- Forum: Coding Questions
- Topic: Multi-use structure element - pointers or unions?
- Replies: 3
- Views: 510
Re: Multi-use structure element - pointers or unions?
I did think about using Maps, but they cant be sorted, and i need to sort my list of numbers often. (Altho i could use maps for the secondary lists, since the initial list will have the reference to an element in the map.)
But i still didnt get my answer of when structure unions are helpful.
But i still didnt get my answer of when structure unions are helpful.
- Tue Sep 30, 2025 2:06 am
- Forum: Coding Questions
- Topic: Multi-use structure element - pointers or unions?
- Replies: 3
- Views: 510
Multi-use structure element - pointers or unions?
Im creating multiple lists that reference particular entries by ID. In other words, each list entry will have an initial index of so many bytes that is called by other lists, to help separate the data but keep it linked. Imagine multiple lists whose first number in each line is the same, indicating ...
- Sun Sep 28, 2025 3:47 pm
- Forum: Coding Questions
- Topic: Enumerations within structures?
- Replies: 4
- Views: 665
Re: Enumerations within structures?
Ok thanks for all your advice.
The reason i wanted to use a structure as my list element is so i can quickly access a bit by variable name. But as i already knew, there arent one-bit variable sizes, the smallest is one byte.
So think i'll incorporate @mk-soft's code and just store the list ...
The reason i wanted to use a structure as my list element is so i can quickly access a bit by variable name. But as i already knew, there arent one-bit variable sizes, the smallest is one byte.
So think i'll incorporate @mk-soft's code and just store the list ...
- Sun Sep 28, 2025 11:19 am
- Forum: Coding Questions
- Topic: Enumerations within structures?
- Replies: 4
- Views: 665
Enumerations within structures?
I am attempting to set up a list whose elements are in the format of a Structure, but the Structure elements are simply a sequence of bits (for ultrafast bitflag checking), and there are 32 bits. So in other words, the list is composed of a series of 32-bit elements, meaning they are ultimately just ...
- Sat Jan 25, 2025 3:01 pm
- Forum: Coding Questions
- Topic: Whats the best way to check mouseclick locations in window
- Replies: 4
- Views: 1265
Re: Whats the best way to check mouseclick locations in window
OK I'll first try a loop to test for the mouseclick within rects.
I can probly optimize it by deductive testing, such as "is mouseX greater than firstrowX?" and winnow it down that way.
Thanks for your suggestions guys
I can probly optimize it by deductive testing, such as "is mouseX greater than firstrowX?" and winnow it down that way.
Thanks for your suggestions guys
- Sat Jan 25, 2025 12:09 am
- Forum: Coding Questions
- Topic: Whats the best way to check mouseclick locations in window
- Replies: 4
- Views: 1265
Whats the best way to check mouseclick locations in window
I'm developing a new game in PB which uses a table of card slots, so that when you have selected a card to place, you can then click on a card slot to move that card there. I'm simply using image placement on an image window. No 2D or 3D commands.
The problem is there are 100 possible rectangles ...
The problem is there are 100 possible rectangles ...