Welcome to the Builder Academy

Question Delete variable in looping script

More
23 Jun 2021 14:24 - 23 Jun 2021 14:26 #9882 by zi
Is there a way to set a variable in a script to null or empty? Not to 0, that's something. I'm talking a complete blank, as if the script was run for the first time.

My script only works correctly when it's run once, BUT if I have to bracket it with an next_in_list to parse all the items given by a player, one of my internal variables that I use grows exponentially!

I can't set the variable to 0 - it has to begin empty so I can then add ten very specific digits (based on the items given).

Is that possible?

Here's the snippit
Warning: Spoiler!

_,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,_
Making 3M Great Again!
telnet://3m.funcity.org:3000
_,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,_
Last edit: 23 Jun 2021 14:26 by zi.

Please Log in or Create an account to join the conversation.

More
24 Jun 2021 12:25 #9883 by zi
SOLVED

Unset

Usage: unset <variable>

* in this example we have a var %testvar% we no longer need:

set testvar hops happily along
global testvar
%echo% %self.name% %testvar%
unset testvar

Unset removes the variable from the global variables of this trigger, or if not
found there, from the trigger.

Example: TSTAT 70

_,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,_
Making 3M Great Again!
telnet://3m.funcity.org:3000
_,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,_
The following user(s) said Thank You: thomas

Please Log in or Create an account to join the conversation.

Time to create page: 0.172 seconds