Author Topic: Simple problem that i'll probally feel like an idiot about.  (Read 1341 times)

So, I've tried everything but I cant seem to get this damned script to work.  The result of this is probally going to be someone replying with a simple answer and me feeling like a total handicap, hahah.  Anyway, heres the code snip:

Quote
if((%obj.getDataBlock() $= "FridgeBrickData") || (%obj.getDataBlock() $= "GunRackBrickData"))
{
     switch(%brick.getDatablock().type)
     {
             case "food":
           %resourcetype = 2;
        case "gun":
           %resourcetype = 1;
     }

    
     %cost = 20;
     %foodstock = 11;

     %client.player.s_type = "food";
     %client.player.s_quantity = %foodstock;
     %client.player.s_cost = %cost;
     %client.player.s_origin = %brick;


}

Returns an error at ##%##brick.getDatablock().type and at ##%##client.player.s_type = "food".  And yes, I have "type" classified in the Datablock's code.  This code is also in a function that has %brick and %obj.

All the problems in other parts of this script, and somewhat in this code snip except for the text in red.  It returns an error at %client.##p##layer.s_type = "food";
Thanks for the help in advance.

« Last Edit: April 13, 2013, 12:27:14 PM by Vaux »

Replace switch with switch$ for strings

It still gave the same error; Ill check the code where I state "type" some more.

EDIT: I eliminated the middle man by changing "type" to 2 and 1 instead of food and gun.  Now, that switch isn't needed, but ##%##client.player.s_type = "food" is returning errors. ;_;
« Last Edit: April 13, 2013, 09:50:39 AM by Vaux »

Maybe you arem issing something somewhere else
Post full code

« Last Edit: April 13, 2013, 12:27:55 PM by Vaux »

== is for comparison, not assignment.

Did you put it inside a package? If you don't you'll overwrite the default OnActivate function.

== is for comparison, not assignment.
Derp.  Its those typos that always get me...

Did you put it inside a package? If you don't you'll overwrite the default OnActivate function.

And yes, it is in a package.