Template:Sdk minimal example

From Virtual Paradise Wiki
Jump to navigation Jump to search
This is a minimal program example which contains no error checking

<c>

  1. include <vpsdk/VP.h>
  2. include <stdio.h>
  3. include <stdlib.h>
  1. define Username "User"
  2. define Password "1234"
  3. define World "VP-Build"

int main(int argc, char ** argv) {

   vp_init(VPSDK_VERSION);
   VPInstance sdk = vp_create();
   vp_connect_universe(sdk, "universe.virtualparadise.org", 57000);    
   vp_login(sdk, Username, Password, "VPBot");
   vp_enter(sdk, World);    
   vp_state_change(sdk);
   
   while(vp_wait(sdk, 1000) == 0){}
   return 0;

} </c>

Usage

This template should be subst:'d into the article to dump a copy of the above code in it, for modification by using: {{subst:sdk minimal example}}