Difference between revisions of "ScriptCore3.weap2menu"

From Soldat Community Wiki
Jump to: navigation, search
(Created page with " '''function weap2menu(Style: Byte): Byte''' Style: string that is to be converted into a number Result: conversion result ==Description== This converts a string into a n...")
 
(Description)
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
  '''function weap2menu(Style: Byte): Byte'''
 
  '''function weap2menu(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 [[Weapons List]]
  
 
==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 in the Weapon Menu ([[Weapons List]]).
  
 +
==Examples==
 +
<source lang="pascal">
 +
begin
 +
    WriteLn('weap2menu: '+inttostr(weap2menu(1))); //1
 +
    WriteLn('weap2menu: '+inttostr(weap2menu(13))); //14
 +
    WriteLn('weap2menu: '+inttostr(weap2menu(15))); //Exception: Invalid weapon style (Well played, Robin Hood!)
 +
end.
 +
</source>
  
 
[[Category:Functions]]
 
[[Category:Functions]]

Latest revision as of 17:54, 1 May 2018

function weap2menu(Style: Byte): Byte
 Style: Position(Style) of the weapon in the TWeapon.WType
 Result: Position(Style) of the weapon in the Weapons List

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 in the Weapon Menu (Weapons List).

Examples

begin
    WriteLn('weap2menu: '+inttostr(weap2menu(1))); //1
    WriteLn('weap2menu: '+inttostr(weap2menu(13))); //14
    WriteLn('weap2menu: '+inttostr(weap2menu(15))); //Exception: Invalid weapon style (Well played, Robin Hood!)
end.