TylerH Posted December 1, 2009 Share Posted December 1, 2009 I have been trying to setup a simple hitinfo system via SendMessage and ReceiveMessage. I am sending the message fine, and receiving it fine, but when it comes time to use the "extra", I run into issues. From my understanding, SendMessage syntax in lua is: SendMessage(string message, entity sender, int delay, value extra) I have tried that, passing "damage", an entity, 0, and an integer (5). I also tried swapping delay and extra, and still have no luck. ReceiveMessage on the prop always picks up extra as nil. What am I doing wrong? Quote nVidia 530M Intel Core i7 - 2.3Ghz 8GB DDR3 RAM Windows 7 Ultimate (64x)----- Visual Studio 2010 Ultimate Google Chrome Creative Suite 5 FL Studio 10 Office 15 ----- Expert Professional Expert BMX Programmer ----- Link to comment Share on other sites More sharing options...
Josh Posted December 1, 2009 Share Posted December 1, 2009 entity:SendMessage( message, delay, extra ) Extra can be the sender, or something else since not all messages will have a "sender" entity. I just looked over the docs, and it looks like they are all correct. If you find any discrepancies let me know. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
TylerH Posted December 1, 2009 Author Share Posted December 1, 2009 That can't possibly be right: if KeyHit(KEY_E)==1 then pick=CameraPick(camera,Vec3(GraphicsWidth()/2,GraphicsHeight()/2,2.0),0,0) if pick~=nil then repeat if pick.entity:GetClass()==ENTITY_MODEL then break end pick.entity=pick.entity.parent until pick.entity==nil if pick.entity~=nil then pick.entity:SendMessage("use",controller,0) end end end pick.entity:SendMessage("use",controller,0) You are clearly passing message,entity (Extra?), and 0 (delay?) I have tried passing message,table,integer message,integer,table message,integer,integer None of the combos work. THe message goes through, but on ReceiveMessage extra is always nil, can't be made a number, or something else with it has messed up. Quote nVidia 530M Intel Core i7 - 2.3Ghz 8GB DDR3 RAM Windows 7 Ultimate (64x)----- Visual Studio 2010 Ultimate Google Chrome Creative Suite 5 FL Studio 10 Office 15 ----- Expert Professional Expert BMX Programmer ----- Link to comment Share on other sites More sharing options...
Josh Posted December 1, 2009 Share Posted December 1, 2009 Extra is a BlitzMax object, which includes strings. It cannot be an integer (unless it is converted to a string) or a Lua table. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
TylerH Posted December 1, 2009 Author Share Posted December 1, 2009 That doesn't explain why your second parameter is an entity and the third a 0. And man, I wish it could support integers and Lua tables, that would make scripting actually useful! I never heard of not being able to pass an integer... Quote nVidia 530M Intel Core i7 - 2.3Ghz 8GB DDR3 RAM Windows 7 Ultimate (64x)----- Visual Studio 2010 Ultimate Google Chrome Creative Suite 5 FL Studio 10 Office 15 ----- Expert Professional Expert BMX Programmer ----- Link to comment Share on other sites More sharing options...
TylerH Posted December 1, 2009 Author Share Posted December 1, 2009 All is swell, I just pass integers as strings and pick them out as integers. Quote nVidia 530M Intel Core i7 - 2.3Ghz 8GB DDR3 RAM Windows 7 Ultimate (64x)----- Visual Studio 2010 Ultimate Google Chrome Creative Suite 5 FL Studio 10 Office 15 ----- Expert Professional Expert BMX Programmer ----- Link to comment Share on other sites More sharing options...
TylerH Posted December 1, 2009 Author Share Posted December 1, 2009 Ok, this is definitely the order: message,delay (I pass "0", since an integer crashes), and then extra (I pass bullet.damage as a string) This is sweet, I setup the props_locker file to receive damage messages and set its health. I tested it and the damage falloff works! Now just to figure out why entity.model:SetColorf(...) in the ReceiveMessage callbacks isn't setting the color... Quote nVidia 530M Intel Core i7 - 2.3Ghz 8GB DDR3 RAM Windows 7 Ultimate (64x)----- Visual Studio 2010 Ultimate Google Chrome Creative Suite 5 FL Studio 10 Office 15 ----- Expert Professional Expert BMX Programmer ----- Link to comment Share on other sites More sharing options...
TylerH Posted December 1, 2009 Author Share Posted December 1, 2009 Check out the gallery, I added a screenshot of the new ability to shoot the doors off of the lockers (Lockers have health, joint is freed if lower than 75) Quote nVidia 530M Intel Core i7 - 2.3Ghz 8GB DDR3 RAM Windows 7 Ultimate (64x)----- Visual Studio 2010 Ultimate Google Chrome Creative Suite 5 FL Studio 10 Office 15 ----- Expert Professional Expert BMX Programmer ----- Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.