Is there higher praise? Im dancing in my room right noaw... :DFLOZi wrote:Speed is a float so that should be fine. Picasso is probably on the right track
The aGorm can't code well Thread
Moderator: Moderators
Re: The aGorm can't code well Thread
Re: The aGorm can't code well Thread
OK, just did a test, if the speed is above 1, it works fine, if the speed is less, it stops and starts. It's not going over hills or anything, it's flat ground. Can someone with some knowledge of how the engine works weigh in with a reason why it would do something so stupid? I mean, I dont compleatly mind doing the sort of hack Picassos on about, it's just would it would be better if I didn't have to.
aGorm
aGorm
Re: The aGorm can't code well Thread
have some units that do that too.
i think it is just Spring's pathing and certain combinations of speed/acceleration/brakerate/turnInPlace/... in the unitDef hat causes some units to do the StartMoving() StopMoving() spam.
i think it is just Spring's pathing and certain combinations of speed/acceleration/brakerate/turnInPlace/... in the unitDef hat causes some units to do the StartMoving() StopMoving() spam.
Re: The aGorm can't code well Thread
More hunting, it seems to do it every 470/1000's of a second. Regardless of teh speed of the unit, as long as it's below 1. Changing the brakerate/acceleration seems to have no effect...
For now I'll just do a hack like Picassos, it will prob also solve the walk animation stoping when your changing destination, so might be a good odea anyway.
aGorm
For now I'll just do a hack like Picassos, it will prob also solve the walk animation stoping when your changing destination, so might be a good odea anyway.
aGorm
Re: The aGorm can't code well Thread
Whats the difference between a local and not local function?
function stoptimer ()
local function stoptimer ()
For some reason "StartThread (stoptimer)" is only working when it's not a local function, but thats a bit weird as other threads are in local functions and work fine when called that way.
Is there a limit to the number of local functions?
aGorm
function stoptimer ()
local function stoptimer ()
For some reason "StartThread (stoptimer)" is only working when it's not a local function, but thats a bit weird as other threads are in local functions and work fine when called that way.
Is there a limit to the number of local functions?
aGorm
Re: The aGorm can't code well Thread
when a function is local its definition must be further up then the line where it is called.
"not local" is called global.
that system not only applies to function but also to variables.
http://www.lua.org/pil/4.2.html
http://www.lua.org/pil/6.2.html
etc
"not local" is called global.
that system not only applies to function but also to variables.
http://www.lua.org/pil/4.2.html
http://www.lua.org/pil/6.2.html
etc
Re: The aGorm can't code well Thread
Ahh... I see, it's below were i'm calling it. Should relly have spotted that, thanks.
Re: The aGorm can't code well Thread
Double post...
What does this mean? I keep getting it randomly, nothing seem to have stoped working as far as I can see, but I assume somthing must be wrong?
::EDIT:: paste bin of unit script that is prob the cause http://pastebin.com/7nvbUGbX
Code: Select all
[f=0005778] LuaRules::RunCallIn: error = 2, GameFrame, [string "LuaGadgets/Gadgets/unit_script.lua"]:745: attempt to index field '?' (a nil value)
stack traceback:
[string "LuaGadgets/Gadgets/unit_script.lua"]:745: in function 'GameFrame'
[string "LuaGadgets/gadgets.lua"]:936: in function <[string "LuaGadgets/gadgets.lua"]:934>
(tail call): ?
::EDIT:: paste bin of unit script that is prob the cause http://pastebin.com/7nvbUGbX
Re: The aGorm can't code well Thread
At a glance I don't see anything wrong with it, but your indenting makes it hard to read
Re: The aGorm can't code well Thread
Ok, so progress moves forward, and I've hit another problem.
Namly,
For some reason this only gives me the build option to make the fac, not the gen or the lord. I know the lord should be buildable because the fac can build it and several other units fine. However thsi mobile builder only seems to be able to build the fac and nothign else.
I also know the gen unit works cause I can /give myself one and it comes out fine.
Is there somthign differnt between mobile and non-mobile builders that means that list won't work?
aGorm
Namly,
Code: Select all
buildoptions =
{
"cyberfac",
"cybergen",
"cyberlord",
},
I also know the gen unit works cause I can /give myself one and it comes out fine.
Is there somthign differnt between mobile and non-mobile builders that means that list won't work?
aGorm
Re: The aGorm can't code well Thread
look into the infolog, sometimes it says high above the usual errors, that a unit is taken from the productionlist of a factory -without stating any good reason for that.
May i take the liberty to ask in Addition:
http://springrts.com/wiki/Lua_SyncedRead
>>Spring.GetPlayerControlledUnit
is the tool of choice if you want to find out if "your" unit is the currently selected?
Also, how does one start soundfiles from unit.scripts. I know they have to be listed somewhere first, before they can be called. Just one line of example Code Sir, my scriptkids are starvin.
Oh, thank you Sir. thank you.
May i take the liberty to ask in Addition:
http://springrts.com/wiki/Lua_SyncedRead
>>Spring.GetPlayerControlledUnit
is the tool of choice if you want to find out if "your" unit is the currently selected?
Also, how does one start soundfiles from unit.scripts. I know they have to be listed somewhere first, before they can be called. Just one line of example Code Sir, my scriptkids are starvin.
Oh, thank you Sir. thank you.
Re: The aGorm can't code well Thread
No idea really. Maybe try switching the order of the entries in buildoptions to see if something happens.For some reason this only gives me the build option to make the fac, not the gen or the lord.
Don't think so.Is there somthign differnt between mobile and non-mobile builders that means that list won't work?
Would need to look at whole unitdefs or mod...
that is to get what unit a player is currently FPS-controlling.>>Spring.GetPlayerControlledUnit
is the tool of choice if you want to find out if "your" unit is the currently selected?
For selected units: http://springrts.com/wiki/Lua_UnsyncedR ... cted_Units
sounds:
http://springrts.com/wiki/Sounds.lua
http://springrts.com/wiki/Lua_UnsyncedCtrl#Sounds
Not sure if it works from unit scripts.
You are allowed to make new threads
Re: The aGorm can't code well Thread
it thought if i would sacrifice my own phail in anothers thread, the wrath of the godz would strike down, and we both could use the electricity of the ligthning to get our train further forwards.
Explanation for wanting the sound:
Im sick of the phail that are my other scripts, so i decided to follow your example and to complete something simple. So i turned back to the motiondectector, and yeah, it works.
Did some research on how much heartbeats a relaxed human haz and how much a stressed, synchronized it with the beats, will grow the fear from the alienz inside the users.
Explanation for wanting the sound:
Im sick of the phail that are my other scripts, so i decided to follow your example and to complete something simple. So i turned back to the motiondectector, and yeah, it works.
Did some research on how much heartbeats a relaxed human haz and how much a stressed, synchronized it with the beats, will grow the fear from the alienz inside the users.
- Forboding Angel
- Evolution RTS Developer
- Posts: 14673
- Joined: 17 Nov 2005, 02:43
Re: The aGorm can't code well Thread
Take the comma out form the last entry:aGorm wrote:Ok, so progress moves forward, and I've hit another problem.
Namly,For some reason this only gives me the build option to make the fac, not the gen or the lord. I know the lord should be buildable because the fac can build it and several other units fine. However thsi mobile builder only seems to be able to build the fac and nothign else.Code: Select all
buildoptions = { "cyberfac", "cybergen", "cyberlord", },
I also know the gen unit works cause I can /give myself one and it comes out fine.
Is there somthign differnt between mobile and non-mobile builders that means that list won't work?
aGorm
Code: Select all
buildoptions =
{
"cyberfac",
"cybergen",
"cyberlord"
},
Re: The aGorm can't code well Thread
Thx Forb, that solves alot of issues
Re: The aGorm can't code well Thread
That shouldn't make any difference at all afaik?
- Forboding Angel
- Evolution RTS Developer
- Posts: 14673
- Joined: 17 Nov 2005, 02:43
Re: The aGorm can't code well Thread
Shouldn't, but for reasons known only to god, it does. Happens in some other arrays as well, like in featureplacer random arrays it happens there too. Weird, but I just chalk it up to some logic that is too simple for my dumb ass to understand. Once you know it isn't that big of a deal anymore.
Re: The aGorm can't code well Thread
http://www.lua.org/pil/3.6.htmlYou can always put a comma after the last entry. These trailing commas are optional, but are always valid:
Such flexibility makes it easier to write programs that generate Lua tables, because they do not need to handle the last element as a special case.Code: Select all
a = {[1]="red", [2]="green", [3]="blue",}
Finally, you can always use a semicolon instead of a comma in a constructor. We usually reserve semicolons to delimit different sections in a constructor, for instance to separate its list part from its record part:
Code: Select all
{x=10, y=45; "one", "two", "three"}
Javascript also has this but not quite the same. If you put a trailing comma, IE7 will freak out, old versions of firefox will assume you made a mistake, and everything else will follow the spec and place a null value as the last item in the array.
Re: The aGorm can't code well Thread
Sorry, I fixed this but never thought to post back here... it was actully a lot more simple. Nothing was wrong with the code. It was just I had a back up of teh file in a subdirectory of units, not realising it would load up any file in a sub over the one in the root...
aGorm
aGorm
Re: The aGorm can't code well Thread
This is why we ignore Forb,aGorm wrote:Sorry, I fixed this but never thought to post back here... it was actully a lot more simple. Nothing was wrong with the code. It was just I had a back up of teh file in a subdirectory of units, not realising it would load up any file in a sub over the one in the root...
aGorm
btw picasso, fwiw, I would make a function PlayUnitSound(unitID, sound [, volume]) in a gadget;
Code: Select all
local function PlayUnitSound(unitID, sound, volume)
local x,y,z = Spring.GetUnitPosition(unitID)
local dx,dy,dz = Spring.GetUnitVelocity(unitID)
Spring.PlaySound(sound, volume or 1, x,y,z, dx,dy,dz, "unitreply")
end
GG.PlayUnitSound = PlayUnitSound
Code: Select all
local PlayUnitSound = GG.PlayUnitSound
...
PlayUnitSound(unitID, "sayhitoknorke")