Jump to content

Understanding Configs


TheWind

Recommended Posts

Hi, I haven't posted much on here, but I've been active in the chatbox from time to time. I have been attempting to make a script that completes three quests (Cook's Assistant, Doric's Quest, and Goblin Diplomacy) all automated. The main problems I've come across so far is the organization of all the code and determining when certain actions should occur. I've tried to take into account many possibilities when starting the script so evidently I have had to write many conditions.

 

I feel that understanding what configs are and how they can be used would be very beneficial for me to simplify a lot of these conditions. From what I've been able to ascertain they can be used to determine what stage of a quest you are on. The only information I could find related to configs in the api was the Configs api page itself: http://osbot.org/api/org/osbot/rs07/api/Configs.html

 

The only other thing I've been able to find relating to configs is the Configs option in OSBot: http://prntscr.com/dgokzc

 

How can I get the config values for a certain quest?

 

An example as to how they could be used would also be nice smile.png

Link to comment
Share on other sites

Building off of what TeamCape said. 

 

if(configs.get(quest val) == a given value) {

you're on this part of the quest

}

quest val  never changes. It is the same number for that quest. 

For example, Cook's assistant could be #5 so it will always be 5. 


a given value is the number that changes for each part of that specific quest. 

For example, if you are doing Cook's assistant, before you start it, it will == 0, but after you start it, it will == 1. 

So while doing a quest, you can do something like 

 


if(configs.get(5) == 0) {
//start quest
} else if(configs.get(5) == 1) {
//give NPC the items
} else if etc...

 

Link to comment
Share on other sites

 

Building off of what TeamCape said. 

 

if(configs.get(quest val) == a given value) {

you're on this part of the quest

}

quest val  never changes. It is the same number for that quest. 

For example, Cook's assistant could be #5 so it will always be 5. 

a given value is the number that changes for each part of that specific quest. 

For example, if you are doing Cook's assistant, before you start it, it will == 0, but after you start it, it will == 1. 

So while doing a quest, you can do something like 

 


if(configs.get(5) == 0) {
//start quest
} else if(configs.get(5) == 1) {
//give NPC the items
} else if etc...

Instead of doing

if(...){
    ...
}else if(...){
    ...
}

You should use:

switch(getConfigs().get(5)){
case 1:
     //do stuff
    break;
case 2:
    //do stuff
    break;
}

Just my two cents.

  • Like 2
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...