Page 1 of 1

Question

Posted: Sat Sep 12, 2009 8:00 pm
by Uniden65
When i die i dont want to do anything but stop the bot so the bot stops but sooner our later it trys to ress it self at revival spot ....this is ok but then all the EVIL pvps attack you while your not there.......:((((

So the question i have is how do i have the bot revive after death then cast a spell since iam a Rogue Hide ....at least that will save me from the lower levels?

-- Testing this Now ..After i reassigned F to Hide?

Code: Select all

	<onDeath>
		-- Additional Lua code to execute on death
                keyboardPress(key.VK_F); 
		pauseOnDeath(); -- Stop the script
	</onDeath>

is there anything i can do like this after death ?

Thanks all for your hard work

Re: Question

Posted: Sat Sep 12, 2009 8:24 pm
by Administrator
This will probably work (if you've got the latest version off of SVN):

Code: Select all

<onDeath>
  -- Additional Lua code to execute on death
  RoMScript("AcceptResurrect();");
  yrest(30000); -- Wait 30 seconds
  RoMScript("CastSkillByName('Hide');");
</onDeath>
Then again, it will probably trigger AcceptResurrect() twice (which you don't want) because of the automatic resurrect options. You could avoid that by disabling automatic resurrect and using that macro, however, I'm not sure how it would react. It might pause the script if automatic resurrection is disabled. I'm sure d003232 would probably know a bit better about this, as he's practically rewrote that system recently.

Re: Question

Posted: Sun Sep 13, 2009 1:58 am
by d003232
Administrator wrote:You could avoid that by disabling automatic resurrect and using that macro, however, I'm not sure how it would react. It might pause the script if automatic resurrection is disabled. I'm sure d003232 would probably know a bit better about this, as he's practically rewrote that system recently.

Code: Select all

<onDeath>
      sendMacro("AcceptResurrect();");
      yrest(30000); -- Wait 30 seconds
      sendMacro("CastSkillByName('Hide');");
      pauseOnDeath(); -- Stop the script
</onDeath>
Yes you should set

Code: Select all

<option name="RES_AUTOMATIC_AFTER_DEATH" value="false" />
to avoid the automatic resurrect.

remarks
  • the yrest is to wait for the loadscreen to go. You can reduce it to you needs
  • instead of hide and pause you also can use 'player:logout();' or 'player:sleep();'
  • sendMacro() is the same like RoMScript(), it will just add an additional message to your MM window, so you can watch the work
For using 'player:sleep()' I suppose we should add a skill as option. So the bot would cast that skill (hide in this case) and go to sleep. If you got aggro he would awake. After the fight cast again that skill (hide) and go again to sleep. What do you think?

@admin: I didn't know, that there is an API function 'CastSkillByName'. Thats better then using UseSkill("..self.skilltab..","..self.skillnum..");

Re: Question

Posted: Sun Sep 13, 2009 3:13 am
by droppen
d003232 wrote: @admin: I didn't know, that there is an API function 'CastSkillByName'. Thats better then using UseSkill("..self.skilltab..","..self.skillnum..");
I don't think so, because of the german version has different names for spell's

Re: Question

Posted: Sun Sep 13, 2009 3:36 am
by d003232
droppen wrote:
d003232 wrote: @admin: I didn't know, that there is an API function 'CastSkillByName'. Thats better then using UseSkill("..self.skilltab..","..self.skillnum..");
I don't think so, because of the german version has different names for spell's
ok. So it not good to use for the generic case. Perhaps it accept also the english name in the german version? I will try that later.

Re: Question

Posted: Sun Sep 13, 2009 3:53 am
by Uniden65
Well RoMScript("CastSkillByName('Hide');"); does not work in Rom it comes back with a lua crash...so ill try your way doo3232 see what happenes :)

Re: Question

Posted: Sun Sep 13, 2009 4:21 am
by GurdyMan
CDWriter wrote:Well RoMScript("CastSkillByName('Hide');"); does not work in Rom it comes back with a lua crash...so ill try your way doo3232 see what happenes :)
RoMScript("CastSkillByName(\"Hide\");");

Does that work?

Re: Question

Posted: Sun Sep 13, 2009 4:26 am
by d003232
GurdyMan wrote:
CDWriter wrote:Well RoMScript("CastSkillByName('Hide');"); does not work in Rom it comes back with a lua crash...so ill try your way doo3232 see what happenes :)
RoMScript("CastSkillByName(\"Hide\");");

Does that work?
From LUA side yes. (You can use a editor, that marks the lua code. Then you see if all is a big string within lua.).
I'm curious, if it works from the RoM side. Please give feedback.

Re: Question

Posted: Sun Sep 13, 2009 4:54 am
by GurdyMan
Well, it seems everything is a spell.

sendMacro("CastSkillByName(\"Hide\");"); Doesn't exist as a RoM function, but

sendMacro("CastSpellByName(\"Hide\");"); does and is confirmed as working.

Re: Question

Posted: Tue Sep 29, 2009 3:18 pm
by j_schlott
why do you want your char to stay logged in if hes dead/just sitting at the rez stone

i would do as suggested and use player:logout() in the <ondeath> tags,

or this one to close the game completely
RoMScript("QuitGame();");