Difference between revisions of "ScriptCore3.weap2obj"

From Soldat Community Wiki
Jump to: navigation, search
(Created page with " '''function weap2obj(Style: Byte): Byte''' Style: string that is to be converted into a number Result: conversion result ==Description== This converts a string into a nu...")
 
(Description)
 
(7 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
  '''function weap2obj(Style: Byte): Byte'''
 
  '''function weap2obj(Style: Byte): Byte'''
   Style: string that is to be converted into a number
+
   Style: Position(Style) of the weapon in the [[TWeapon.WType]]
   Result: conversion result
+
   Result: Position(Style) of the weapon in the [[TMapObject.Style]]
  
 
==Description==
 
==Description==
This converts a string into a number.
+
Translates the position of the weapon in the WType property of a Weapon Object - weapon in player's hands ([[TWeapon.WType]]) to the corresponding position of the Style property of a Map Object - lying weapon ([[TMapObject.Style]]).
  
 +
==Examples==
 +
<source lang="pascal">
 +
begin
 +
    WriteLn('weap2obj: '+inttostr(weap2obj(1))); //5
 +
    WriteLn('weap2obj: '+inttostr(weap2obj(13))); //26
 +
    WriteLn('weap2obj: '+inttostr(weap2obj(15))); //Exception: Invalid weapon style (Archery is bowing. Sorry, this just doesn't work)
 +
end.
 +
</source>
  
 
[[Category:Functions]]
 
[[Category:Functions]]

Latest revision as of 17:53, 1 May 2018

function weap2obj(Style: Byte): Byte
 Style: Position(Style) of the weapon in the TWeapon.WType
 Result: Position(Style) of the weapon in the TMapObject.Style

Description

Translates the position of the weapon in the WType property of a Weapon Object - weapon in player's hands (TWeapon.WType) to the corresponding position of the Style property of a Map Object - lying weapon (TMapObject.Style).

Examples

begin
    WriteLn('weap2obj: '+inttostr(weap2obj(1))); //5
    WriteLn('weap2obj: '+inttostr(weap2obj(13))); //26
    WriteLn('weap2obj: '+inttostr(weap2obj(15))); //Exception: Invalid weapon style (Archery is bowing. Sorry, this just doesn't work)
end.