fivehead

I'm basically doing a rpg-ish game and a lot of choices will be text-based.

This is what I have as of now:

when this sprite clicked
ask [Item?] and wait
if <[items v] contains [ (answer)]> then
say [Success!] for (2) secs

end

Of course the success part is just for testing purposes. But what I'm trying to do is remove that item after it's used. Is there any way to do this? It seems like there would be because it's so simple, but you never know.

I've tried:

delete ((answer) v) of [Items  v]

I've tried using this as part of the previous script, but it did not appear to work.

DanloVorje

The “delete () of (list v)” block can only take a number as an input (aka the position of the item you want to delete). In order to delete an item in a list containing a specific string, you'll need to use an iterative loop.

The basic structure would be something like this:
set [i v] to [1]
repeat until <<(item (i) of [list v]) = [thing you want to delete]> or <(i) > (length of [list v])> >
change [i v] by (1)
end
delete (i) of [list v]

Note that this would delete only the first instance of the thing you want to delete, not all instances of it.

Hope this helps!

–Danlo

fivehead

DanloVorje wrote:

The “delete () of (list v)” block can only take a number as an input (aka the position of the item you want to delete). In order to delete an item in a list containing a specific string, you'll need to use an iterative loop.

The basic structure would be something like this:
set [i v] to [1]
repeat until <<(item (i) of [list v]) = [thing you want to delete]> or <(i) > (length of [list v])> >
change [i v] by (1)
end
delete (i) of [list v]

Note that this would delete only the first instance of the thing you want to delete, not all instances of it.

Hope this helps!

–Danlo
Is “i” a certain variable I should be using, or is that just an example? Thanks for the help!

deck26

fivehead wrote:

DanloVorje wrote:

The “delete () of (list v)” block can only take a number as an input (aka the position of the item you want to delete). In order to delete an item in a list containing a specific string, you'll need to use an iterative loop.

The basic structure would be something like this:
set [i v] to [1]
repeat until <<(item (i) of [list v]) = [thing you want to delete]> or <(i) > (length of [list v])> >
change [i v] by (1)
end
delete (i) of [list v]

Note that this would delete only the first instance of the thing you want to delete, not all instances of it.

Hope this helps!

–Danlo
Is “i” a certain variable I should be using, or is that just an example? Thanks for the help!
There is rarely (if ever) any need for a variable to have a particular name. You can call it ‘i’ or ‘index’ or ‘loop control’ or ‘this is a stupid name for a variable’.

fivehead

deck26 wrote:

fivehead wrote:

DanloVorje wrote:

The “delete () of (list v)” block can only take a number as an input (aka the position of the item you want to delete). In order to delete an item in a list containing a specific string, you'll need to use an iterative loop.

The basic structure would be something like this:
set [i v] to [1]
repeat until <<(item (i) of [list v]) = [thing you want to delete]> or <(i) > (length of [list v])> >
change [i v] by (1)
end
delete (i) of [list v]

Note that this would delete only the first instance of the thing you want to delete, not all instances of it.

Hope this helps!

–Danlo
Is “i” a certain variable I should be using, or is that just an example? Thanks for the help!
There is rarely (if ever) any need for a variable to have a particular name. You can call it ‘i’ or ‘index’ or ‘loop control’ or ‘this is a stupid name for a variable’.
I knew that, but I was just asking if I needed a variable also coordinated with something else. Either way, thanks for the help!

KEL5isGod

fivehead wrote:

deck26 wrote:

fivehead wrote:

DanloVorje wrote:

The “delete () of (list v)” block can only take a number as an input (aka the position of the item you want to delete). In order to delete an item in a list containing a specific string, you'll need to use an iterative loop.

The basic structure would be something like this:
set [i v] to [1]
repeat until <<(item (i) of [list v]) = [thing you want to delete]> or <(i) > (length of [list v])> >
change [i v] by (1)
end
delete (i) of [list v]

Note that this would delete only the first instance of the thing you want to delete, not all instances of it.

Hope this helps!

–Danlo
Is “i” a certain variable I should be using, or is that just an example? Thanks for the help!
There is rarely (if ever) any need for a variable to have a particular name. You can call it ‘i’ or ‘index’ or ‘loop control’ or ‘this is a stupid name for a variable’.
I knew that, but I was just asking if I needed a variable also coordinated with something else. Either way, thanks for the help!
The variable can be named anything really, you can even name it
(seventeen seventy five mate)

deck26

fivehead wrote:

deck26 wrote:

fivehead wrote:

DanloVorje wrote:

The “delete () of (list v)” block can only take a number as an input (aka the position of the item you want to delete). In order to delete an item in a list containing a specific string, you'll need to use an iterative loop.

The basic structure would be something like this:
set [i v] to [1]
repeat until <<(item (i) of [list v]) = [thing you want to delete]> or <(i) > (length of [list v])> >
change [i v] by (1)
end
delete (i) of [list v]

Note that this would delete only the first instance of the thing you want to delete, not all instances of it.

Hope this helps!

–Danlo
Is “i” a certain variable I should be using, or is that just an example? Thanks for the help!
There is rarely (if ever) any need for a variable to have a particular name. You can call it ‘i’ or ‘index’ or ‘loop control’ or ‘this is a stupid name for a variable’.
I knew that, but I was just asking if I needed a variable also coordinated with something else. Either way, thanks for the help!
That script is complete so the variable doesn't have to coordinate with anything else. Obviously you have to be careful that other scripts aren't trying to use the variable at the same time.

fivehead

deck26 wrote:

fivehead wrote:

deck26 wrote:

fivehead wrote:

DanloVorje wrote:

The “delete () of (list v)” block can only take a number as an input (aka the position of the item you want to delete). In order to delete an item in a list containing a specific string, you'll need to use an iterative loop.

The basic structure would be something like this:
set [i v] to [1]
repeat until <<(item (i) of [list v]) = [thing you want to delete]> or <(i) > (length of [list v])> >
change [i v] by (1)
end
delete (i) of [list v]

Note that this would delete only the first instance of the thing you want to delete, not all instances of it.

Hope this helps!

–Danlo
Is “i” a certain variable I should be using, or is that just an example? Thanks for the help!
There is rarely (if ever) any need for a variable to have a particular name. You can call it ‘i’ or ‘index’ or ‘loop control’ or ‘this is a stupid name for a variable’.
I knew that, but I was just asking if I needed a variable also coordinated with something else. Either way, thanks for the help!
That script is complete so the variable doesn't have to coordinate with anything else. Obviously you have to be careful that other scripts aren't trying to use the variable at the same time.
Right, thank you!

GreenExplosion08

I'm making a Neko Atsume game and I need to be able to make it so you can delete your file and after a bunch of tries, that script really worked! Thanks! I wrote my script in a message(P.S. I named “i” as “Name”):
                                                                                          when I receive [delete file]
set [Name] to [1]
repeat until <(item (Name) of [Files] :: list) = (username)>
change [Name] by (1)
end
delete (Name) of [Files]
Deck26 wrote:
Fivehead wrote:
Deck26 wrote:
Fivehead wrote:
Danlo Vorje wrote:
The “delete () of (list v)” block can only take a number as an input (aka the position of the item you want to delete). In order to delete an item in a list containing a specific string, you'll need to use an iterative loop.

The basic structure would be something like this:
                                                                                          set [i] to [1]
repeat until <(item (i) of [list] :: list) = (thing you want to delete)>
change [i] by (1)
end
delete (i) of [list]
Note that this would delete only the first instance of the thing you want to delete, not all instances of it.

Hope this helps!

–Danlo
Is “i” a certain variable I should be using, or is that just an example? Thanks for the help!
There is rarely (if ever) any need for a variable to have a particular name. You can call it ‘i’ or ‘index’ or ‘loop control’ or ‘this is a stupid name for a variable’.
I knew that, but I was just asking if I needed a variable also coordinated with something else. Either way, thanks for the help!
That script is complete so the variable doesn't have to coordinate with anything else. Obviously you have to be careful that other scripts aren't trying to use the variable at the same time.

lx_monster

fivehead wrote:

I'm basically doing a rpg-ish game and a lot of choices will be text-based.

This is what I have as of now:

when this sprite clicked
ask [Item?] and wait
if <[items v] contains [ (answer)]> then
say [Success!] for (2) secs

end

Of course the success part is just for testing purposes. But what I'm trying to do is remove that item after it's used. Is there any way to do this? It seems like there would be because it's so simple, but you never know.

I've tried:

delete ((answer) v) of [Items  v]

I've tried using this as part of the previous script, but it did not appear to work.
?

Charles12310

lx_monster wrote:

fivehead wrote:

I'm basically doing a rpg-ish game and a lot of choices will be text-based.

This is what I have as of now:

when this sprite clicked
ask [Item?] and wait
if <[items v] contains [ (answer)]> then
say [Success!] for (2) secs

end

Of course the success part is just for testing purposes. But what I'm trying to do is remove that item after it's used. Is there any way to do this? It seems like there would be because it's so simple, but you never know.

I've tried:

delete ((answer) v) of [Items  v]

I've tried using this as part of the previous script, but it did not appear to work.
?
Please do not necropost. If you have more questions, please make a new topic.