Results 1 to 5 of 5

Thread: map_to_file ...Error?

  1. #1
    Senior Member Pazleysox's Avatar
    Join Date
    Feb 2009
    Posts
    438

    Default map_to_file ...Error?

    I've been using this code for many months for my chatbot to help people in dreadsylvania with element, and monster banishing.

    I only just found out today that if a user has a space in their name, the script aborts.

    I did not write this, it was written for me.
    Code:
    		record note
    			{
    		        string sender;
    		        int date;
    			}
    		[int] ChatLog;
        
        		int NE= count(ChatLog);
    		ChatLog[NE].sender= sender;
    		Map_to_File(ChatLog,"Chatlog.txt");
    		{
    			string [int] my_list;
    			file_to_map( "chatlog.txt" , my_list);
    			playerdata player;
    			string temp = "";
    			string user = "";
    			foreach i,playername in my_list 
    				{
    					player = GetPlayer( playername );
    					if( player.name != "" ) 
    					{
    						if( temp != "" ) temp += ", ";
    						temp += player.clanname;
    						user += player.name;
    					}
    				}
    			cli_execute("/whitelist " + temp);
    			if (temp != get_clan_name())
    			{print("Error!!");	
    			chat_private(user, "I couldn't join your clan " + temp +", perhaps I don't have a whitelist?");
    			return;}
    Here's the error I'm getting:
    Code:
    Incoming PM from Paz Sox saying: testhot
    Player "Paz Sox" not found!
    Sorry, you don't seem to be cool enough to have a whitelist for a clan like ''.
    
    Error!!
    Unknown recipient "I". Message (couldn't join your clan , perhaps I don't have a whitelist?) not sent.
    I'm not sure how to fix this... Is there anyone who sees the problem?
    Scripts I have written:
    Unlock Dread A Script to save you a bunch of clicks.
    Standard Rollover Bonus A Script that shows best items to pull/equip for bonus turns.
    Standard PVP Bonus A Script that shows the best items to pull/equip for bonus PVP Fights.
    Rollover Management A Script that does all the daily deeds you might have forgotten, or might have missed.
    Chatbot A Chatbot script. Simple start for those who want/need one for their clan.
    Zap Wand A Dungeon of Doom ZAP WAND getting script.

  2. #2
    Developer
    Join Date
    Apr 2010
    Posts
    5,050

    Default

    I would guess the issue is in this function : GetPlayer( playername ) which you do not show (As the code generating that error message isn't shown).

  3. #3
    Senior Member Pazleysox's Avatar
    Join Date
    Feb 2009
    Posts
    438

    Default

    I'm going to attempt to rewrite it. I was never happy with it to begin with.

  4. #4
    Developer
    Join Date
    Aug 2009
    Posts
    2,858

    Default

    It may also make sense to key your map by player ID, since that can't change, whereas a playername can undergo capitalization changes, or be "modified" by certain effects / equipment.

  5. #5
    Senior Member Pazleysox's Avatar
    Join Date
    Feb 2009
    Posts
    438

    Default

    It may also make sense to key your map by player ID, since that can't change, whereas a playername can undergo capitalization changes, or be "modified" by certain effects / equipment.
    Originally Posted by heeheehee View Post
    Thanks, I'll try that first. That will be easier than recoding the whole thing.
    Scripts I have written:
    Unlock Dread A Script to save you a bunch of clicks.
    Standard Rollover Bonus A Script that shows best items to pull/equip for bonus turns.
    Standard PVP Bonus A Script that shows the best items to pull/equip for bonus PVP Fights.
    Rollover Management A Script that does all the daily deeds you might have forgotten, or might have missed.
    Chatbot A Chatbot script. Simple start for those who want/need one for their clan.
    Zap Wand A Dungeon of Doom ZAP WAND getting script.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •