In lists, you can add, delete, insert, replace.
But you can only do so at the first or last item on the list, or delete/replace all.
You can also use Operations to insert a number, and delete/insert/replace item 3, 4, or whatever.
However I think that there should be options for adding, deleting, inserting, and replacing named items, like "cheese," "cabbage," "sword." This would make inventories (for RPGs) a lot easier.
Offline
coppearlix wrote:
But you can only do so at the first or last item on the list, or delete/replace all.
I thought you could just enter in your own number :S
Offline
Oh, right. Sorry, I was wrong about that. But you can't delete an object by its name.
Offline
coppearlix wrote:
Oh, right. Sorry, I was wrong about that. But you can't delete an object by its name.
Say you wanted to delete the item "Sword" in the list "Inventory". You'd put:
set [Temp1 v] to [1] repeat until <<item (Temp1) of [Inventory v]> = <[Sword]>> change (Temp1) by [1] end delete (Temp1) of [Inventory v]It may be a little time consuming in big lists, but it works nonetheless.
Last edited by RedRocker227 (2012-01-29 04:44:45)
Offline
RedRocker227 wrote:
coppearlix wrote:
Oh, right. Sorry, I was wrong about that. But you can't delete an object by its name.
Say you wanted to delete the item "Sword" in the list "Inventory". You'd put:
set [Temp1 v] to [1] repeat until <<item (Temp1) of [Inventory v]> = [Sword]> change [Temp1 v] by [1] end delete (Temp1) of [Inventory v]It may be a little time consuming in big lists, but it works nonetheless.
Fixed a bit.
Offline
RedRocker227 wrote:
coppearlix wrote:
Oh, right. Sorry, I was wrong about that. But you can't delete an object by its name.
Say you wanted to delete the item "Sword" in the list "Inventory". You'd put:
set [Temp1 v] to [1] repeat until <<item (Temp1) of [Inventory v]> = <[Sword]>> change (Temp1) by [1] end delete (Temp1) of [Inventory v]It may be a little time consuming in big lists, but it works nonetheless.
I know that it can be done, but having a block to save time seems nice Like how people want the previous costume block xD
Offline
Thanks RedRocker227 and rdococ. I hadn't thought of that... Like Chrischb, I still think a block would save lots of time, but y'all have been a great help nonetheless. Hey, maybe I can make an RPG game now, and then I can finally delete that notification that's been bugging me for 9 months
Offline
I believe you are talking about associative arrays. I agree that these would be quite useful, but they would also over complicate arrays. Unless you're assigning each item a number and a name, you'll have some elements with numbers, and some with names. Giving all items both seems to over-complicate things (for instance, would "named" items be sorted alphabetically or by number? Would "last item" be the last numbered item or the last named item? etc.). Just my two cents.
Offline
MoreGamesNow wrote:
I believe you are talking about associative arrays. I agree that these would be quite useful, but they would also over complicate arrays. Unless you're assigning each item a number and a name, you'll have some elements with numbers, and some with names. Giving all items both seems to over-complicate things (for instance, would "named" items be sorted alphabetically or by number? Would "last item" be the last numbered item or the last named item? etc.). Just my two cents.
?
Number refers to the item's position on the list... like this:
1. apple
2. warthog
3. pencil
Offline
Sorry, I thought you were talking about associative arrays, but, after rereading the above comments, that was a mistake on my part. If you're interested, an example would be:
[insert (6) at ("apple")]
[insert ("four") at ("pear")]
Creating this:
List:
apple 6
pear "four"
Last edited by MoreGamesNow (2012-01-29 22:26:49)
Offline
MoreGamesNow wrote:
Sorry, I thought you were talking about associative arrays, but, after rereading the above comments, that was a mistake on my part. If you're interested, an example would be:
[insert (6) at ("apple")]
[insert ("four") at ("pear")]
Creating this:
List:
apple 6
pear "four"
You're still not getting it.
What the person wants is to remove named items on the list.
For an example:
List1:
1. apple
2. apple
3. pear
4. banana
Instead of having to check for which one is "pear", they could simply use:
delete [pear] of [List1 v]and the first "pear" found is deleted.
Offline
rdococ wrote:
MoreGamesNow wrote:
Sorry, I thought you were talking about associative arrays, but, after rereading the above comments, that was a mistake on my part. If you're interested, an example would be:
[insert (6) at ("apple")]
[insert ("four") at ("pear")]
Creating this:
List:
apple 6
pear "four"You're still not getting it.
What the person wants is to remove named items on the list.
For an example:
List1:
1. apple
2. apple
3. pear
4. banana
Instead of having to check for which one is "pear", they could simply use:delete [pear] of [List1 v]and the first "pear" found is deleted.
In a different list that also contains "pear" in a different number than "3", the pear will be deleted, not whatever item is 3rd.
He understood, he just wanted to make sure everyone knew what an associative array was.
Offline