Jump to content




[MC 1.2.5] - [CC 1.33] ccSensors [SMP/SSP]

peripheral java lua

  • This topic is locked This topic is locked
454 replies to this topic

#101 yoskaz01

    Featured on Reddit!

  • New Members
  • 92 posts

Posted 12 April 2012 - 07:18 AM

regarding the EU Storage & targetting issue
i think i know where the problem is,

to simplify things i'm working on improving the lua API .. (might rel those improvments soon before the actual build 014 update)
as part of the improvments i thought about the following changes:

First , a couple of naming changes to make things clearer - instead of "reading type", i'll use "probe" , so each sensor can have 1 or more probes. (example for Probe is "EU Storage" probe. (Hierarchy: Sensor --> Probe --> Reading Example: "myReactor"-->"Reactor"-->"heat" )



from the new lua API:
--[[
input:
 side	  - controller attached side ( can be retrieved using sensors.getController())
 sensor  - name of the remote sensor ( the name that was set on the sensor GUI, Default: "Sensor")
 probe   - the probe name (eg. "EUStorage", "Reactor", etc..)
output:
 a table containing all available targets in range that applicable to the specific sensor type & probe
		
]]--
getAvailableTargets(side,sensor,probe)


i'm thinking of adding a 4th parameter - Range - which can be between 1 and maxRange for this sensor. (max range would probably be <= 10 to prevent misuse)

#102 xuma202

  • Members
  • 288 posts
  • LocationBonn Germany

Posted 12 April 2012 - 02:40 PM

The recipe for the IC2 SensorModule is not working. Have you maybe posted the wrong recipe?

EDIT:

Oh I've just found out the recipe is

I G I
G S G
I G I

G => Glass
I => Iron Ingot
S => Blank Sensor Module

you may wanna fix that :P/>

#103 theubie

  • New Members
  • 9 posts

Posted 12 April 2012 - 03:36 PM

That sounds good, yoskaz! Thanks!

For the record I played with it a little more...

If I place the sensors well apart...say 64 blocks apart they function normally.

#104 yoskaz01

    Featured on Reddit!

  • New Members
  • 92 posts

Posted 12 April 2012 - 04:48 PM

i updated the lua programs + api (still not the final version though)

check out this:
program : /ccSensors/dash_reactor.lua

i also added test2.lua <-- will show you the eustorage targets.

Spoiler


#105 reinei

  • Members
  • 6 posts

Posted 12 April 2012 - 04:54 PM

Can you please use a variable to determin the Block ID Im having conflicts with outher mods (I know: Do not ask: Make your mod compatible with X)) it would be helpfull.
thanks (if you do it if not: its OK)

#106 theubie

  • New Members
  • 9 posts

Posted 12 April 2012 - 05:13 PM

Oh my! That looks awesome.

#107 SimpleMajority

  • Members
  • 26 posts

Posted 13 April 2012 - 06:00 AM

this is pure epic and I cannot wait for it to go SMP. This will save my world's landscape from craters!

#108 yoskaz01

    Featured on Reddit!

  • New Members
  • 92 posts

Posted 13 April 2012 - 12:18 PM

 reinei, on 12 April 2012 - 04:54 PM, said:

Can you please use a variable to determin the Block ID Im having conflicts with outher mods (I know: Do not ask: Make your mod compatible with X)) it would be helpfull.
thanks (if you do it if not: its OK)

Hey,

you can change the block id in the configuration file.

.minecraft/config/ccSensors.config

there is only 1 block id:
ComputerSensorBlock.id=182


#109 FuzzyPurp

    Part-Time Ninja

  • Members
  • 510 posts
  • LocationHarlem, NY

Posted 13 April 2012 - 04:10 PM

Seems Target it borked, cant target anything and console program target is the same. TC2 sensors dont work at all, and in the console program the readings for TC2 dont scroll down with the default gui size.

#110 theubie

  • New Members
  • 9 posts

Posted 13 April 2012 - 09:07 PM

Odd. With the new API I'm have 0 problems. :/

Finally got my base controller working correctly to monitor and operate my reactor compared to my energy storage levels.

#111 yoskaz01

    Featured on Reddit!

  • New Members
  • 92 posts

Posted 13 April 2012 - 11:01 PM

 FuzzyPurp, on 13 April 2012 - 04:10 PM, said:

Seems Target it borked, cant target anything and console program target is the same. TC2 sensors dont work at all, and in the console program the readings for TC2 dont scroll down with the default gui size.

Fuzzy,
did you update to the latest build 014pre ?
console program will probably not correctly for everything - working on a new version to use the new lua API and hopefully get rid of all annoyances - like inaccurate targetting or improper displaying of data.

#112 FuzzyPurp

    Part-Time Ninja

  • Members
  • 510 posts
  • LocationHarlem, NY

Posted 14 April 2012 - 12:02 AM

yea i even downloaded like 10x to make sure even in lua setActiveTarget etc returns nothing
getAvailableTargets does nothing

#113 yoskaz01

    Featured on Reddit!

  • New Members
  • 92 posts

Posted 14 April 2012 - 12:46 AM

try this piece of code:

this returns available targets by probe for a given sensor
this lua program accepts 1 parameter: the sensor name
local arg = {...};
local sensor="Sensor";
local probe= "";

local side = sensors.getController()

--and  "targets" == string.lower(arg[1])
if #arg >0  then
    sensor = arg[1];
end

local data = sensors.getSensorInfo(side,sensor,"probes")
if data.probes ==nil then
    print ("Can't find probes for sensor:"..sensor);
else

    for p in string.gmatch(data.probes,"%a+") do
        
        if p =="TargetInfo" then
        else
            
            local targets = sensors.getAvailableTargetsforProbe(side,sensor,p);
            if #targets>0 then
                print ("Probe:"..p.. " Available Targets:"..#targets);
                for i,v in ipairs(targets) do
                    local tgInfo = sensors.getSensorReadingAsDict(side,sensor,v,"TargetInfo")
                    print ("type:"..tgInfo.type);
                    print (v)
                end
    --        else
        --        print ("None in range");
            end
        end
    end
end


 


#114 FuzzyPurp

    Part-Time Ninja

  • Members
  • 510 posts
  • LocationHarlem, NY

Posted 14 April 2012 - 12:54 AM

Also the ui on the sensors seem to no longer work.


general {
advancedUI=true
autoAssign=false
card.SensorModule.APS=8
card.SensorModule.BC=3
card.SensorModule.EE=7
card.SensorModule.Forestry=5
card.SensorModule.IC2=4
card.SensorModule.INV=2
card.SensorModule.RP2=6
card.SensorModule.Thaumcraft=9
card.WorldSensor=1
maxPrivateChannels=5
maxPublicChannels=5
maxSensorRange=64
reflect=false

What is reflect?

#115 Cybergebi

  • New Members
  • 4 posts

Posted 14 April 2012 - 10:25 AM

Hi, i have a Problem, my Computer can show me any Information about the Reaktor, but only not the Reaktor Informations!(heat,...)

I use MC 1.1 with CCSensors BUILD11 and the Console!

My Error:

Quote

Posted Image

Please help me

Greetings Cybergebi

#116 yoskaz01

    Featured on Reddit!

  • New Members
  • 92 posts

Posted 14 April 2012 - 10:58 AM

 Cybergebi, on 14 April 2012 - 10:25 AM, said:

Hi, i have a Problem, my Computer can show me any Information about the Reaktor, but only not the Reaktor Informations!(heat,...)

I use MC 1.1 with CCSensors BUILD11 and the Console!

My Error:
Spoiler
Please help me

Greetings Cybergebi


Hey Cybergebi,

i found a possible bug in textutils function: tabulateCommon - it can't display booleans

to fix:
modify file: .minecraftmodsComputerCraftluaromapistextutils

change (should be line 56) from:
	nMaxLen = math.max( string.len( sItem ) + 1, nMaxLen )
to:
	nMaxLen = math.max( string.len( tostring(sItem) ) + 1, nMaxLen )


#117 yoskaz01

    Featured on Reddit!

  • New Members
  • 92 posts

Posted 14 April 2012 - 11:05 AM

 FuzzyPurp, on 14 April 2012 - 12:54 AM, said:

Also the ui on the sensors seem to no longer work.

Spoiler
What is reflect?

working on a new UI for the sensors as part of SMP changes... (and i think i broke the existing one while doing so ;P )

reflect if a special item i use to get some info out of machine blocks..
i intended for it to be a generic sensorModule, but using it would be too confusing and unstable - so i kept it as a right-click item to get current values for Entity properties :)/>

#118 Cybergebi

  • New Members
  • 4 posts

Posted 14 April 2012 - 12:51 PM

 yoskaz01, on 14 April 2012 - 10:58 AM, said:

 Cybergebi, on 14 April 2012 - 10:25 AM, said:

Hi, i have a Problem, my Computer can show me any Information about the Reaktor, but only not the Reaktor Informations!(heat,...)

I use MC 1.1 with CCSensors BUILD11 and the Console!

My Error:
Spoiler
Please help me

Greetings Cybergebi


Hey Cybergebi,

i found a possible bug in textutils function: tabulateCommon - it can't display booleans

to fix:
modify file: .minecraftmodsComputerCraftluaromapistextutils

change (should be line 56) from:
	nMaxLen = math.max( string.len( sItem ) + 1, nMaxLen )
to:
	nMaxLen = math.max( string.len( tostring(sItem) ) + 1, nMaxLen )

Thank you very much!
You are the Best :)/>

#119 Narathena

  • Members
  • 4 posts

Posted 16 April 2012 - 04:34 AM

Ok I think I ran into a bug for world sensors.

I was using a world sensor to check the value of the light at a location (redpower light). If I save and exit my world without turning off the lights the sensor will freeze with a light level reading of 14. Moving the sensor to a new location was only a temporary fix shutting down minecraft showed the error return.

#120 yoskaz01

    Featured on Reddit!

  • New Members
  • 92 posts

Posted 16 April 2012 - 08:42 AM

 Narathena, on 16 April 2012 - 04:34 AM, said:

Ok I think I ran into a bug for world sensors.

I was using a world sensor to check the value of the light at a location (redpower light). If I save and exit my world without turning off the lights the sensor will freeze with a light level reading of 14. Moving the sensor to a new location was only a temporary fix shutting down minecraft showed the error return.
i haven't encountered this so far but i'll try to reproduce and check the code..





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users