Blockland Forums > Modification Help
Swapping Inventories Problem
<< < (3/3)
Port:

--- Quote from: elm on June 06, 2012, 05:32:28 AM ---torque script doesn't "really" use arrays

--- End quote ---

It doesn't use anything related to arrays in any way.

%val[%something] = "hello";

is syntaxical sugar for

eval("%val" @ %something @ " = \"hello\";");
Space Guy:
The official documentation call this syntax "arrays". It's usable as an array therefore it's helpful to call it one in this case.
Treynolds416:
You can call it a pseudoarray if it really bothers you that much
M:

--- Quote from: Port on June 06, 2012, 05:36:57 AM ---It doesn't use anything related to arrays in any way.

%val[%something] = "hello";

is syntaxical sugar for

eval("%val" @ %something @ " = \"hello\";");

--- End quote ---
If we're gonna play the "be a stuffty nitpicking bastard" game, you meant "syntactical".

Yeah, look at how much it contributes to the discussion.
The Russian:

--- Quote from: elm on June 06, 2012, 01:24:36 AM ---You just forgot a % on the fourth line from the while loop inside of the array.

--- End quote ---
Oh lol. I was swapping around variables and haven't executed it since.

--- Quote from: Port on June 06, 2012, 05:36:57 AM ---It doesn't use anything related to arrays in any way.

%val[%something] = "hello";

is syntaxical sugar for

eval("%val" @ %something @ " = \"hello\";");

--- End quote ---
I bet you're the kind of person who corrects someone when they say space is a vacuum.

--- Quote from: Treynolds416 on June 06, 2012, 06:23:00 AM ---You can call it a pseudoarray if it really bothers you that much

--- End quote ---
It has a nice ring to it.

--- Quote from: Space Guy on June 06, 2012, 05:29:18 AM ---The square brackets - that's how arrays work in most languages...

The lines at the end %client.player.BDtool = ""; will not clear any of the arrays. It would be better to store the BDtool, naToolCount, etc. as local variables which are cleared at the end of function scope automatically.

msgItemPickup requires that you use the ID of an item (nameToID(%item) / %item.getID()) which might be why they aren't working correctly.

--- End quote ---
Yeah I decided to do that after looking over elm's code. Also, I'm pretty sure the tool field stores the ID because I've changed tools in my own inventory in console before using that. I'll still try that though, just in case.

Thanks for the help guys. Except you Port.
Navigation
Message Index
Previous page

Go to full version