Topic:   Arrays in Silver Creator   (Read 8675 times)


0 Members and 1 Guest are viewing this topic.

Johna100


  • GMG-er

  • **


  • Posts: 173

  • lalala
Arrays in Silver Creator
« on: February 03, 2013, 06:52:57 PM »
Im working on a game in Silver Creator that uses Arrays. I can't get the arrays to work. When I use a string array it says that string arrays are not supported. Also I was wondering how to use the data from the array once it is set. And I would like to know how to let a variable decide what piece of data is selected. And final if you have some example code of arrays being used properly that would be good. Thanks.

EDIT: Here is how I use arrays in SilverCreator v2.0b3.1

Code: [Select]
// ARRAY
DIM arrayOne(5)
DIM stringArray$(3)

// SET THE VALUE
LET arrayOne(1) = 7
LET stringArray$(1) = "Silver Creator Rocks"

// VIEW ARRAY VALUE
PRINT STR$(arrayOne(1))
PRINT stringArray$(1)
« Last Edit: August 16, 2020, 02:07:19 AM by Johna100 »

Gan


  • Administrator

  • ^ This guy is amazing.

  • *****


  • Posts: 4411
Re: Arrays in Silver Creator
« Reply #1 on: February 03, 2013, 07:42:49 PM »
I'm looking into it. It's been a while since I coded in Sc and the documentation could use some work.

Johna100


  • GMG-er

  • **


  • Posts: 173

  • lalala
Re: Arrays in Silver Creator
« Reply #2 on: February 03, 2013, 07:44:50 PM »
Thanks. Im using v1.6b3

EDIT: Im now using SilverCreator v2.0b3.1
« Last Edit: April 04, 2020, 08:41:10 PM by Johna100 »

Gan


  • Administrator

  • ^ This guy is amazing.

  • *****


  • Posts: 4411
Re: Arrays in Silver Creator
« Reply #3 on: February 03, 2013, 08:48:09 PM »
Ah! You must use the unofficial latest SilverCreator release. I've attached it to this post.

Here we go:
Code: [Select]
DIM myArray$(0)  //Create the array
//Now fill it with greatness
APPENDARRAY myArray$, "We're no strangers to love"
APPENDARRAY myArray$, "You know the rules and so do I"
APPENDARRAY myArray$, "A full commitment's what I'm thinking of"
APPENDARRAY myArray$, "You wouldn't get this from any other guy"
APPENDARRAY myArray$, " "
APPENDARRAY myArray$, "I just wanna tell you how I'm feeling"
APPENDARRAY myArray$, "Gotta make you understand"
APPENDARRAY myArray$, " "
APPENDARRAY myArray$, "Never gonna give you up"
APPENDARRAY myArray$, "Never gonna let you down"
APPENDARRAY myArray$, "Never gonna let you down, Never gonna run around and desert you"
APPENDARRAY myArray$, "Never gonna make you cry"
APPENDARRAY myArray$, "Never gonna say goodbye"
APPENDARRAY myArray$, "Never gonna tell a lie and hurt you"
//Now loop over what's in it
FOR i = 1 to COUNTARRAY(myArray$)
   //Print off the greatness
   PRINT STR$(i) + " " + myArray$(i)
NEXT

//Cheat sheet
// - DIM myArray$(0) // Creates a string array with 0 items
// - COUNTARRAY(myArray$) : Gets the length of the array
// - myArray$(i) : Gets the stuff out of the array as index i
// - APPENDARRAY myArray$, "Stuff" : Adds a string into the array
// - STR$(i) : Converts a number to a string
// Hint: $ at the end of the variable means it is a string variable

Hope that satisfied what you need! And welcome to the GMG!  ;D

Johna100


  • GMG-er

  • **


  • Posts: 173

  • lalala
Re: Arrays in Silver Creator
« Reply #4 on: February 03, 2013, 09:39:25 PM »
Thank you for your time and help.

Connors


  • ^ This guy is amazing.

  • ****


  • Posts: 2374

  • It's a secret to everyone...
Re: Arrays in Silver Creator
« Reply #5 on: February 04, 2013, 01:08:06 PM »
Good to see new members here, may I ask what you're trying to make?
Warning: The above post may have been modified multiple times.

"In a great game, the character must never perfectly obey the user's command"
 - Tim Rogers

http://connorspuzzles.tumblr.com/

Johna100


  • GMG-er

  • **


  • Posts: 173

  • lalala
Re: Arrays in Silver Creator
« Reply #6 on: February 04, 2013, 05:11:05 PM »
Im making a text based RPG and I needed arrays for the weapon equip system.

GMG Kurt


  • GMG-er

  • **


  • Posts: 682

  • Sorry for being such a noob
Re: Arrays in Silver Creator
« Reply #7 on: February 27, 2013, 10:06:51 PM »
Keep us updated. I've been so busy with school and debate that I haven't been able to program in forever. Looking at someone elses programming is the next best thing though  ;D
Just your average Weekend Warrior.
Yes I know I have bad spelling, it's what makes me such a good programmer!

"Old art, weather magnificent or wretched, is always the raw material of new art. The artist's job, though, is to

Johna100


  • GMG-er

  • **


  • Posts: 173

  • lalala
Re: Arrays in Silver Creator
« Reply #8 on: May 26, 2013, 03:56:43 PM »
I have a topic titled DungeonRealms game progress that I will use to post updates.
« Last Edit: May 26, 2013, 03:58:27 PM by Johna100 »

Connors


  • ^ This guy is amazing.

  • ****


  • Posts: 2374

  • It's a secret to everyone...
Re: Arrays in Silver Creator
« Reply #9 on: July 25, 2018, 10:09:28 AM »
Woah, nice necro. I've never seen someone pick out a support question from 5 years ago. I check this site sometimes but I didn't expect to see a new user!

 Weird, this thread was up when I was barely out of high school.
Warning: The above post may have been modified multiple times.

"In a great game, the character must never perfectly obey the user's command"
 - Tim Rogers

http://connorspuzzles.tumblr.com/

Gan


  • Administrator

  • ^ This guy is amazing.

  • *****


  • Posts: 4411
Re: Arrays in Silver Creator
« Reply #10 on: September 09, 2018, 10:24:35 AM »
That guy was a spammer. Saying he coded a weight watchers website in SilverCreator. Pretty clever deception.