need some coding help

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

need some coding help

#1 Post by lisa » Mon Mar 28, 2011 9:37 pm

Ok I just can't work out how I am going to do this bit.

Basically I am setting a bot to follow a party member if the name matches one set in profile. Looks like this atm.

Code: Select all

  		if ( settings.profile.options.PARTY_FOLLOW_NAME ) then 
  		if GetPartyMemberName(1) == settings.profile.options.PARTY_FOLLOW_NAME  then RoMScript("FollowUnit('party1');");  end
		if GetPartyMemberName(2) == settings.profile.options.PARTY_FOLLOW_NAME  then RoMScript("FollowUnit('party2');");  end
		if GetPartyMemberName(3) == settings.profile.options.PARTY_FOLLOW_NAME  then RoMScript("FollowUnit('party3');");  end
		if GetPartyMemberName(4) == settings.profile.options.PARTY_FOLLOW_NAME  then RoMScript("FollowUnit('party4');");  end
		if GetPartyMemberName(5) == settings.profile.options.PARTY_FOLLOW_NAME  then RoMScript("FollowUnit('party5');");  end
		else RoMScript("FollowUnit('party1');");		

		end
Which works aslong as if their is a name in profile and it matches one of the party member names. Trouble is what if you put in a wrong name or spell it wrong? At the moment it follow no one.
I tried to just add in

Code: Select all

  		if ( settings.profile.options.PARTY_FOLLOW_NAME ) then
  		RoMScript("FollowUnit('party1');");
but it starts to follow party1 and then if name is right it starts to follow correct party member and does it back and forth non stop.
I guess I need to add a check if it is following after the member names and then if not make it follow party 1.

I am a bit tired so seeing if anyone else has an easy solution that I just can't think of lol
Remember no matter you do in life to always have a little fun while you are at it ;)

wiki here http://www.solarstrike.net/wiki/index.php?title=Manual

User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: need some coding help

#2 Post by lisa » Mon Mar 28, 2011 9:43 pm

lol nvm it just hit me

Code: Select all

	while (true) do	
  		if ( settings.profile.options.PARTY_FOLLOW_NAME ) then
  		if GetPartyMemberName(1) == settings.profile.options.PARTY_FOLLOW_NAME  then RoMScript("FollowUnit('party1');"); break  end
		if GetPartyMemberName(2) == settings.profile.options.PARTY_FOLLOW_NAME  then RoMScript("FollowUnit('party2');"); break  end
		if GetPartyMemberName(3) == settings.profile.options.PARTY_FOLLOW_NAME  then RoMScript("FollowUnit('party3');"); break  end
		if GetPartyMemberName(4) == settings.profile.options.PARTY_FOLLOW_NAME  then RoMScript("FollowUnit('party4');"); break  end
		if GetPartyMemberName(5) == settings.profile.options.PARTY_FOLLOW_NAME  then RoMScript("FollowUnit('party5');"); break  end
		RoMScript("FollowUnit('party1');");
		else RoMScript("FollowUnit('party1');");		

		end
break
	end
Remember no matter you do in life to always have a little fun while you are at it ;)

wiki here http://www.solarstrike.net/wiki/index.php?title=Manual

JackBlonder
Posts: 99
Joined: Sat Dec 18, 2010 6:55 am

Re: need some coding help

#3 Post by JackBlonder » Tue Mar 29, 2011 12:02 am

Code: Select all

if...
if...
if...
Every if is getting checked.

Code: Select all

if...
elseif...
elseif...
The second if is only checked, when the first fails.

User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: need some coding help

#4 Post by lisa » Tue Mar 29, 2011 2:20 am

so more like this

Code: Select all

  		if ( settings.profile.options.PARTY_FOLLOW_NAME ) then
    		if GetPartyMemberName(1) == settings.profile.options.PARTY_FOLLOW_NAME  then RoMScript("FollowUnit('party1');"); 
			elseif GetPartyMemberName(2) == settings.profile.options.PARTY_FOLLOW_NAME  then RoMScript("FollowUnit('party2');");
			elseif GetPartyMemberName(3) == settings.profile.options.PARTY_FOLLOW_NAME  then RoMScript("FollowUnit('party3');");
			elseif GetPartyMemberName(4) == settings.profile.options.PARTY_FOLLOW_NAME  then RoMScript("FollowUnit('party4');");
			elseif GetPartyMemberName(5) == settings.profile.options.PARTY_FOLLOW_NAME  then RoMScript("FollowUnit('party5');");
			else RoMScript("FollowUnit('party1');"); end
		
		else RoMScript("FollowUnit('party1');");		

		end
Remember no matter you do in life to always have a little fun while you are at it ;)

wiki here http://www.solarstrike.net/wiki/index.php?title=Manual

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 2 guests