Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script Help Remove key after 3x uses
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#10
RE: Remove key after 3x uses

I get you're trying to make it more digestable for not-so-advanced scripters, but calling it sublocal might be a bit misleading. (PS: I expect you to know what I'll say here Spelos, but I'll just explain it for anyone else who might be interested).

It's just the primitive version of the variable functions that FG made. Their scope is determined based on where they're initialized. So doing

PHP Code: (Select All)
string mySubVar "Whoa";

void OnStart()
{


Would give it a similar scope to a LocalVarString function. From here it can be accessed by any code blocks below it. If you place it within OnStart, like the example, it would only be accessible from within that block and its sub-blocks.

Personally I prefer using the primitive versions due to simplicity, but the function versions do have their pros. For one it doesn't matter where it's initialized. Another thing is that the variable name can be dynamically changed.

PHP Code: (Select All)
AddLocalVarInt("MyInt"+i1); 

Something like this wouldn't be possible with a simple
PHP Code: (Select All)
int myInt+myInt+1//Errors, obviously 

(This post was last modified: 05-08-2016, 10:34 PM by Mudbill.)
05-08-2016, 10:33 PM
Find


Messages In This Thread
Remove key after 3x uses - by serbusfish - 04-26-2016, 10:30 PM
RE: Remove key after 3x uses - by WALP - 04-27-2016, 01:51 AM
RE: Remove key after 3x uses - by Daemian - 04-27-2016, 06:39 AM
RE: Remove key after 3x uses - by Spelos - 04-27-2016, 08:48 AM
RE: Remove key after 3x uses - by serbusfish - 05-05-2016, 12:29 PM
RE: Remove key after 3x uses - by WALP - 05-05-2016, 12:49 PM
RE: Remove key after 3x uses - by Darkfire - 05-06-2016, 02:46 PM
RE: Remove key after 3x uses - by serbusfish - 05-08-2016, 11:28 AM
RE: Remove key after 3x uses - by Spelos - 05-08-2016, 07:55 PM
RE: Remove key after 3x uses - by Mudbill - 05-08-2016, 10:33 PM
RE: Remove key after 3x uses - by Darkfire - 05-09-2016, 04:31 PM



Users browsing this thread: 1 Guest(s)