Forum
CS2D Scripts Lua Scripts/Questions/Help - Dark Void - has written
Where can I find all the os. io. ect. and there definitions?
www.lua.org
Look for the manual.
Toa Hero 92 has written
Well If I Can't Then How can I Make it So?
And, If no-one can answer me with a solution, I will seriously consider Private Messaging DC with the question.
Mostly because no-one seems to have any clue as to how to find and manipulated those values...
Toa Hero 92 has written
Hello People, I want to start off with displaying these values:(dynamic objects are used for buildings, mines etc.!)
- object(id,"value") Return a value of a dynamic object:
exists, typename, type,
health, mode, team, player,
x, y, rot, tilex, tiley,
countdown, rootrot, idle,
rotvar, target, upgrade
Moreover there is:
object(0,"table"): table with all dynamic object IDs
In this script : Code:
addhook("build","buildmessage")
function buildmessage(p,type,x,y,mode,objectid)
--object = (objectid)
--id=(type)
print("You have built building type: "..type.." At X="..x.." At Y="..y.." With Mode: "..mode.." And With Object Id:"..objectid.."")
--print("Object type "..object(id,"typename").."")
end
As you can see I have tried to fix this error:LUA ERROR: sys/lua/samples/toainstabuild.lua:58: attempt to call global 'object' (a nil value)
& this error: LUA ERROR: sys/lua/samples/toainstabuild.lua:59: attempt to call local 'object' (a number value)
and this error too:LUA ERROR: sys/lua/samples/toainstabuild.lua:60: attempt to call global 'object' (a number value)
So.... how can i fix it please help because I'm stumped
- object(id,"value") Return a value of a dynamic object:
exists, typename, type,
health, mode, team, player,
x, y, rot, tilex, tiley,
countdown, rootrot, idle,
rotvar, target, upgrade
Moreover there is:
object(0,"table"): table with all dynamic object IDs
In this script : Code:
addhook("build","buildmessage")
function buildmessage(p,type,x,y,mode,objectid)
--object = (objectid)
--id=(type)
print("You have built building type: "..type.." At X="..x.." At Y="..y.." With Mode: "..mode.." And With Object Id:"..objectid.."")
--print("Object type "..object(id,"typename").."")
end
As you can see I have tried to fix this error:LUA ERROR: sys/lua/samples/toainstabuild.lua:58: attempt to call global 'object' (a nil value)
& this error: LUA ERROR: sys/lua/samples/toainstabuild.lua:59: attempt to call local 'object' (a number value)
and this error too:LUA ERROR: sys/lua/samples/toainstabuild.lua:60: attempt to call global 'object' (a number value)
So.... how can i fix it please help because I'm stumped
Flacko has written
You can't.
That means that object hasn't been declared as a function.
That means that object hasn't been declared as a function.
Well If I Can't Then How can I Make it So?
And, If no-one can answer me with a solution, I will seriously consider Private Messaging DC with the question.
Mostly because no-one seems to have any clue as to how to find and manipulated those values...
Try this:
1
2
3
4
5
2
3
4
5
addhook("build","buildmessage") function buildmessage(p,type,x,y,mode,objectid) print("Type: "..type.."at x ="..x) print("Object type "..object(objectid,"typename")) end
[quote = "Some GUy"]
Where can I find all the os. io. ect. and there definitions?
[/quote]
http://www.lua.org/manual/5.1/manual.html#5
It isn't working due to a bug I guess.
Maybe a recent error when registering the lua function.
1
print(os.tmpname())
It saves a lot of work
And your script wouldn't work and it's weird
1
2
3
2
3
local 0 = 1,32 --Blazing told u that this was ridiculous, why would u do it again? Temporary_Name = os.tmpfile() --Wait, weren't we talking about os.tmpname? player = tonumber(string.sub(txt, 2, string.len(txt)) ) --This would convert the string name 1 to a number.
edited 1×, last 03.12.09 07:46:22 am
is using math.random()
xd
I need it very very much...
addhook("say","givemoney")
function givemoney(id,txt)
if (string.sub(txt, 1, 1) == "!give "player" "money"") then
if player(id,"money") > money then
money = tonumber(string.sub(txt, 2, string.len(txt)) )
player = tonumber(string.sub(txt, 3, string.len(txt)) )
parse("setmoney "..player.." "+money)
parse("setmoney "..id.." "..player(id,"money")-money)
end
end
end
1
2
3
4
5
6
7
8
9
10
11
12
2
3
4
5
6
7
8
9
10
11
12
addhook("say","givemoney") function givemoney(id,txt) if (string.sub(txt, 1, 1) == "$") then 		if player(id,"money") > 10 then money = tonumber(string.sub(txt, 2, string.len(txt)) ) 		 pl = tonumber(string.sub(txt, 3, string.len(txt)) ) parse("setmoney "..pl.." "..player(pl,"money"))+money) 		 parse("setmoney "..id.." "..player(id,"money"))-money) end end end
I don't know if This one works either
edited 1×, last 05.12.09 02:20:40 am
Quote
addhook("say","givemoney")
function givemoney(id,txt)
mn = player(id,"money")
if (txt=="$") then
parse("setmoney "..id.." "..mn)
end
end
function givemoney(id,txt)
mn = player(id,"money")
if (txt=="$") then
parse("setmoney "..id.." "..mn)
end
end
edited 1×, last 05.12.09 02:32:09 am
You also loss money when you give money
like give:$10 loss: $10
Oh, you want same thing like in Zombie Plague 1.1b?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
function toTable(t,match) 	local cmd = {} 	if not match then 		match = "[^%s]+" 	else 		match = "[^"..match.."]+" 	end 	for word in string.gmatch(t, match) do 		table.insert(cmd, word) 	end 	return cmd end addhook("say","sayz") function sayz(id, text) 	local ptxt = toTable(text) 	if ptxt[1] == "$" and #ptxt == 3 then --Ok the format would be "$ PLAYER MONEY" 		local rcvp = tonumber(ptxt[2]) --Recieving player 		local rcvm = tonumber(ptxt[3]) --Money 		if player(rcvp,"exists") then --If the player exists 			if player(id,"money") >= rcvm then --and this dude has enough money 				if player(rcvp,"money") + rcvm <= 16000 then --check if we won't give him too much money (so we don't waste cash) 					parse("setmoney "..id.." "..player(id,"money")-rcvm) 					parse("setmoney "..rcvp.." "..player(rcvp,"money")+rcvm) 				elseif player(rcvp,"money") < 16000 then --Ok this guy would overpass $16000 with our donation so we deduct this 					rcvm = 16000 - player(rcvp,"money") --Here 					parse("setmoney "..id.." "..player(id,"money")-rcvm) 					parse("setmoney "..rcvp.." "..player(rcvp,"money")+rcvm) 				end 			end 		end 	end end
Edit: Page 111 is mine too
for example:
1
msg2 <color> <id> <txt> .
I need to understand that.
- Dark Void - has written
Where can I learn wxLua ?
wxLua O.o
try check this http://wxlua.sourceforge.net/