Cyber Syndicate
<center><p style='font-size:120%;'><strong>Welcome to Cyber Syndicate!<strong></p>

You are visiting as a guest; please <strong>register</strong> or <strong>log in</strong>.

Being logged in provides many benefits, including access to the useful <strong>Methods forum</strong>, posting permissions, and voting permissions.

<strong>Enjoy.</strong></center>
Cyber Syndicate
<center><p style='font-size:120%;'><strong>Welcome to Cyber Syndicate!<strong></p>

You are visiting as a guest; please <strong>register</strong> or <strong>log in</strong>.

Being logged in provides many benefits, including access to the useful <strong>Methods forum</strong>, posting permissions, and voting permissions.

<strong>Enjoy.</strong></center>
Cyber Syndicate
Would you like to react to this message? Create an account in a few clicks or log in to continue.



 
HomeLatest imagesRegisterLog in

 

 Need Suggestions: Script Organization.

Go down 
3 posters
AuthorMessage
Letalas
Member
Member



Posts : 5
Join date : 2011-02-25

Need Suggestions: Script Organization. Empty
PostSubject: Need Suggestions: Script Organization.   Need Suggestions: Script Organization. Icon_minitimeSat Feb 26, 2011 4:17 pm

The script is going to be a farming script, I've started with various functions doing parts but as I work through it I have to figure out a method of organization and would like suggestions. Through settings the user decides what they wish to do from what type of farming (trees,herbs,etc) to which locations (catherby,ardy,etc) to what to place in each plot (watermelon, ranarr, etc) and methods of transportation, creating tons of options for the user to work with.

The question becomes how to organize all of this information, creating a reliable loop with fail safes. The main method of knowing where to go is systems of timers, then if no timers are up then theres options on what to do (check the plots, log out, or eventually other ideas)

So that becomes the question; how to organize it all effectively since theres seed ids, tons of different ids for everything.

A lot of the information can be broken down into three basic categories: Location / Seeds / Patches I think
Seeds would contain ids, timer information, strings, etc.
Location would hold information on plots, how to get there, etc
Patches would hold the unique timer to that patch with the seed information and location information?

As you can see my minds a mess on how would be best to organize it, any suggestions before trial and error through ideas leads to a smooth method to do it all?
Back to top Go down
b0xb0x
Administrator
Administrator



Posts : 130
Join date : 2011-02-25
Age : 28
Location : California

Need Suggestions: Script Organization. Empty
PostSubject: Re: Need Suggestions: Script Organization.   Need Suggestions: Script Organization. Icon_minitimeSat Feb 26, 2011 4:28 pm

My recommendation is to create a JComboBox for each 3+ option in your GUI. Then from your JComboBox, do the following within your startActionPerformed (or whatever you have it called; just the start button's action):
NOTE: this assumes your JComboBox's name is jComboBox1 and your start button's actionListener is startActionPerformed. Change it accordingly.
Code:
private void startActionPerformed(java.awt.event.ActionEvent evt) {
   String ss = jComboBox1.getSelectedItem().toString();
   if (ss.equals("choice1")) {
      locArea = something1;
      locPath = somethingElse1;
      itemID = somethingElseElse1;
      item2ID = somethingElseElseElse1;
      objID = someOtherThing1;
      strAction = anotherSomething1;
   } else if (ss.equals("choice2")) {
      locArea = something2;
      locPath = somethingElse2;
      itemID = somethingElseElse2;
      item2ID = somethingElseElseElse2;
      objID = someOtherThing2;
      strAction = anotherSomething2;
   } else if (ss.equals("choice2")) {
      locArea = something3;
      locPath = somethingElse3;
      itemID = somethingElseElse3;
      item2ID = somethingElseElseElse3;
      objID = someOtherThing3;
      strAction = anotherSomething3;
   } //...and so on
}
Using this, you can have a small amount of IDs instead of using enums. In your variable declaration, you must declare each 'something' as its own value, whether it be a String, and int, a boolean; any object. The locArea, locPath (or whatever you want to call them) should be declared in your variable declaration but not given any value, as the above method will assign them their values accordingly.
Back to top Go down
https://cybersyndicate.forumotion.com
TaffTech
Administrator
Administrator



Posts : 72
Join date : 2011-02-27

Need Suggestions: Script Organization. Empty
PostSubject: Re: Need Suggestions: Script Organization.   Need Suggestions: Script Organization. Icon_minitimeMon Feb 28, 2011 9:04 pm

I prefer using case statements and the combo boxes indexes, but what b0xb0x said should answer your question
Back to top Go down
b0xb0x
Administrator
Administrator



Posts : 130
Join date : 2011-02-25
Age : 28
Location : California

Need Suggestions: Script Organization. Empty
PostSubject: Re: Need Suggestions: Script Organization.   Need Suggestions: Script Organization. Icon_minitimeMon Feb 28, 2011 9:19 pm

TaffTech wrote:
I prefer using case statements and the combo boxes indexes, but what b0xb0x said should answer your question

I use cases if it isn't an ID or solid value but I didn't think he'd need it Very Happy
Back to top Go down
https://cybersyndicate.forumotion.com
Sponsored content





Need Suggestions: Script Organization. Empty
PostSubject: Re: Need Suggestions: Script Organization.   Need Suggestions: Script Organization. Icon_minitime

Back to top Go down
 
Need Suggestions: Script Organization.
Back to top 
Page 1 of 1
 Similar topics
-
» Script skeleton
» Paint for my UniCash script
» Script Trial Runs

Permissions in this forum:You cannot reply to topics in this forum
Cyber Syndicate :: Development :: Scripting Help-
Jump to: