Prepare statistic?

From Unofficial QEdit Wiki Guide
Jump to: navigation, search

Syntax

Syntax: prepare_statistic? register1, Success Function, Failure Function

  • register1 = This register must contain the Quest Number.
  • Success Function = This must contain the function number for the successful code.
  • Failure Function = This must contain the function number for the failure code.

Use

This Opcode must be used prior to send_statistic?. It informs the ship of the quest number and which functions are to be called upon success or failure.

Example


100:     leti R100, 00000001 //Quest number 1. This is validated by the Ship so an incorrect number will return an error.
         prepare_statistic? R100, 200, 210
         send_statistic? R1, R2, R3, R4, R5, R6, R7, R8
         clear R10
         clear R11
         clear R12
101:     sync
         addi R10, 000000001
         jmpi_>= R10, 00000012C, 110 //If loop has run for 300 frames (10 Seconds)
         jmpi_= R11, 000000001, 120
         jmpi_= R12, 000000000, 101 
         window_msg 'The Ship has responded and has requested to open thread on success function'
         winend 
         ret 
110:     window_msg 'There has been no response from the ship. Timed out.'
         winend 
         ret 
120:     window_msg 'There has been an error. Ship has requested to open thread on failure function.'
         winend 
         ret 
200:     set R12 //Received successful response from Ship.
         ret 
210:     set R11 //Received failure response from Ship.
         ret 

Also see

leti, send_statistic?, clear, sync, addi, jmpi_>=, jmpi_=, jmp, window_msg, winend, set, ret