Not been as a witness, but several times as an expert witness in my field, both criminal and civil. As TP says, the court officials will explain all - it's not complicated.
You will have to swear on the Bible or the secular form is to 'Affirm' They ask you which you prefer and you read from a card.
Then all you have to do is do as you would in an exam - listen to the question, answer the question, and then shut up!
The lawyer for the prosecution goes first, to ask you to explain what you saw. Take a deep breath, take your time; witnesses of fact are extremely important, only you saw what happened. Everyone else relies on the witnesses so that they can understand the actual events at the time. You will then be cross-examined by the lawyer for the defence (assuming that the procedure in Scotland is the same as in England). All they are seeking to do is establish the facts of the case, for the judge and jury to make their decision as to the guilt of the accused.
Don't be fazed by a pause in questioning particularly when you are cross examined. The lawyer is thinking of his next question, if you start saying something after answering the question he asked, all you do is give him a clue as to what to ask next. So, stick rigidly to the question and say no more. Don't go off the point, don't try and be clever, and don't answer a question that wasn't asked.
Under cross-examination, the lawyer will try to undermine what you say you saw. All you have to do is stick to the facts and be calm and considered. The judge knows the game, and so do the lawyers. Regrettably, the witnesses feel the stress - but if you simply take your time and stick to simple answers, the court will appreciate your position and integrity.
Enjoy it. Not many people get the opportunity.