fido77
New Member
Posts: 9
Posts: 9
|
Post by fido77 on Jul 15, 2014 6:53:36 GMT
I got this Plugin yesterday and it's working great for our game so far 
I am having some issues with the world variables in java though. It may just be that it is very late here and I probably need to take a break and think about it for a day, but I thought I would throw this out there anyway so this could be my first post. It should be a pretty simple one.
How do I get the value of a world variable using Java? I have the Script folder in the Plugins folder. That seems to be working, but I am still not able got get the value of "Score". That is just the one I am using right now for testing. Will create a few after I get that working. I am only simply adding 1 to Score when a wave is complete. Then I want to add 22(random number that easily identified if it works) to my playerScore variable. I know I should be able to do this very easily and tried using the: var variable = WorldVariableTracker.GetWorldVariable("yourVarName");
modified for Java of course, but apparently I do not know how to modify that line for Java, and I haven't even had any drinks tonight.
|
|
|
Post by DarkTonic Dev on Jul 15, 2014 7:11:24 GMT
Unfortunately I don't know JavaScript (actually it's UnityScript, I know the real Javascript), so I don't think I'm able to help on this one. Maybe go post on the Unity Scripting forum here? forum.unity3d.com/forums/scripting.12/Maybe a drink would actually help  It's possible.
|
|
fido77
New Member
Posts: 9
Posts: 9
|
Post by fido77 on Jul 15, 2014 12:25:23 GMT
I will try again tonight. I will have drinks tonight 
|
|
|
Post by DarkTonic Dev on Jul 15, 2014 16:11:22 GMT
Good luck 
|
|
fido77
New Member
Posts: 9
Posts: 9
|
Post by fido77 on Jul 16, 2014 5:04:51 GMT
No luck so far. I either get the ol' UCE0001 stating there is a ';' missing, or some other error. Here is what I am working with at the moment if anyone would like to help out.
#pragma strict
var scoreText : UILabel; static var playerTestScore = 0; var variable:WorldVariableTracker.GetWorldVariable("Score");
function Start () {
}
function Update () { scoreText.text = ""+playerTestScore; if(variable.CurrentIntValue == 1) { playerTestScore = playerTestScore + 22; } }
|
|
fido77
New Member
Posts: 9
Posts: 9
|
Post by fido77 on Jul 16, 2014 5:06:25 GMT
I wish that would have kept the same spaces. It would have been much easier to read. Maybe I am just not seeing what is missing.
|
|
|
Post by DarkTonic Dev on Jul 16, 2014 6:18:44 GMT
No luck so far. I either get the ol' UCE0001 stating there is a ';' missing, or some other error. Here is what I am working with at the moment if anyone would like to help out. #pragma strict var scoreText : UILabel; static var playerTestScore = 0; var variable:WorldVariableTracker.GetWorldVariable("Score"); function Start () { } function Update () { scoreText.text = ""+playerTestScore; if(variable.CurrentIntValue == 1) { playerTestScore = playerTestScore + 22; } } Ok, the declaration of "variable" should have an equal sign, not a colon. Like this: var variable = WorldVariableTracker.GetWorldVariable("Score");
|
|
fido77
New Member
Posts: 9
Posts: 9
|
Post by fido77 on Jul 16, 2014 13:26:40 GMT
That doesn't work in java/unity script. At least it wasn't working for me. But, after a few drinks, and this is kinda funny. I realized the scripts that I need this the most in are in c#. So, I got it working. Would be nice to figure out how to get it working with the Java scripts though just in case I think of a reason for it. Most of my scripts are in Java. Next game will be using all c#. Did not realize I would have this many issues using Java when I started. If someone does know how to do that with java, like Juicybooty, could you please post an example in here? Really enjoying this plugin. It's like unlocking god mode for development 
|
|
|
Post by DarkTonic Dev on Jul 16, 2014 16:03:41 GMT
That line compiled for me in JavaScript, I tried it before pasting it here.
|
|
fido77
New Member
Posts: 9
Posts: 9
|
Post by fido77 on Jul 17, 2014 4:01:26 GMT
You're right! I was dong it all wrong. I was trying to declare a variable outside of a function  Now I got it all working 
|
|
|
Post by DarkTonic Dev on Jul 17, 2014 4:07:11 GMT
Aha, cool!
|
|