Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- sChan = 16742
- foundside = 0
- if foundside == 0 then
- if peripheral.isPresent("top") and peripheral.getType("top") == "modem" then
- modem = peripheral.wrap("top")
- end
- end
- if foundside == 0 then
- if peripheral.isPresent("bottom") and peripheral.getType("bottom") == "modem" then
- modem = peripheral.wrap("bottom")
- end
- end
- if foundside == 0 then
- if peripheral.isPresent("front") and peripheral.getType("front") == "modem" then
- modem = peripheral.wrap("front")
- end
- end
- if foundside == 0 then
- if peripheral.isPresent("back") and peripheral.getType("back") == "modem" then
- modem = peripheral.wrap("back")
- end
- end
- if foundside == 0 then
- if peripheral.isPresent("left") and peripheral.getType("left") == "modem" then
- modem = peripheral.wrap("left")
- end
- end
- if foundside == 0 then
- if peripheral.isPresent("right") and peripheral.getType("right") == "modem" then
- modem = peripheral.wrap("right")
- end
- end
- modem.open(sChan)
- function getBalance(usergb)
- UID = math.random(1,65535)
- usergb = string.lower(usergb)
- modem.transmit(sChan, UID, "Get Balance "..usergb)
- receivedreply = 0
- while receivedreply == 0 do
- event, side, fromchan, replychan, msg, distance = os.pullEvent("modem_message")
- if fromchan == sChan and replychan == UID then
- if oldb ~= nil then
- oldb = balance
- end
- balance = msg
- receivedreply = 1
- return balance
- end
- end
- end
Add Comment
Please, Sign In to add comment