![]() |
| |||||||
| Home | GzP Upload | GzP Arcade | Register | vbBux / vbPlaza | All Albums | FAQ | Donate | Members List | Calendar | Mark Forums Read |
![]() |
| | Thread Tools | Display Modes |
| | #1 |
| Registered User | Refresher Function Ok. I am making a function that will use an MP potion whenever the player's MP gets below a certain percent. I think I almost have it, but when I run it with the code below, I get the error "[10:12:33] Scripting: Execution of script file Scripts\wtfux.atmt failed: [Automaton::Bindings::System::AddCommand] incorrect arguments". Could someone please tell me my error? Thanks. In OnTick event: Code: if(wtfuxv.mana == 1) then
if("..Actor:Get(ManaPoints)" <= "..Actor:Get(ManaPointsMax)" * wtfuxv.manapercent) then
ExecuteCommand(Item FirstRefresher)
ExecuteCommand(Item SecondRefresher)
ExecuteCommand(Item ThirdRefresher)
ExecuteCommand(Item FourthRefresher)
ExecuteCommand(Item FifthRefresher)
end
end Code: function wtfux.enautomana( Arguments ) wtfuxv.mana = 1 wtfuxv.manapercent = tonumber( "..Arguments.." ) * 0.1 return true end function wtfux.disautomana() wtfux.Mana = 0 return true end Code: AddCommand ( wtfux.enautopotion, "EnAutoPotion", "[MP]", "Uses a mana potion when your MP is below [MP] percent." ) AddCommand ( wtfux.disautopotion, "DisAutoPotion", "", "Disables using the AutoPotion command." ) |
| | |
| Sponsored Links |
| |
| | #2 |
| Registered User | Re: Refresher Function I cant tell you what the error is but i can tell you this When you run Automaton and press END you will open a menu in wich you can set the MP, FP and HP recovery using refreshers, vital drinks and food. Its great that your learning LUA ^^ |
| | |
| | #3 |
| Registered User | Re: Refresher Function No clue but just from looking at it I see a few spelling mistakes that may not be intended. wtfuxv vs wtfux wtfuxv.mana vs wtfux.Mana (capital and alternate spelling) wtfux.enautopotion vs wtfux.enautomana (different functions entirely) check that and try it. ex: Try changing the addcommands to this: Code: AddCommand ( wtfux.enautomana, "EnAutoPotion", "[MP]", "Uses a mana potion when your MP is below [MP] percent." ) AddCommand ( wtfux.disautomana, "DisAutoPotion", "", "Disables using the AutoPotion command." ) Last edited by M0J0; 06-22-2008 at 02:31 PM. |
| | |
| | #4 | ||
| Registered User | Re: Refresher Function Quote:
The wtfuxv.mana vs wtfux.Mana. As i said before it is supposed to be wtfuxv and the it's supposed to be uncapitalized. If you look at the other variables they are not capitalized. Plus it does not really matter, as long as I always use the variable without a capital. Quote:
It's supposed to be wtfux.enautomana and wtfux.disautomana. Lol. Thanks for your help. There is one more thing though. I'm pretty sure that the "ExecuteCommand( Item FristRefresher) doesn't work, so I'm going to try using the UseItem command. the only problem is that I do not know the IDs for First Refresher - Fifth Refresher. Could someone please find them for me? Thanks EDIT: Ok, I've fixed my script and I do not need the Refresher's IDs. Ive got the script so that it runs, but when I use my command, it gives me this error: "Error: Call to command in script failed: [string "..."]:736: attemt to perform arithmetic on a nil value." The line that it is talking about is this line: "wtfuxv.manapercent = tonumber( "..Arguments.." ) * 0.1" Thanks. Last edited by Nini; 06-22-2008 at 05:22 PM. | ||
| | |
| | #5 |
| Registered User | Re: Refresher Function Maybe instead of: if(wtfuxv.mana == 1) then it should be if(wtfux.mana == 1) then Idk...? |
| | |
| | #6 | |
| Registered User | Re: Refresher Function Yea, as I sort of hinted I have no experience with Lua or scripting for Automaton, I was strictly looking at the code. I have a knack for finding logic errors =P Quote:
Why don't you just custom enter the mana until you get it working, don't try to work with crazy percent things just yet. Try changing this: Code: if("..Actor:Get(ManaPoints)" <= "..Actor:Get(ManaPointsMax)" * wtfuxv.manapercent) then Code: if("..Actor:Get(ManaPoints)" <= 500 then But then again, I probably shouldn't be going into this lol, I don't do anything with lua or Automaton. | |
| | |
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
| |