- Home /
My backpack script doubt
I made this simple backpack script, but as you can see I think I used too the statement "if", is another way to make with another statement like "for"? I'm not very good at programming ...
#pragma strict
//Slot 1 var slot1 : String; var slot1cfg : float; var slot1cfg2 : float;
//Slot 2 var slot2 : String; var slot2cfg : float; var slot2cfg2 : float;
//Slot 3 var slot3 : String; var slot3cfg : float; var slot3cfg2 : float;
function Update(){
//Slot 1 if(!slot1){
slot1 = slot2; slot1cfg = slot2cfg;
slot2 =""; slot2cfg =0; slot2cfg2 =0;
}
//Slot 2 if(!slot2){
slot2 = slot3; slot2cfg = slot3cfg;
slot3 =""; slot3cfg =0; slot3cfg2 =0;
}
}
function Put(Name : String, cfg : float, cfg2 : float){
if(!slot1){
slot1 = Name; slot1cfg = cfg; slot1cfg2 = cfg2;
} else if(!slot2){
slot2 = Name; slot2cfg = cfg; slot2cfg2 = cfg2;
} else if(!slot3){
slot3 = Name; slot3cfg = cfg; slot3cfg2 = cfg2;
}
}
Um... Can you format your script, I have NO idea of what you are doing or even trying to do.
EDIT: You can do that by pressing the binary code button when editing your post.
Your answer
Follow this Question
Related Questions
How to finish my else if statement? 2 Answers
some scripting help 2 Answers
if moving statement 1 Answer
my character damage script wont work 1 Answer
Disabling a GameObject via keyboard 2 Answers