How to get icon of item?
I can get an icon name, but I don't know how to get image.
Regards!
How to get icon of item?
Discussion in 'Hurtworld Development' started by SilentHillft, Feb 22, 2016.
-
SpriteResourceLoader.Get(string spriteName)
-
Well, maybe I'm just stupid, but
Code:[Oxide] 16:24 [Error] Failed to call hook 'commandGetPos' on plugin 'xxx v0.1.0' (NullReferenceException: Object reference not set to an instance of an object) (Filename: /home/builduser/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 65)[Oxide] 16:24 [Debug] at SpriteResourceLoader.Get (System.String spriteName) [0x00000] in <filename unknown>:0 at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (object,object[],System.Exception&) at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0
Code:getInstance: function(variable) { return global.Singleton(variable).Instance; },
Code:[Oxide] 16:23 [Error] Failed to call hook 'commandGetPos' on plugin 'xxx v0.1.0' File: xxx.js Line: 1411 Column: 13 TypeError sprite is null: at Jint.Native.Function.ScriptFunctionInstance.Call (JsValue thisArg, Jint.Native.JsValue[] arguments) [0x00000] in <filename unknown>:0 at Oxide.Ext.JavaScript.Plugins.JavaScriptPlugin.OnCallHook (System.String hookname, System.Object[] args) [0x00000] in <filename unknown>:0 at Oxide.Core.Plugins.Plugin.CallHook (System.String hookname, System.Object[] args) [0x00000] in <filename unknown>:0
Code:commandGetPos: function(session, cmd, arg) { if(this.hasPermission(session, 'admintools.all')) { var sprite = this.getInstance(global.SpriteResourceLoader); var pos = this.getPlayerPosition(session); this.chat(implode(', ', pos), false, session); this.chat(sprite.Get('Items/Bolt Action Rifle'), false, session); this.chat(global.SpriteResourceLoader.Get('Items/Bolt Action Rifle'), false, session); } else { this.chat('Nie masz uprawnieĊ do tej komendy!', false, session); } },
-
Wulf Community Admin
What are you trying to do with the icon exactly? I don't think you can actually put the icon anywhere on the client from the server.
-
Actually I'm trying to get image as base64 or just png/jpg/jpeg. I want to send this to mysql (in case of base64) or to ftp. I need icons to create preview of inventory on website.
-
-
I want to do it by myself
-
Ah of course! SpriteResourceLoader doesn't exist on the server. You can still get the sprites though, pretty much by doing exactly the same thing SpriteResourceLoader does to get them.
-
Well, after little break I make Sprite Loader. But how can I convert it to base64 or just send it to FTP in JS?
-
Wulf Community Admin
-
-
This will be because the PNGs aren't set to read/write enabled, a Unity restriction.
-
-
How to get base64 icon via C# plugin?