Slot System Thing

So basically, I have three commands: /createblock1, /createblock2 and /createblock3
Whichever one I say first should display it’s text in the first slot,
second in the second slot and third in the third slot…

What it’s currently doing is it’s displaying everything in the first slot.
So if I type /createblock1, that gets put in the first
then if I type /createblock2, that replaces the first and puts itself there too,
and same for /createblock3…

I had booleans set up to keep track of the slots filled,
but it doesn’t look like it’s working for me.
Any suggestions? :ohdear:

[CODE]
// slots
setstring slot1,x;
setstring slot2,x;
setstring slot3,x;

slot1Filled = false;
slot2Filled = false;
slot3Filled = false;

// slot position
if(playerenters) {
showtext 677,20,20,Verdana,b,#s(slot1);
showtext 678,20,23,Verdana,b,#s(slot2);
showtext 679,20,26,Verdana,b,#s(slot3);
}
// first block
if(playerchats && strequals(#c,/createblock1)) {
if(slot1Filled == false) {
slot1Filled = true;
setstring slot1,Block1 Created.;
showtext 677,20,20,Verdana,b,#s(slot1); // again
}
if(slot1Filled == true && slot2Filled == false) {
slot2Filled = true;
setstring slot2,Block1 Created.;
showtext 677,20,20,Verdana,b,#s(slot2);
}
if(slot2Filled == true && slot3Filled == false) {
slot3Filled = true;
setstring slot3,Block1 Created.;
showtext 677,20,20,Verdana,b,#s(slot3);
}
}
// second block
if(playerchats && strequals(#c,/createblock2)) {
if(slot1Filled == false) {
slot1Filled = true;
setstring slot1,Block2 Created.;
showtext 677,20,20,Verdana,b,#s(slot1);
}
if(slot1Filled == true && slot2Filled == false) {
slot2Filled = true;
setstring slot2,Block2 Created.;
showtext 677,20,20,Verdana,b,#s(slot2);
}
if(slot2Filled == true && slot3Filled == false) {
slot3Filled = true;
setstring slot3,Block2 Created.;
showtext 677,20,20,Verdana,b,#s(slot3);
}
}
// third block
if(playerchats && strequals(#c,/createblock3)) {
if(slot1Filled == false) {
slot1Filled = true;
setstring slot1,Block3 Created.;
showtext 677,20,20,Verdana,b,#s(slot1);
}
if(slot1Filled == true && slot2Filled == false) {
slot2Filled = true;
setstring slot2,Block3 Created.;
showtext 677,20,20,Verdana,b,#s(slot2);
}
if(slot2Filled == true && slot3Filled == false) {
slot3Filled = true;
setstring slot3,Block3 Created.;
showtext 677,20,20,Verdana,b,#s(slot3);
}
}[/CODE]

As I said in my last post, I was thinking of using an array to keep track of the slots, but this seemed easier so I stuck with this.

0 is false. 1 is true.

If 0 is false, wouldn’t 0 work the same as false (giving the same output)?

How about you try it?

I did :slight_smile:

Did it work?

Nope, same output. :frowning:

I read your post this time. You have the same index, x, and y for each of the showtext.

wow, can’t believe I forgot about the showtext’s, thanks.

Now I’m stuck with another problem though. the conditional statements are all being processed at the same time, so I’m getting “Block 1 Created.” in every slot if I type /createblock1.

Edit: nvm I got it working using another set of bools.

Wish I could code. I just copy and paste like the real fuckass I am.

Only reason I know a bit a about GS1 is cuz of other languages. The commands.rtf doesn’t make much sense to beginners, it’s more of a reminder for those who
already know it. Honestly, short & simple examples of code used in game would have been a better idea (something like the script archive).
If you need help with anything or want to get started just pm/skype me.

Truth, it helps to learn a formal language, then apply such knowledge to GS1 to realise what it tries to achieve. Glad to see you’re making progress!

I started with gs1.

Very true, get on the relay man I have stuff to say.

I did too but it didn’t make much sense until I learned JS.

The relay?

GS1 isn’t coding

I highly recommend you learning C. It now could be considered a low-level programming language(altho back in the 80s-90s it was considered high-level), and most of the programming languages now are derivative from this language.

I’m not going deep in explanations, but just to show you what a monster of language it is, it was created in 1972, and it is still used today. Mac OS X Mavericks was written in C(with some help of C#, and C++).

http://www.naelshawwa.com/scripting-coding-programming/

code (kd)
n.

  1. A systematically arranged and comprehensive collection of laws.
  2. A systematic collection of regulations and rules of procedure or conduct: a traffic code.

a. A system of signals used to represent letters or numbers in transmitting messages.
b. A system of symbols, letters, or words given certain arbitrary meanings, used for transmitting messages requiring secrecy or brevity.
4. A system of symbols and rules used to represent instructions to a computer; a computer program.

cod·ing, codes
v.tr.

  1. To systematize and arrange (laws and regulations) into a code.
  2. To convert (a message, for example) into code.
    :shrug: :shrug:

You have no idea what you’re talking about.

What does that have to do with anything? What the fuck is “Mac OS X Mavericks?”