#Script unable to detect object that exists

4237 messages · Page 5 of 5 (latest)

ionic mica
#

or remove a new value

#

THE ONES YOURE GETTING

fossil osprey
#

WHY WOULD I EVER DO THAT

#

.

#

.

ionic mica
#

WHY WOULD YOU NEVER DO THAT?

#

WHAT IF YOU EDFIT

#

WHAT IF YOU EDIT YOUR STATS

#

ADD ANOTHER ONE

fossil osprey
#

if i have to add a new one i need to edit the function anyway?!?

ionic mica
#

OR WHATEVER

fossil osprey
#

THEN I NEED TO EDIT IT ANYWAY

#

WHAT

#

okay

#

with a for loop tell me how the HELL i can combine finesse and strength and weaponstats to equal your melee hitrate

ionic mica
#

a simpler example

#

say you have

fossil osprey
#

with a for loop

#

or a repeat loop

#

tell me

#

and then explain how thats better than finesse.allcth+strength.allcth+mainhand.cth

#

i still need to add/multiple them

#

is
finesse = forido through datatable to find it
somehow better?

#

because to me thats MORE computing the script needs to do

#

instead of just giving it the direct table path

ionic mica
fossil osprey
#

like, usually what you say makes some sense

ionic mica
#

at the start of the module

fossil osprey
#

this time it makes

ionic mica
#

that way you dont have to do it every time its called

fossil osprey
#

NO sense

ionic mica
#

IT DOES

#

hold on

#

if Lake comes he'll be able to explain it better than i can

fossil osprey
#

if it isnt part of the function it wont use the current data

ionic mica
fossil osprey
#

... yes i do though?

ionic mica
#

No

#

you can get it

fossil osprey
#

unless you mean

ionic mica
#

outside of the function

#

and use them inside

fossil osprey
#
local a
function a()
a=1
end```
#

which, fine sure

#

still doesnt explain the forido or repeat loop you're suggesting

ionic mica
#

you iterate through the folders

#

and get all the values

#

then set them as needed

#

access their desired values via their names

fossil osprey
#

what

#

oh

#

no, this is a table

#

not instances

#

the itemdatabase i have a modulescript that grabs the item from it's filepath/itemid and returns it

ionic mica
#

ok stop

#

you have a module

#

to "concatenate my table"

fossil osprey
#

different module

ionic mica
#

thishtrihsithis

#

DataConcatenator

fossil osprey
#

yes

ionic mica
#

why do you need this

#

what are you doing

#

what does it do

#

ok lets simplify this for you

#

you need to access all those values right

fossil osprey
#

it grabs a combination of equipped items and your stats table to generate your character's statistics

#

yes

#

so i need access to them all

ionic mica
#

ok good

fossil osprey
#

thats why they're all referenced as variables

#

because i need them all

ionic mica
#

ok stop

fossil osprey
#

more than once

ionic mica
#

they all have a common "Parent"

#

which is corestats

#

right

fossil osprey
#

no

ionic mica
#

yes

#

i can see it

#

there

fossil osprey
#

NO

ionic mica
#

YES

fossil osprey
#

NO

#

charstats

ionic mica
fossil osprey
#

corestats is just your "stats"

ionic mica
#

corestats

#

corestats

#

corestats

#

corestast

#

all the way

fossil osprey
#

oh i typed those wrong

fossil osprey
#

there

#

thanks for catching that

ionic mica
#

great

#

common "parent"

#

is charstats

fossil osprey
#

charstats

ionic mica
#

lets start wiuth that

#

define charStats as a variable

#

and replace data.charstats with that

fossil osprey
#

why?

ionic mica
#

trust the process, we'll get somehwere

ionic mica
#

more efficient

#

and code looks cleaner

fossil osprey
#

other than "looks cleaner"

ionic mica
ionic mica
fossil osprey
#

is there a legitimate actual reason that makes sense

#

processing wise

#

does it then just check only charstats?

ionic mica
fossil osprey
#

okay

#

done

#

then do the same for each other group i assume or no?

ionic mica
#

its a start

#

it'll show you how we can loop it later

fossil osprey
#

i still fail to see why looping it even makes remote sense

ionic mica
#

You

#

will see

fossil osprey
#

:/

gentle arch
fossil osprey
#

?

#

this script doesnt check anything

gentle arch
#

less memory

#

aight bye

fossil osprey
#

more effort and processing required:

#

whatever

fossil osprey
#

you wont like it though

#

hm

gentle arch
#

u dont wanna repeat the same thing over and over again

fossil osprey
# ionic mica will see

what if i stored the incoming data in a table? then just data[index] instead of a bunch of local variables?

#

anyway

#
datastats = data.charstats
        core = core
            strength = core.strength_Stat
            agility = core.agility_Stat
            endurance = core.endurance_Stat
            intelligence = core.intelligence_Stat
            wisdom = core.wisdom_Stat
            presence = core.presence_Stat
            finesse = core.finesse_Stat
        level = datastats.levels
            primarycls = level.primaryClass.Cls
            primarylvl = level.primaryClass.Lvl
            secondcls = level.secondClass.Cls
            secondlvl = level.secondClass.Lvl
            combocls = level.comboClass.Cls
            combolvl = level.comboClass.Lvl
        skill = datastats.skills
            tankrole = skill.roles.tank.Lvl
            atkrrole = skill.roles.atkr.Lvl
            healrole = skill.roles.heal.Lvl
            onehandlvl = skill.weaponSkills.oneHand.Lvl
            twohandlvl = skill.weaponSkills.twoHand.Lvl
            throwlvl = skill.weaponSkills.throw.Lvl
            rangedlvl = skill.weaponSkills.ranged.Lvl
            hiddenlvl = skill.weaponSkills.hidden.Lvl
            magiclvl = skill.weaponSkills.magic.Lvl
            shieldlvl = skill.weaponSkills.shield.Lvl
        gear = datastats.equipped
            head = gear.head
            if head.itemTier ~= -1 then
                headID = DatabaseSearch.itemSearch(head.itemID)
            end
            body = gear.body
            if body.itemTier ~= -1 then
                bodyID = DatabaseSearch.itemSearch(body.itemID)
            end
            hand = gear.hand
            if hand.itemTier ~= -1 then
                handID = DatabaseSearch.itemSearch(hand.itemID)
            end
            foot = gear.foot
            if foot.itemTier ~= -1 then
                footID = DatabaseSearch.itemSearch(foot.itemID)
            end
            neck = gear.neck
            if neck.itemTier ~= -1 then
                neckID = DatabaseSearch.itemSearch(neck.itemID)
            end
            ring1 = gear.ring1
            if ring1.itemTier ~= -1 then
                ring1ID = DatabaseSearch.itemSearch(ring1.itemID)
            end
            ring2 = gear.ring2
            if ring2.itemTier ~= -1 then
                ring2ID = DatabaseSearch.itemSearch(ring2.itemID)
            end
            mainhand = gear.mainhand
            if mainhand.itemTier ~= -1 then
                mainhandID = DatabaseSearch.itemSearch(mainhand.itemID)
            end
            offhand = gear.offhand
            if offhand.itemTier ~= -1 then
                offhandID = DatabaseSearch.itemSearch(offhand.itemID)
            end```
ionic mica
#

WAHT

#

the hell isnthis

fossil osprey
#

theyre indented by their parent file

ionic mica
#

what am i watching

#

what is thnis

#

horror

#

of

#

scripting

fossil osprey
#

i fail to see why there is any "horror" or anything bad really

#

its all the needed variables

#

defined

#

and sorted by where they come from

gentle arch
#

woah -1

#

whats that

fossil osprey
#

because i use 0 in some instances

gentle arch
#

so u check if it exists

#

doesn't roblox do that already

fossil osprey
#

?

#

no i check if the slot is empty

#

if it has -1 then its empty

#

otherwise it has an item in it

gentle arch
#

but u said ~= isnt that 'not equal to'

fossil osprey
#

yes

#

so

#

if NOT empty

#

query the database for its file on the item in that slot

ionic mica
#

understand

#

that you

#

having to even do this

#

means that your system is inherently flawed

#

you NEED to do this?

#

you cant loop through them and check?

fossil osprey
#

tell me how you would loop it

ionic mica
#

gear is a dictionary right

fossil osprey
#

yes, i can make each variable an index in an array

#

and set them like that

#

okay

#

now tell me why that even makes sense to bother doing when this works as is perfectly fine

#

to have that loop i then need an array for each thing to set them to

#

thats

#

MORE effort

#

than just setting them manually

#

although i will make the locals into an array

#

that DOES make sense

#

or a dictionary rather

ionic mica
fossil osprey
#

what is "gears"

ionic mica
#

your gear table

#

i renamed it to gears

#

there edited

#

typo

fossil osprey
#

what is [key.."ID]

#

what is ids

#

like, i can see why this MIGHT be MAYBE useful

ionic mica
#

key is the name

fossil osprey
#

but also why its completely unnessessary

ionic mica
#

aka hand

#

or neck

gentle arch
#

arguing with an s2

fossil osprey
#

there is a MASSIVE difference between "useful" and "clean"

ionic mica
fossil osprey
#

this may be "clean"

#

but its usefulness

ionic mica
#

IT IS VERY USEFUL

fossil osprey
#

is nil

ionic mica
#

if you change your gear table

#

add a ring

#

or remove it

fossil osprey
#

okay

ionic mica
#

then this adapts to it

fossil osprey
#

THEN I NEED TO EDIT THE FUNCTION ANYWAY

ionic mica
#
  • it makes your code shorter and cleaner
#

WIN WIN

ionic mica
#

you

#

make it

#

adaptable

#

so you DONT have to edit it

gentle arch
#

what happened to NTTS

ionic mica
#

IM

#

GONANM

#

IKILL SOMEONE

#

RN