Пример #1
0
void start_check()
{
    mapping question_info;
    object me;
    string shows_all, shows_color, shows_flag;

    if( !environment(this_object() ) ) return;

    me = query("checking_player");
    if( !me || ( !IS_TEST && !me_ok(me) ) ) return;

    question_info = get_question( PIC_NUMBER );

    message_vision("只见一个$n急急忙忙地走了过来,直冲到$N面前,张口就问了一个问题。\n",
        me, this_object() );

    tell_object( me, query("name")+"说道:“"+me->query("name")+",我有一个问题想请教你,请你"HIR"务必要在三分钟内回答"NOR"我。”\n");

    tell_object( me,  question_info [ "shows_all" ] );
    tell_object( me,  query("name")+"说道:“我看不出来 "+question_info[ "shows_color" ] +" 这个颜色的 "+question_info[ "shows_flag" ] + " 图案在哪里,你能告诉我它在什么位置吗?”\n");
    tell_object( me,  query("name")+"继续说道:“从左往右数,你把它的位置告诉我就行了。”(ans 数字)\n");
    tell_object( me,  query("name")+"不厌其烦地说道:“如果你没看清,你可以问我,我重复一次。”(ask mengmian ren about 问题)\n");

    set( "quest", question_info[ "shows_all" ] + "\n颜色:"+ question_info[ "shows_color" ]+" 图案:"+question_info[ "shows_flag" ] + " ,请回答它的位置(从左到右数,<ans 数字>)。\n" );
    set( "quest_ans", question_info[ "answer" ] );
    set("wait_ans", 1);
    remove_call_out("delete_me");
    call_out("delete_me", 180 );
}
Пример #2
0
int main(int argc, char *argv[]) {
  if (argc != 5) {
    printf("usage: %s -p <port> -n <ipfile>\n\n<ipfile> should be a path to a file containing the IPv4 addresses of the\nnodes in your CDN, seperated by a newline character\n", argv[0]);
    exit(1);
  }

  int port = strtol(argv[2], NULL, 10);
  if (!(IP_FILE = fopen(argv[4], "r")))
    perror("fopen");
  get_question(port);
  return 0;
}
Пример #3
0
int main(int argc, char **argv)
{
	char* question;
	char* answer;
	while(1)
	{
		question = get_question();
		answer = get_answer();

		printf("%s\n", answer);
	}
	return 0;	
}
Пример #4
0
menuItem* yesNoItem::do_action() {
    display *lcd;
    uint8_t value;
    uint8_t button;

    lcd = get_display();
    value = *_variable;

    do {
        lcd->clear();
        get_question(buffer);
        lcd->print(buffer);
        
        if(value) {
            strcpy_P(buffer, yes_sel);
        } else {
            strcpy_P(buffer, yes_unsel);
        }
        lcd->setCursor(0, 2);
        lcd->print(buffer);
 
        if(value) {
            strcpy_P(buffer, no_unsel);
        } else {
            strcpy_P(buffer, no_sel);
        }
        lcd->setCursor(0, 3);
        lcd->print(buffer);
        
        // wait for some useful key
        do{
            button = buttons_reader.read();
        } while(button == IDLE);

        if(button == UP) {
            value = 1;
        } else if(button == DOWN) {
            value = 0;
        }

    } while(button == UP || button == DOWN);
    
    // if not "cancel", save value
    if(button != LEFT) {
        *_variable = value;
    }

    return 0;
}
Пример #5
0
menuItem* enterShutterSpeed::do_action() {
    display *lcd;
    int8_t speed_index;
    uint16_t speed;
    uint8_t button;

    lcd = get_display();
    get_question(buffer);
    speed_index = *_speed_index;

    do {
        lcd->clear();
        lcd->print(buffer);

        lcd->setCursor(0, 2);
        if(speed_index < 0) {
            lcd->print("1/");
        }
        speed = _shutter_speeds[abs(speed_index)];
        lcd->print(speed/10);
        if(speed%10) {
            lcd->print(".");
            lcd->print(speed%10);
        }

        // wait for some useful key
        do{
            button = buttons_reader.read();
        } while(button == IDLE);

        if(button == UP && speed_index < _shutter_speeds_count - 1) {
            speed_index++;
        } else if(button == DOWN && speed_index > 1 - _shutter_speeds_count) {
            speed_index--;
        }
        if(_f) {
            _f(speed_index);
        }

    } while(button == UP || button == DOWN);

    // if not "cancel", save value
    if(button != LEFT) {
        *_speed_index = speed_index;
    }

    return 0;
}
Пример #6
0
menuItem* enterNumberItem::do_action() {
    display *lcd;
    int value;
    uint8_t button;

    lcd = get_display();
    get_question(buffer);
    value = *_variable;

    do {
        lcd->clear();
        lcd->print(buffer);
        
        lcd->setCursor(0, 2);
        lcd->print(value);
        
        // wait for some useful key
        do{
            button = buttons_reader.read();
        } while(button == IDLE);

        if(button == UP) {
            value += _step;
        } else if(button == DOWN) {
            value -= _step;
            if(value < 0) {
                value = 0;
            }
        }
        if(_f) {
            _f(value);
        }

    } while(button == UP || button == DOWN);
    
    // if not "cancel", save value
    if(button != LEFT) {
        *_variable = value;
    }

    return 0;
}
Пример #7
0
menuItem* menuDialog::do_action() {
    display *lcd;
    uint8_t button;

    get_question(buffer);

    if(_f_start != 0) {
        _f_start();
    }

    lcd = get_display();
    lcd->clear();
    lcd->print(buffer);

    do {
        button = buttons_reader.read();
    } while(button == IDLE);

    if(_f_end != 0) {
        _f_end();
    }

    return 0;
}