Jump to content
  • Sky
  • Blueberry
  • Slate
  • Blackcurrant
  • Watermelon
  • Strawberry
  • Orange
  • Banana
  • Apple
  • Emerald
  • Chocolate
  • Charcoal


  • Content count

  • Joined

  • Last visited

About Zeldri

  • Rank
    Junior Member

Contact Methods

  • Minecraft
  1. Zeldri

    Sending multiple Variables in the network

    Ok so I dont know why but now I receive all the data but the problem is that I receive nil when I'm using it on my program But On my program i got a nil value There is my code local comp = require("component") local term = require("term") local colors = require("colors") local event = require("event") local gpu = comp.gpu local m = comp.modem gpu.setResolution(100,31) local w,h = gpu.getResolution() os.sleep(1) m.open(118) m.broadcast(118) while true do gpu.setBackground(0x202020) gpu.fill(1,1, w, h, " ") gpu.setBackground(0x606060) gpu.fill(1, 1, 2, h, " ") gpu.fill(1, 1, w, 1, " ") gpu.fill(w-1, 1, 2, h, " ") gpu.fill(1, h, w, 1, " ") gpu.fill(w/2, 1, 2, h, " ") gpu.fill(1, 1, w, 3, " ") gpu.set(w/4-4, 2,"Réacteur") gpu.set((w/2+w/4)-4, 2, "Crystaux") os.sleep(1) local evt,ladd,radd,dis,port,type,data1,data2,data3 = event.pull("modem_message") if type == "ReacteurInfo" then data1 = pct data2 = nrj data3 = nrjMax gpu.set(4,8,nrj) gpu.set(4,10,nrjMax) gpu.set(4,12,pct) end gpu.setBackground(0x000000) end
  2. Is that possible to send multiple variables with comp.modem.send() ? Because I want to send like that : function sendMsg(type,data,data2,data3) m.open(118) m.send(address,118,type,data,data2,data3) end And i call the function like that : sendMsg("ReacteurInfo",pct(),cube.getEnergy(),cube.getMaxEnergy()) The problem is that the second variable isn't being send ( the third too ) same if i put cube.getEnergy() before, (in this case only cube.getEnergy() is being send and vise-versa) But when I want to send 2 or 3 string it's working perfectly sendMsg("ReacteurInfo","test1","test2","test3")
  3. Zeldri

    How to set modem's address

    I didn't find a way to replace those addresses, but if u want to get an address easily, you have the sender(s) and the server which receive the message, but the sender need an address, so at the beginning of the infinite loop I put a component.modem.open(urport) _,_,address = event.pull("modem_message") function sendMsg(data,data2,data3) component.modem.send(address,port,data1,data2,data3) end And in the server which receive, you put in the infinite loop : component.modem.open(port) compoment.modem.broadcast(port) Of course replace port by ur port ^^ It's not the best way because it send a broadcast message to everyone each loop but u can make something that when the address as been receive you can stop the broadcast

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.